helma/modules/jala/util/Test/docs/jala.Test.DatabaseMgr.html

486 lines
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
jala.Test.DatabaseMgr
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="jala.Test.DatabaseMgr";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary-Global_jala.Test.js.html"><FONT CLASS="NavBarFont1"><B>File</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev">&nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<!--TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"--> <!--A HREF="deprecated-list.html"--><!--FONT CLASS="NavBarFont1">Deprecated</FONT--><!--/A--><!--&nbsp;</TD-->
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"--><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<B>Jala Test</B>
</EM>
</TD
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="jala.Test.ArgumentsException.html"><B>PREV CLASS</B></A><!--
NEXT CLASS
-->
&nbsp;<A HREF="jala.Test.EvaluatorException.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="jala.Test.DatabaseMgr.html" TARGET="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;
<SCRIPT>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>Class jala.Test.DatabaseMgr</H2>
<PRE>Object
|
+--<b>jala.Test.DatabaseMgr</b>
</PRE>
<HR>
<DL>
<!-- Class definition -->
<DT>class
<B>jala.Test.DatabaseMgr</B>
</DL>
<P>
<BR/>Instances of this class allow managing test databases
and switching a running application to an in-memory test
database to use within a unit test.
<BR/><I>Defined in <a href='overview-summary-Global_jala.Test.js.html'>Global/jala.Test.js</a></I><BR/><BR/>
</P>
<HR>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- ======== END NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<!-- This is one instance field summary -->
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="#databases">databases</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map containing all test databases</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="#dbSourceProperties">dbSourceProperties</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map containing the original datasource
properties that were temporarily deactivated
by activating a test database</TD>
</TR>
</TABLE>
&nbsp;
<!-- =========== END FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD>
<CODE>
<B>
<A HREF="jala.Test.DatabaseMgr.html#jala.Test.DatabaseMgr()">jala.Test.DatabaseMgr</A>
</B>
()
</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Returns a newly created DatabaseMgr instance
</TD>
</TR>
</TABLE>
<!-- ======== END CONSTRUCTOR SUMMARY ======== -->
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%">
<FONT SIZE="-1">
<CODE>&nbsp;jala.db.RamDatabase</CODE>
</FONT>
</TD>
<TD>
<CODE>
<B>
<A HREF="#startDatabase">startDatabase</A></B>(&lt;String&gt; dbSourceName, &lt;Boolean&gt; copyTables, &lt;Array&gt; tables)
</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Switches the application datasource with the given name
to a newly created in-memory database.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%">
<FONT SIZE="-1">
<CODE>&nbsp;void</CODE>
</FONT>
</TD>
<TD>
<CODE>
<B>
<A HREF="#stopAll">stopAll</A></B>()
</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Stops all registered test databases and and reverts the application
to its original datasource(s) as defined in db.properties file.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%">
<FONT SIZE="-1">
<CODE>&nbsp;Object</CODE>
</FONT>
</TD>
<TD>
<CODE>
<B>
<A HREF="#toString">toString</A></B>()
</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</TD>
</TR>
</TABLE>
<P>
<!-- ========== END METHOD SUMMARY =========== -->
<!-- ============ FIELD DETAIL START =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="databases"><!-- --></A>
<H3>databases</H3>
<PRE>Object&nbsp;<B>databases</B></PRE>
<UL>
Map containing all test databases
</UL>
<HR>
<A NAME="dbSourceProperties"><!-- --></A>
<H3>dbSourceProperties</H3>
<PRE>Object&nbsp;<B>dbSourceProperties</B></PRE>
<UL>
Map containing the original datasource
properties that were temporarily deactivated
by activating a test database
</UL>
<HR>
<!-- ============ FIELD DETAIL END =========== -->
<!-- ========= CONSTRUCTOR DETAIL START ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1>
<FONT SIZE="+2"><B>Constructor Detail</B></FONT>
</TD>
</TR>
</TABLE>
<A NAME="jala.Test.DatabaseMgr()"><!-- --></A><H3>
jala.Test.DatabaseMgr</H3>
<PRE><B>jala.Test.DatabaseMgr</B>()</PRE>
<UL>
Returns a newly created DatabaseMgr instance
</UL>
</UL>
<!-- Constructor return value(s) -->
<UL>
<B>Returns:</B>
<UL>
A newly created instance of DatabaseMgr
</UL>
</UL>
<!-- End constructor return value(s) -->
<!-- ADDITIONAL ATTRIBUTES -->
<HR/>
<!-- END ADDITIONAL ATTRIBUTES -->
<!-- ========= CONSTRUCTOR DETAIL END ======== -->
<!-- ============ METHOD DETAIL START ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT>
</TD>
</TR>
</TABLE>
<!-- One single method detail entry -->
<A NAME="startDatabase"><!-- --></A>
<H3>startDatabase</H3>
<PRE>jala.db.RamDatabase <B>startDatabase</B>(&lt;String&gt; dbSourceName, &lt;Boolean&gt; copyTables, &lt;Array&gt; tables)</PRE>
<UL>Switches the application datasource with the given name
to a newly created in-memory database. In addition this method
also clears the application cache and invalidates the root
object to ensure that everything is re-retrieved from the
test database.
This method can be called with a second boolean argument indicating
that tables used by the application should be created in the in-memory
database (excluding any data).</UL>
<!-- METHOD PARAMETERS START -->
<UL>
<B>Parameters:</B>
<UL><CODE>dbSourceName</CODE> - The name of the application database source as defined in db.properties
</UL>
<UL><CODE>copyTables</CODE> - If true this method also copies all tables in the source database to the test database (excluding indexes).
</UL>
<UL><CODE>tables</CODE> - An optional array containing table names that should be created in the test database. If not specified this method collects all tables that are mapped in the application.
</UL>
</UL>
<!-- METHOD PARAMETERS END -->
<UL>
<B>Returns:</B>
<UL>
The test database
</UL>
</UL>
<!-- ADDITIONAL ATTRIBUTES START -->
<!-- ADDITIONAL ATTRIBUTES END -->
<HR>
<A NAME="stopAll"><!-- --></A>
<H3>stopAll</H3>
<PRE>void <B>stopAll</B>()</PRE>
<UL>Stops all registered test databases and and reverts the application
to its original datasource(s) as defined in db.properties file.
In addition this method commits all pending changes within the request,
cleares the application cache and invalidates the root object
to ensure no traces of the test database are left behind.</UL>
<!-- METHOD PARAMETERS START -->
<!-- METHOD PARAMETERS END -->
<!-- ADDITIONAL ATTRIBUTES START -->
<!-- ADDITIONAL ATTRIBUTES END -->
<HR>
<A NAME="toString"><!-- --></A>
<H3>toString</H3>
<PRE>Object <B>toString</B>()</PRE>
<!-- METHOD PARAMETERS START -->
<!-- METHOD PARAMETERS END -->
<!-- ADDITIONAL ATTRIBUTES START -->
<!-- ADDITIONAL ATTRIBUTES END -->
<HR>
<!-- ============ METHOD DETAIL END ========== -->
<!-- ========= END OF CLASS DATA ========= -->
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary-Global_jala.Test.js.html"><FONT CLASS="NavBarFont1"><B>File</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><b>Tree</b></FONT></A>&nbsp;</TD>
<!--TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"--> <!--A HREF="deprecated-list.html"--><!--FONT CLASS="NavBarFont1">Deprecated</FONT--><!--/A--><!--&nbsp;</TD-->
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<B>Jala Test</B>
</EM>
</TD
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="jala.Test.ArgumentsException.html"><B>PREV CLASS</B></A><!--
NEXT CLASS
-->
&nbsp;<A HREF="jala.Test.EvaluatorException.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="jala.Test.DatabaseMgr.html" TARGET="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;
<SCRIPT>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<FONT SIZE="-1">
</FONT>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Tue Jan 8 15:50:17 2008</div>
</BODY>
</HTML>