Search in sources :

Example 26 with AfterMethod

use of org.testng.annotations.AfterMethod in project databus by linkedin.

the class TestEventLogWriter method tearDown.

@AfterMethod
public void tearDown() throws Exception {
    System.gc();
    assertTrue(_writeDir.isDirectory());
    for (File f : _writeDir.listFiles()) {
        if (f.isDirectory()) {
            for (File fil : f.listFiles()) {
                assertTrue(fil.delete());
            }
        }
        assertTrue(f.delete());
    }
    assertTrue(_writeDir.canWrite());
    assertTrue(_writeDir.delete());
}
Also used : File(java.io.File) AfterMethod(org.testng.annotations.AfterMethod)

Example 27 with AfterMethod

use of org.testng.annotations.AfterMethod in project orientdb by orientechnologies.

the class LinkSetIndexTest method afterMethod.

@AfterMethod
public void afterMethod() throws Exception {
    database.command(new OCommandSQL("DELETE FROM LinkSetIndexTestClass")).execute();
    List<ODocument> result = database.command(new OCommandSQL("select from LinkSetIndexTestClass")).execute();
    Assert.assertEquals(result.size(), 0);
    result = database.command(new OCommandSQL("select key, rid from index:linkSetIndex")).execute();
    Assert.assertEquals(result.size(), 0);
    database.close();
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) AfterMethod(org.testng.annotations.AfterMethod)

Example 28 with AfterMethod

use of org.testng.annotations.AfterMethod in project orientdb by orientechnologies.

the class OEmbeddedRidBagTest method afterMethod.

@AfterMethod
public void afterMethod() throws IOException {
    OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(topThreshold);
    OGlobalConfiguration.RID_BAG_SBTREEBONSAI_TO_EMBEDDED_THRESHOLD.setValue(bottomThreshold);
    if (database.getStorage() instanceof OStorageProxy) {
        OServerAdmin server = new OServerAdmin(database.getURL()).connect("root", ODatabaseHelper.getServerRootPassword());
        server.setGlobalConfiguration(OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD, topThreshold);
        server.setGlobalConfiguration(OGlobalConfiguration.RID_BAG_SBTREEBONSAI_TO_EMBEDDED_THRESHOLD, bottomThreshold);
        server.close();
    }
}
Also used : OStorageProxy(com.orientechnologies.orient.core.storage.OStorageProxy) OServerAdmin(com.orientechnologies.orient.client.remote.OServerAdmin) AfterMethod(org.testng.annotations.AfterMethod)

Example 29 with AfterMethod

use of org.testng.annotations.AfterMethod in project orientdb by orientechnologies.

the class OSBTreeRidBagTest method afterMethod.

@AfterMethod
public void afterMethod() throws IOException {
    OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(topThreshold);
    OGlobalConfiguration.RID_BAG_SBTREEBONSAI_TO_EMBEDDED_THRESHOLD.setValue(bottomThreshold);
    if (database.getStorage() instanceof OStorageProxy) {
        OServerAdmin server = new OServerAdmin(database.getURL()).connect("root", ODatabaseHelper.getServerRootPassword());
        server.setGlobalConfiguration(OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD, topThreshold);
        server.setGlobalConfiguration(OGlobalConfiguration.RID_BAG_SBTREEBONSAI_TO_EMBEDDED_THRESHOLD, bottomThreshold);
        server.close();
    }
}
Also used : OStorageProxy(com.orientechnologies.orient.core.storage.OStorageProxy) OServerAdmin(com.orientechnologies.orient.client.remote.OServerAdmin) AfterMethod(org.testng.annotations.AfterMethod)

Example 30 with AfterMethod

use of org.testng.annotations.AfterMethod in project elasticsearch-jdbc by jprante.

the class AbstractSinkTest 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;
    }
    logger.debug("cleaning...");
    // clean up tables
    Connection connection = source.getConnectionForWriting();
    if (connection == null) {
        throw new IOException("no connection");
    }
    sqlScript(connection, resourceName);
    // before dropping tables, open read connection must be closed to avoid hangs in mysql/postgresql
    logger.debug("closing reads...");
    source.closeReading();
    // 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
    }
    source.closeWriting();
    logger.info("stopped");
    // delete test index
    try {
        client("1").admin().indices().prepareDelete(index).execute().actionGet();
        logger.info("index {} deleted", index);
    } catch (Exception e) {
        logger.warn(e.getMessage());
    }
    stopNodes();
}
Also used : Connection(java.sql.Connection) IOException(java.io.IOException) SQLException(java.sql.SQLException) IOException(java.io.IOException) AfterMethod(org.testng.annotations.AfterMethod) Parameters(org.testng.annotations.Parameters)

Aggregations

AfterMethod (org.testng.annotations.AfterMethod)74 File (java.io.File)16 MifosPage (org.mifos.test.acceptance.framework.MifosPage)10 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)8 ProtocolStack (org.jgroups.stack.ProtocolStack)6 IOException (java.io.IOException)5 HashSet (java.util.HashSet)4 AtlasVertex (org.apache.atlas.repository.graphdb.AtlasVertex)4 Connection (java.sql.Connection)3 SQLException (java.sql.SQLException)3 MockParticipantManager (org.apache.helix.integration.manager.MockParticipantManager)3 JdbcSession (com.evolveum.midpoint.repo.sqlbase.JdbcSession)2 DispatchManager (com.facebook.presto.dispatcher.DispatchManager)2 OServerAdmin (com.orientechnologies.orient.client.remote.OServerAdmin)2 OStorageProxy (com.orientechnologies.orient.core.storage.OStorageProxy)2 RandomAccessFile (java.io.RandomAccessFile)2 Date (java.util.Date)2 ExecutorService (java.util.concurrent.ExecutorService)2 DeleteIndexRequest (org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest)2 Parameters (org.testng.annotations.Parameters)2