use of org.testng.annotations.AfterMethod in project elasticsearch-jdbc by jprante.
the class AbstractSourceTest method afterMethod.
@AfterMethod
@Parameters({ "stopurl", "user", "password", "delete" })
public void afterMethod(String stopurl, String user, String password, @Optional String resourceName) throws Exception {
logger.info("remove table {}", resourceName);
if (resourceName == null || "".equals(resourceName)) {
return;
}
// before dropping tables, open read connection must be closed to avoid hangs in mysql/postgresql
logger.debug("closing reads...");
source.closeReading();
logger.debug("connecting for close...");
Connection connection = source.getConnectionForWriting();
if (connection == null) {
throw new IOException("no connection");
}
logger.debug("cleaning...");
// clean up tables
sqlScript(connection, resourceName);
logger.debug("closing writes...");
source.closeWriting();
// we can drop database by a magic 'stop' URL
source = newSource().setUrl(stopurl).setUser(user).setPassword(password).setLocale(Locale.getDefault()).setTimeZone(TimeZone.getDefault());
try {
logger.info("connecting to stop URL...");
// activate stop URL
source.getConnectionForWriting();
} catch (Exception e) {
// exception is expected, ignore
}
// close open write connection
source.closeWriting();
}
use of org.testng.annotations.AfterMethod in project rest.li by linkedin.
the class TestD2Config method teardown.
@AfterMethod
public void teardown() throws IOException, InterruptedException {
for (LoadBalancerEchoServer echoServer : _echoServerList) {
try {
echoServer.stopServer();
_log.info("Executed echoserver shutdown. ");
} catch (Exception e) {
_log.info("echoserver shutdown failed. EchoServer:" + echoServer);
e.printStackTrace();
}
}
try {
_zkclient.shutdown();
_log.info("Executed cli shutdown. ");
} catch (Exception e) {
_log.info("zkclient shutdown failed.");
}
try {
_zkServer.shutdown();
_log.info("Executed zkServer shutdown. ");
} catch (Exception e) {
_log.info("zk server shutdown failed.");
}
}
use of org.testng.annotations.AfterMethod in project incubator-atlas by apache.
the class AbstractGraphDatabaseTest method removeVertices.
@AfterMethod
public void removeVertices() {
for (AtlasVertex vertex : newVertices) {
if (vertex.exists()) {
getGraph().removeVertex(vertex);
}
}
getGraph().commit();
newVertices.clear();
}
use of org.testng.annotations.AfterMethod in project midpoint by Evolveum.
the class AbstractIntegrationTest method finishTestContext.
/**
* Finish and destroy the test context, output duration and store the operation trace.
* This implementation fully overrides (without use) the one from {@link AbstractSpringTest}.
*/
@Override
@AfterMethod
public void finishTestContext(ITestResult testResult) {
MidpointTestContextWithTask context = MidpointTestContextWithTask.get();
displayTestFooter(context.getTestName(), testResult);
// let's destroy it before anything else in this method
MidpointTestContextWithTask.destroy();
Task task = context.getTask();
if (task != null) {
OperationResult result = context.getResult();
if (result != null) {
result.computeStatusIfUnknown();
if (result.isTraced()) {
display("Storing the trace.");
tracer.storeTrace(task, result, null);
}
task.getResult().computeStatusIfUnknown();
}
}
}
use of org.testng.annotations.AfterMethod in project rest.li by linkedin.
the class TestRestLiFilterChain method resetMocks.
@AfterMethod
protected void resetMocks() {
reset(_mockFilterChainDispatcher, _mockFilterChainCallback, _mockFilterRequestContext, _mockFilterResponseContext, _mockRestLiRequestData, _mockRestLiResponseData);
_filters = new CountFilter[] { new CountFilter(), new CountFilter(), new CountFilter() };
}
Aggregations