Search in sources :

Example 26 with AfterClass

use of org.junit.AfterClass in project randomizedtesting by randomizedtesting.

the class WithNestedTestClass method clearNested.

@AfterClass
public static final void clearNested() throws Exception {
    zombieToken = null;
    runningNested = false;
    ApplyAtPlace.runnable = null;
    ApplyAtPlace.place = null;
    System.setOut(sysout);
    System.setErr(syserr);
    for (Handler h : logger.getHandlers()) logger.removeHandler(h);
    for (Handler h : handlers) logger.addHandler(h);
    for (Thread t : zombies) {
        t.interrupt();
    }
    for (Thread t : zombies) {
        t.join();
    }
}
Also used : Handler(java.util.logging.Handler) AfterClass(org.junit.AfterClass)

Example 27 with AfterClass

use of org.junit.AfterClass in project DirectMemory by raffaeleguidi.

the class BaseTests method setup.

@BeforeClass
@AfterClass
public static void setup() {
    rnd = new Random();
    //		logger.info("off-heap allocated: " + Ram.inMb(mem.capacity()));
    //		logger.info("off-heap used:      " + Ram.inMb(mem.used()));
    logger.info("test - size: " + test.size());
    logger.info("test - errors: " + errors);
    logger.info("heap - max: " + Ram.inMb(Runtime.getRuntime().maxMemory()));
    logger.info("heap - allocated: " + Ram.inMb(Runtime.getRuntime().totalMemory()));
    logger.info("heap - free : " + Ram.inMb(Runtime.getRuntime().freeMemory()));
    logger.info("************************************************");
}
Also used : Random(java.util.Random) BeforeClass(org.junit.BeforeClass) AfterClass(org.junit.AfterClass)

Example 28 with AfterClass

use of org.junit.AfterClass in project camel by apache.

the class BaseNettyTest method savePort.

@AfterClass
public static void savePort() throws Exception {
    File file = new File("target/nettyport.txt");
    // save to file, do not append
    FileOutputStream fos = new FileOutputStream(file, false);
    try {
        fos.write(String.valueOf(port).getBytes());
    } finally {
        fos.close();
    }
}
Also used : FileOutputStream(java.io.FileOutputStream) File(java.io.File) AfterClass(org.junit.AfterClass)

Example 29 with AfterClass

use of org.junit.AfterClass in project camel by apache.

the class BaseNettyTest method verifyNoLeaks.

@AfterClass
public static void verifyNoLeaks() throws Exception {
    //Force GC to bring up leaks
    System.gc();
    //Kick leak detection logging
    ByteBufAllocator.DEFAULT.buffer(1).release();
    Collection<LogEvent> events = LogCaptureAppender.getEvents();
    if (!events.isEmpty()) {
        String message = "Leaks detected while running tests: " + events;
        // Just write the message into log to help debug
        for (LogEvent event : events) {
            LOG.info(event.getMessage().getFormattedMessage());
        }
        LogCaptureAppender.reset();
        throw new AssertionError(message);
    }
}
Also used : LogEvent(org.apache.logging.log4j.core.LogEvent) AfterClass(org.junit.AfterClass)

Example 30 with AfterClass

use of org.junit.AfterClass in project graphhopper by graphhopper.

the class ChangeGraphServletIT method cleanUp.

@AfterClass
public static void cleanUp() {
    Helper.removeDir(new File(DIR));
    shutdownJetty(true);
}
Also used : File(java.io.File) AfterClass(org.junit.AfterClass)

Aggregations

AfterClass (org.junit.AfterClass)202 File (java.io.File)76 DalHints (com.ctrip.platform.dal.dao.DalHints)23 Path (org.apache.hadoop.fs.Path)14 FileSystem (org.apache.hadoop.fs.FileSystem)13 HashMap (java.util.HashMap)12 IOException (java.io.IOException)10 ModelNode (org.jboss.dmr.ModelNode)8 StatementParameters (com.ctrip.platform.dal.dao.StatementParameters)7 ScenarioConfiguration (org.apache.hadoop.mapred.nativetask.testutil.ScenarioConfiguration)7 FileOutputStream (java.io.FileOutputStream)6 RelationManager (edu.uci.ics.textdb.storage.RelationManager)5 ClientException (edu.umass.cs.gnscommon.exceptions.client.ClientException)5 Configuration (org.apache.hadoop.conf.Configuration)5 HttpSolrClient (org.apache.solr.client.solrj.impl.HttpSolrClient)5 Method (java.lang.reflect.Method)4 SQLException (java.sql.SQLException)4 Statement (java.sql.Statement)4 LoggerContext (org.apache.logging.log4j.core.LoggerContext)4 GuidEntry (edu.umass.cs.gnsclient.client.util.GuidEntry)3