|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.test.OnlineTestSupport
public abstract class OnlineTestSupport
JUnit 4 test support for test cases that require an "online" resource, such as an external server or database.
See OnlineTestCase
for details of behaviour and test fixture configuration.
Subclass names should end with "OnlineTest" to allow Maven to treat them specially.
This class contains an adapter to OnlineTestCase
that allows its use with JUnit 4.
Delegation is used to recycle the behaviour of OnlineTestCase
without extending
TestCase
. This is necessary because TestRunner
s appear to give priority to JUnit
3 behaviour, ignoring JUnit 4 annotations in suites that extend TestCase
.
OnlineTestCase
Constructor Summary | |
---|---|
OnlineTestSupport()
|
Method Summary | |
---|---|
void |
after()
|
void |
before()
|
protected void |
connect()
Override this method to connect to an online resource. |
protected java.util.Properties |
createExampleFixture()
Allows test to create a sample fixture for users. |
protected java.util.Properties |
createOfflineFixture()
Allows tests to create an offline fixture in cases where the user has not specified an explicit fixture for the test. |
protected void |
disconnect()
Override this method to disconnect from an online resource. |
protected java.util.Properties |
getFixture()
Return properties configured in the fixture. |
protected abstract java.lang.String |
getFixtureId()
Subclasses must override this method to return a fixture id. |
protected boolean |
isOnline()
Override this method to return false if you can detect that an online resource required for this test is not available, |
protected void |
setUpInternal()
Method for subclasses to latch onto the setup phase. |
protected void |
tearDownInternal()
Method for subclasses to latch onto the teardown phase. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OnlineTestSupport()
Method Detail |
---|
public void before() throws java.lang.Exception
java.lang.Exception
public void after() throws java.lang.Exception
java.lang.Exception
protected abstract java.lang.String getFixtureId()
OnlineTestCase.getFixtureId()
protected void connect() throws java.lang.Exception
Subclasses do not have to override this method, but doing so allows builders to choose to have this test disable itself when the online resource is not available.
java.lang.Exception
OnlineTestCase.connect()
protected void disconnect() throws java.lang.Exception
java.lang.Exception
OnlineTestCase.disconnect()
protected boolean isOnline() throws java.lang.Exception
java.lang.Exception
OnlineTestCase.isOnline()
protected void setUpInternal() throws java.lang.Exception
java.lang.Exception
OnlineTestCase.setUpInternal()
protected void tearDownInternal() throws java.lang.Exception
java.lang.Exception
OnlineTestCase.tearDownInternal()
protected java.util.Properties createOfflineFixture()
Note, that this should method should on be implemented if the test case is created of creating a fixture which relies solely on embedded or offline resources. It should not reference any external or online resources as it prevents the user from running offline.
OnlineTestCase.createOfflineFixture()
protected java.util.Properties createExampleFixture()
If this method returns a value the first time a fixture is looked up and not found this method will be called to create a fixture file with the same id, but suffixed with .template.
OnlineTestCase.createExampleFixture()
protected java.util.Properties getFixture()
This method allows subclasses in other packages to access fixture properties.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |