public class DerbyServer extends org.junit.rules.ExternalResource implements Closeable
TestRule which starts an apache NetworkServerControl.
public class UsingDerbyTestCase {
@ClassRule
public static final DerbyServer database = new DerbyServer(dbPort);
@Test
public void useDatabase() {
// Here Database is up and running
// You can get the connection URL:
String url = database.getUri(name);
}
@Test
public void reconnectionTestCase() {
// You can stop and start again the database:
database.stop();
database.start();
}
}
| Constructor and Description |
|---|
DerbyServer(int port) |
| Modifier and Type | Method and Description |
|---|---|
void |
after() |
void |
before() |
void |
close() |
String |
getDriverClass() |
String |
getUri(String name) |
boolean |
isRunning() |
DerbyServer |
start() |
void |
stop() |
public String getDriverClass()
public void before()
before in class org.junit.rules.ExternalResourcepublic void after()
after in class org.junit.rules.ExternalResourcepublic DerbyServer start()
public boolean isRunning()
public void stop()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.