org.junit.After Java Examples

The following examples show how to use org.junit.After. 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 File: HashVsSortMiniBenchmark.java    From Flink-CEPplus with 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 #2
Source File: DataCompressionHttp2Test.java    From netty-4.1.22 with 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 File: TomcatBaseTest.java    From Tomcat8-Source-Read with 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 #4
Source File: RouteTableTest.java    From sofa-jraft with 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 #5
Source File: TestSecureOzoneManager.java    From hadoop-ozone with 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 #6
Source File: TestOzoneContainer.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
@After
public void cleanUp() throws Exception {
  if (volumeSet != null) {
    volumeSet.shutdown();
    volumeSet = null;
  }
}
 
Example #7
Source File: NManualBuildAndQueryCuboidTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@After
public void after() {
    System.clearProperty("noBuild");
    System.clearProperty("isDeveloperMode");
    System.clearProperty("spark.local");
    super.after();
}
 
Example #8
Source File: AbstractDockingTest.java    From ghidra with 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 #9
Source File: NormalizedKeySorterTest.java    From Flink-CEPplus with 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 #10
Source File: StandaloneRedisDataSourceTest.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 5 votes vote down vote up
@After
public void clearResource() {
    RedisCommands<String, String> stringRedisCommands = client.connect().sync();
    stringRedisCommands.del(ruleKey);
    client.shutdown();
    server.stop();
    server = null;
}
 
Example #11
Source File: HQLQueryTest.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
@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 #12
Source File: ContinuousFileProcessingCheckpointITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@After
public void destroyHDFS() {
	try {
		if (baseDir != null) {
			FileUtil.fullyDelete(baseDir);
		}
	} catch (Throwable t) {
		throw new RuntimeException(t);
	}
}
 
Example #13
Source File: TestPodLogCycle.java    From singer with 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 #14
Source File: SysUserServiceTest.java    From submarine with 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 #15
Source File: JDBCFullTest.java    From flink with 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 #16
Source File: CloudDatastoreCacheTest.java    From gcp-token-broker with 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 #17
Source File: ResourceManagerTaskExecutorTest.java    From flink with 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 #18
Source File: TlsTest.java    From grpc-nebula-java with 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 #19
Source File: ReadAllCacheTest.java    From hop with Apache License 2.0 5 votes vote down vote up
@After
public void tearDown() {
  transformData = null;
  keysMeta = null;
  keys = null;
  data = null;
}
 
Example #20
Source File: DocDBMetadataHandlerTest.java    From aws-athena-query-federation with Apache License 2.0 5 votes vote down vote up
@After
public void tearDown()
        throws Exception
{
    allocator.close();
    logger.info("{}: exit ", testName.getMethodName());
}
 
Example #21
Source File: BaseCoreFunctionalTestCase.java    From google-cloud-spanner-hibernate with GNU Lesser General Public License v2.1 5 votes vote down vote up
@After
public final void afterTest() throws Exception {
  completeStrayTransaction();

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

  cleanupSession();

  assertAllDataRemoved();

}
 
Example #22
Source File: ExecutionGraphDeploymentWithBlobCacheTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@After
@Override
public void shutdownBlobServer() throws IOException {
	if (blobServer != null) {
		blobServer.close();
	}
}
 
Example #23
Source File: TestAddPlaceHandler.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@After
@Override
public void tearDown() throws Exception
{
   super.tearDown();

   verify();

   reset();
}
 
Example #24
Source File: TestDataHolder.java    From customized-symspell with MIT License 4 votes vote down vote up
@After
public void clear() throws SpellCheckException {
  dataHolder.clear();
}
 
Example #25
Source File: RequestHeaderMethodArgumentResolverTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@After
public void reset() {
	RequestContextHolder.resetRequestAttributes();
}
 
Example #26
Source File: TestSceneCatalog.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() {
}
 
Example #27
Source File: LocalizerTest.java    From submarine with Apache License 2.0 4 votes vote down vote up
@After
public void teardown() throws IOException {
  fileUtils.teardown();
}
 
Example #28
Source File: SelectValuesTest.java    From hop with Apache License 2.0 4 votes vote down vote up
@After
public void cleanUp() {
  helper.cleanUp();
}
 
Example #29
Source File: BufferedKVExternalSorterTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@After
public void afterTest() throws Exception {
	this.ioManager.close();
}
 
Example #30
Source File: MailServiceTest.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@After
public void after() throws Exception {
    this.cleanupTestMetadata();
}