Java Code Examples for org.junit.After

The following examples show how to use org.junit.After. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Tomcat8-Source-Read   Source File: TomcatBaseTest.java    License: MIT License 6 votes vote down vote up
@After
@Override
public void tearDown() throws Exception {
    try {
        // Some tests may call tomcat.destroy(), some tests may just call
        // tomcat.stop(), some not call either method. Make sure that stop()
        // & destroy() are called as necessary.
        if (tomcat.server != null
                && tomcat.server.getState() != LifecycleState.DESTROYED) {
            if (tomcat.server.getState() != LifecycleState.STOPPED) {
                tomcat.stop();
            }
            tomcat.destroy();
        }
    } finally {
        super.tearDown();
    }
}
 
Example 2
Source Project: netty-4.1.22   Source File: DataCompressionHttp2Test.java    License: Apache License 2.0 6 votes vote down vote up
@After
public void teardown() throws InterruptedException {
    if (clientChannel != null) {
        clientChannel.close().sync();
        clientChannel = null;
    }
    if (serverChannel != null) {
        serverChannel.close().sync();
        serverChannel = null;
    }
    final Channel serverConnectedChannel = this.serverConnectedChannel;
    if (serverConnectedChannel != null) {
        serverConnectedChannel.close().sync();
        this.serverConnectedChannel = null;
    }
    Future<?> serverGroup = sb.config().group().shutdownGracefully(0, 0, MILLISECONDS);
    Future<?> serverChildGroup = sb.config().childGroup().shutdownGracefully(0, 0, MILLISECONDS);
    Future<?> clientGroup = cb.config().group().shutdownGracefully(0, 0, MILLISECONDS);
    serverGroup.sync();
    serverChildGroup.sync();
    clientGroup.sync();
}
 
Example 3
Source Project: Flink-CEPplus   Source File: HashVsSortMiniBenchmark.java    License: Apache License 2.0 6 votes vote down vote up
@After
public void afterTest() {
	if (this.memoryManager != null) {
		Assert.assertTrue("Memory Leak: Not all memory has been returned to the memory manager.",
			this.memoryManager.verifyEmpty());
		this.memoryManager.shutdown();
		this.memoryManager = null;
	}
	
	if (this.ioManager != null) {
		this.ioManager.shutdown();
		if (!this.ioManager.isProperlyShutDown()) {
			Assert.fail("I/O manager failed to properly shut down.");
		}
		this.ioManager = null;
	}
}
 
Example 4
Source Project: hadoop-ozone   Source File: TestSecureOzoneManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Shutdown MiniDFSCluster.
 */
@After
public void shutdown() {
  if (cluster != null) {
    cluster.shutdown();
  }
  FileUtils.deleteQuietly(metaDir.toFile());
}
 
Example 5
@After
public void after() {
    System.clearProperty("noBuild");
    System.clearProperty("isDeveloperMode");
    System.clearProperty("spark.local");
    super.after();
}
 
Example 6
Source Project: sofa-jraft   Source File: RouteTableTest.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void teardown() throws Exception {
    cliClientService.shutdown();
    cluster.stopAll();
    if (NodeImpl.GLOBAL_NUM_NODES.get() > 0) {
        Thread.sleep(1000);
        assertEquals(NodeImpl.GLOBAL_NUM_NODES.get(), 0);
    }
    FileUtils.deleteDirectory(new File(this.dataPath));
    NodeManager.getInstance().clear();
    RouteTable.getInstance().reset();
}
 
Example 7
Source Project: arcusplatform   Source File: TestAddPlaceHandler.java    License: Apache License 2.0 5 votes vote down vote up
@After
@Override
public void tearDown() throws Exception
{
   super.tearDown();

   verify();

   reset();
}
 
Example 8
@After
@Override
public void shutdownBlobServer() throws IOException {
	if (blobServer != null) {
		blobServer.close();
	}
}
 
Example 9
@After
public final void afterTest() throws Exception {
  completeStrayTransaction();

  if ( isCleanupTestDataRequired() ) {
    cleanupTestData();
  }
  cleanupTest();

  cleanupSession();

  assertAllDataRemoved();

}
 
Example 10
@After
public void tearDown()
        throws Exception
{
    allocator.close();
    logger.info("{}: exit ", testName.getMethodName());
}
 
Example 11
Source Project: hop   Source File: ReadAllCacheTest.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void tearDown() {
  transformData = null;
  keysMeta = null;
  keys = null;
  data = null;
}
 
Example 12
Source Project: grpc-nebula-java   Source File: TlsTest.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void tearDown() {
  if (server != null) {
    server.shutdown();
  }
  if (channel != null) {
    channel.shutdown();
  }
  MoreExecutors.shutdownAndAwaitTermination(executor, 5, TimeUnit.SECONDS);
}
 
Example 13
Source Project: flink   Source File: JDBCFullTest.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void clearOutputTable() throws Exception {
	Class.forName(DRIVER_CLASS);
	try (
		Connection conn = DriverManager.getConnection(DB_URL);
		Statement stat = conn.createStatement()) {
		stat.execute("DELETE FROM " + OUTPUT_TABLE);

		stat.close();
		conn.close();
	}
}
 
Example 14
Source Project: gcp-token-broker   Source File: CloudDatastoreCacheTest.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void teardown() {
    // Delete all records
    Datastore datastore = getService();
    Query<Entity> query = Query.newEntityQueryBuilder().setKind(CACHE_KIND).build();
    QueryResults<Entity> entities = datastore.run(query);
    while (entities.hasNext()) {
        Entity entity = entities.next();
        datastore.delete(entity.getKey());
    }
}
 
Example 15
Source Project: flink   Source File: ResourceManagerTaskExecutorTest.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void teardown() throws Exception {
	if (resourceManager != null) {
		RpcUtils.terminateRpcEndpoint(resourceManager, TIMEOUT);
	}

	if (testingFatalErrorHandler != null && testingFatalErrorHandler.hasExceptionOccurred()) {
		testingFatalErrorHandler.rethrowError();
	}
}
 
Example 16
Source Project: submarine   Source File: SysUserServiceTest.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void removeAllRecord() throws Exception {
  SysUserService userService = new SysUserService();

  List<SysUser> userList = userService.queryPageList("", null, null, null, null, 0, 10);
  assertTrue(userList.size() > 0);
  for (SysUser user : userList) {
    userService.delete(user.getId());
  }
}
 
Example 17
@After
public void destroyHDFS() {
	try {
		if (baseDir != null) {
			FileUtil.fullyDelete(baseDir);
		}
	} catch (Throwable t) {
		throw new RuntimeException(t);
	}
}
 
Example 18
Source Project: singer   Source File: TestPodLogCycle.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void after() {
    LogStreamManager.getInstance().getSingerLogPaths().clear();
    SingerSettings.getFsMonitorMap().clear();
    delete(new File(podLogPath));
    LogStreamManager.reset();
    KubeService.reset();
    SingerSettings.reset();
}
 
Example 19
@After
public void cleanDb(TestContext context) {
	test( context, openSession()
			.thenCompose( s -> s.remove( spelt ) )
			.thenCompose( s -> s.remove( rye ) )
			.thenCompose( s -> s.remove( almond ) )
			.thenCompose( s -> s.flush() ) );
}
 
Example 20
Source Project: Flink-CEPplus   Source File: NormalizedKeySorterTest.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void afterTest() {
	if (!this.memoryManager.verifyEmpty()) {
		Assert.fail("Memory Leak: Some memory has not been returned to the memory manager.");
	}
	
	if (this.memoryManager != null) {
		this.memoryManager.shutdown();
		this.memoryManager = null;
	}
}
 
Example 21
Source Project: ghidra   Source File: AbstractDockingTest.java    License: Apache License 2.0 5 votes vote down vote up
@After
// named differently than tearDown(), so subclasses do not override it
public void dockingTearDown() {
	// Disable error reporting from non-test threads found during tearDown().  The idea is
	// that odd issue find while coming down are not important, as they are usually
	// timing issues.

	// Note: this doesn't quite work as intended.  This should be run before each other
	//       tearDown() method, but junit offers no way to do that.   If you can figure 
	//       out how to make that work, then update this code.
	ConcurrentTestExceptionHandler.disable();
}
 
Example 22
Source Project: hadoop-ozone   Source File: TestOzoneContainer.java    License: Apache License 2.0 5 votes vote down vote up
@After
public void cleanUp() throws Exception {
  if (volumeSet != null) {
    volumeSet.shutdown();
    volumeSet = null;
  }
}
 
Example 23
@After
public void clearResource() {
    RedisCommands<String, String> stringRedisCommands = client.connect().sync();
    stringRedisCommands.del(ruleKey);
    client.shutdown();
    server.stop();
    server = null;
}
 
Example 24
Source Project: flink   Source File: AbstractRecoverableWriterTest.java    License: Apache License 2.0 4 votes vote down vote up
@After
public void cleanup() throws Exception {
	getFileSystem().delete(basePathForTest, true);
}
 
Example 25
Source Project: staffjoy   Source File: TeamControllerTest.java    License: MIT License 4 votes vote down vote up
@After
public void destroy() {
    teamRepo.deleteAll();
}
 
Example 26
Source Project: rocketmq-4.3.0   Source File: NormalMsgStaticBalanceIT.java    License: Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() {
    super.shutdown();
}
 
Example 27
Source Project: sofa-jraft   Source File: BaseLogStorageTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
@After
public void teardown() throws Exception {
    this.logStorage.shutdown();
    super.teardown();
}
 
Example 28
Source Project: java-technology-stack   Source File: RequestContextHolderTests.java    License: MIT License 4 votes vote down vote up
@After
public void verifyRestoredRequestAttributes() {
	assertRequestAttributes(false);
}
 
Example 29
Source Project: grpc-nebula-java   Source File: URLTest.java    License: Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() throws Exception {
}
 
Example 30
Source Project: hadoop-ozone   Source File: TestDBConfigFromFile.java    License: Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() throws Exception {
}