|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.hyperic.util.unittest.server.BaseServerTestCase
public abstract class BaseServerTestCase
The test case that all server-side unit tests should extend. Before starting
the server, the user must set the hq.unittest.jboss.home
system
property to the path where the jboss server that will be used for unit testing
resides. That jboss instance must contain a "unittest" configuration created
with the unittest-prepare-jboss
Ant target. The datasource file
(hq-ds.xml
) in the "unittest" configuration must point to the
*preexisting* unit testing server database.
In addition, the hq.unittest.hq.home
system property must be set
to the local path where the HQ src resides (.ORG or EE versions depending
on the type of unit test). The hq.unittest.working.dir
system
property must be set to the directory where the database dump file containing
the initial server state resides (by default in $HQ_HOME/unittest/data).
Finally (and most importantly), the system classloader must be
set to the IsolatingDefaultSystemClassLoader
.
Field Summary | |
---|---|
static java.lang.String |
HQ_HOME_DIR
The system property specifying the path to the HQ home directory. |
static java.lang.String |
JBOSS_HOME_DIR
The system property specifying the path to the jboss deployment that will be used for unit testing. |
static java.lang.String |
JBOSS_UNIT_TEST_CONFIGURATION
The "unittest" configuration that the jboss deployment must have installed and prepared using the Ant "prepare-jboss" target. |
Constructor Summary | |
---|---|
BaseServerTestCase(java.lang.String name,
boolean restoreDatabase)
Creates an instance. |
Method Summary | |
---|---|
protected void |
deleteSchemaData(java.util.List filenames)
Used to delete data specified by the schema from the unit test database. |
protected void |
deleteSchemaData(java.lang.String filename)
Used to delete data specified by the schema from the unit test database. |
protected LocalInterfaceRegistry |
deployHQ()
Deploy the HQ application into the jboss server, starting the jboss server first if necessary. |
protected java.sql.Connection |
getConnectionToHQDatabase()
Retrieve a connection to the unit test database. |
protected void |
insertSchemaData(java.util.List filenames)
Used to insert new data into the unit test database. |
protected void |
insertSchemaData(java.lang.String filename)
Used to insert new data into the unit test database. |
protected void |
restoreDatabase()
Restore the unit test database to the original state specified by the test-dbsetup Ant target. |
void |
setUp()
Creates the initial unit test database dump file if it doesn't exist already. |
protected void |
startServer()
Start the jboss server with the "unittest" configuration. |
protected void |
stopServer()
Stop the jboss server. |
void |
tearDown()
Delegates to the super class. |
protected void |
undeployHQ()
Undeploy the HQ or HQEE application from the jboss server. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String JBOSS_HOME_DIR
public static final java.lang.String HQ_HOME_DIR
public static final java.lang.String JBOSS_UNIT_TEST_CONFIGURATION
Constructor Detail |
---|
public BaseServerTestCase(java.lang.String name, boolean restoreDatabase)
name
- The test case name.restoreDatabase
- true
to restore the database before
the first unit test in this test case;
false
to not restore the database.restoreDatabase()
Method Detail |
---|
public void setUp() throws java.lang.Exception
restoreDatabase
.
Subclasses should never override this method, only extend it if necessary.
setUp
in class junit.framework.TestCase
java.lang.Exception
public void tearDown() throws java.lang.Exception
tearDown
in class junit.framework.TestCase
java.lang.Exception
TestCase.tearDown()
protected final java.sql.Connection getConnectionToHQDatabase() throws UnitTestDBException
UnitTestDBException
protected final void restoreDatabase() throws UnitTestDBException
test-dbsetup
Ant target.
UnitTestDBException
protected final void insertSchemaData(java.lang.String filename) throws UnitTestDBException
schema
- filename to extract XML data from.
UnitTestDBException
protected final void insertSchemaData(java.util.List filenames) throws UnitTestDBException
List
- of schema filenames to extract XML data from.
UnitTestDBException
protected final void deleteSchemaData(java.util.List filenames) throws UnitTestDBException
List
- of schema filenames to extract XML data from.
UnitTestDBException
protected final void deleteSchemaData(java.lang.String filename) throws UnitTestDBException
schema
- filename to extract XML data from.
UnitTestDBException
protected final void startServer() throws java.lang.Exception
java.lang.Exception
protected final LocalInterfaceRegistry deployHQ() throws java.lang.Exception
java.lang.Exception
protected final void undeployHQ() throws java.lang.Exception
java.lang.Exception
protected final void stopServer()
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |