Java Code Examples for org.junit.jupiter.api.AfterEach

The following examples show how to use org.junit.jupiter.api.AfterEach. 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
@AfterEach
public void tearDown() {
    DeleteStreamResult result = awsKinesisClient.deleteStream(AWSCommon.DEFAULT_KINESIS_STREAM);

    if (result.getSdkHttpMetadata().getHttpStatusCode() != 200) {
        fail("Failed to delete the stream");
    } else {
        try {
            // Because of the latency used to simulate the Kinesis API call (defined by the KINESIS_LATENCY) in
            // the LocalStack configuration, the test needs to wait at least the same amount of time as set there
            // in order to proceed. Otherwise the it fails to create the stream in the setUp phase.
            // Ref.: https://github.com/localstack/localstack/issues/231#issuecomment-319959693
            Thread.sleep(500);
            LOG.info("Stream deleted successfully");
        } catch (InterruptedException e) {
            fail("Test interrupted while waiting for the stream to cool down");
        }
    }

    awsKinesisClient.shutdown();

    deleteKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()));
}
 
Example 2
Source Project: incubator-tuweni   Source File: ServerWhitelistTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
void stopServer() throws Exception {
  httpServer.close();

  List<String> knownClients = Files.readAllLines(knownClientsFile);
  assertEquals(2, knownClients.size());
  assertEquals("#First line", knownClients.get(0));
  assertEquals("foo.com " + fooFingerprint, knownClients.get(1));
}
 
Example 3
Source Project: kogito-runtimes   Source File: SimpleBatchExecutionTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
public void disposeKSession() throws Exception {
    if( ksession != null ) { 
        ksession.dispose();
        ksession = null;
    }
}
 
Example 4
Source Project: kogito-runtimes   Source File: KubeClientConfigTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
public void teardown() throws IOException {
    if (Files.exists(KUBE_CONFIG_PATH) && Files.readAllBytes(KUBE_CONFIG_PATH).length == 0) {
        Files.delete(KUBE_CONFIG_PATH);
        Files.delete(KUBE_CONFIG_DIR);
    }
    System.clearProperty("kubernetes.master");
}
 
Example 5
Source Project: incubator-tuweni   Source File: ClientWhitelistTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
void cleanupClient() throws Exception {
  client.close();

  List<String> knownServers = Files.readAllLines(knownServersFile);
  assertEquals(2, knownServers.size(), "Host was verified via TOFU and not CA");
  assertEquals("#First line", knownServers.get(0));
  assertEquals("localhost:" + fooServer.actualPort() + " " + fooFingerprint, knownServers.get(1));
}
 
Example 6
Source Project: incubator-tuweni   Source File: ClientCaOrWhitelistTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
void cleanupClient() throws Exception {
  client.close();

  List<String> knownServers = Files.readAllLines(knownServersFile);
  assertEquals(2, knownServers.size(), "Host was verified via TOFU and not CA");
  assertEquals("#First line", knownServers.get(0));
  assertEquals("localhost:" + fooServer.actualPort() + " " + fooFingerprint, knownServers.get(1));
}
 
Example 7
Source Project: ethsigner   Source File: ReadTimeoutAcceptanceTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
public synchronized void tearDown() {
  if (ethSigner != null) {
    ethSigner.shutdown();
  }

  close(unresponsiveSocketA);
  close(unresponsiveSocketB);
}
 
Example 8
@AfterEach
void cleanup() {
  if (ethSigner != null) {
    ethSigner.shutdown();
    ethSigner = null;
  }
}
 
Example 9
Source Project: ethsigner   Source File: ClientSideTlsAcceptanceTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
void cleanup() {
  serverFactory.shutdown();
  if (signer != null) {
    signer.shutdown();
    signer = null;
  }
}
 
Example 10
Source Project: ethsigner   Source File: ServerSideTlsAcceptanceTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
void cleanup() {
  if (ethSigner != null) {
    ethSigner.shutdown();
    ethSigner = null;
  }
}
 
Example 11
Source Project: ethsigner   Source File: MultiKeyAcceptanceTestBase.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
public void cleanUp() {
  if (ethSigner != null) {
    ethSigner.shutdown();
    ethSigner = null;
  }
}
 
Example 12
Source Project: ethsigner   Source File: CorsAcceptanceTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
public void tearDown() {
  if (ethNode != null) {
    ethNode.shutdown();
  }

  if (ethSigner != null) {
    ethSigner.shutdown();
  }
}
 
Example 13
Source Project: kogito-runtimes   Source File: DynamicEvalTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
public void tearDown() {
    if (session != null) {
        session.dispose();
    }
    kbase = null;
    effects = null;
    clock = null;
    kbuilder = null;
    baseConfig = null;
    sessionConfig = null;
}
 
Example 14
Source Project: apicurio-registry   Source File: RegistryMojoTestBase.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
public void cleanupTempDirectory() {
    for (File tempFile : this.tempDirectory.listFiles()) {
        tempFile.delete();
    }
    this.tempDirectory.delete();
}
 
Example 15
Source Project: apicurio-registry   Source File: RulesResourceIT.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
void clearRules(RegistryService service) throws Exception {
    service.deleteAllGlobalRules();
    TestUtils.retry(() -> {
        List<RuleType> rules = service.listGlobalRules();
        assertEquals(0, rules.size(), "All global rules not deleted");
    });
}
 
Example 16
Source Project: apicurio-registry   Source File: AllArtifactTypesIT.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
void deleteRules(RegistryService service) throws Exception {
    service.deleteAllGlobalRules();
    TestUtils.retry(() -> {
        List<RuleType> rules = service.listGlobalRules();
        assertEquals(0, rules.size(), "All global rules not deleted");
    });
}
 
Example 17
Source Project: apicurio-registry   Source File: ArtifactsIT.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
void deleteRules(RegistryService service) throws Exception {
    service.deleteAllGlobalRules();
    TestUtils.retry(() -> {
        List<RuleType> rules = service.listGlobalRules();
        assertEquals(0, rules.size(), "All global rules not deleted");
    });
}
 
Example 18
Source Project: cloud-spanner-r2dbc   Source File: SpannerTestKit.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@AfterEach
public void dropTable() {
  getJdbcOperations().execute("DELETE FROM test WHERE 1=1");
  getJdbcOperations().execute("DELETE FROM test_two_column WHERE 1=1");
  getJdbcOperations().execute("DELETE FROM blob_test WHERE 1=1");
  getJdbcOperations().execute("DELETE FROM clob_test WHERE 1=1");
}
 
Example 19
@AfterEach
public void tearDown() {
    deleteKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()));
    if (!awssqsClient.deleteQueue(queueName)) {
        fail("Failed to delete queue");
    }
}
 
Example 20
@AfterEach
public void tearDown() {
    deleteKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()));

    if (!awssqsClient.deleteQueue(queueName)) {
        fail("Failed to delete queue");
    }
}
 
Example 21
@AfterEach
public void tearDown() throws IOException, InterruptedException {
    SfdxCommand sfdxCommand = SfdxCommand.forceDataRecordDelete()
            .withArgument("--sobjecttype", "Account")
            .withArgument("--where", String.format("Name=%s", account));

    LOG.debug("Deleting the test account");
    ExecResult result = container.execCommand(sfdxCommand);
    if (!verifyCommand(sfdxCommand, result)) {
        fail("Unable to delete the test account on Salesforce");
    }
    account = null;

    deleteKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()));
}
 
Example 22
@AfterEach
public void tearDown() {
    cassandraClient = cassandraService.getClient();

    if (testDataDao != null) {
        testDataDao.dropTable();
    }

    deleteKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()));
}
 
Example 23
Source Project: vividus   Source File: SystemStreamTests.java    License: Apache License 2.0 5 votes vote down vote up
@After
@AfterEach
public void after()
{
    out.reset();
    err.reset();
}
 
Example 24
Source Project: kogito-runtimes   Source File: ListenersTest.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
public void cleanup() {
    if (this.kieSession != null) {
        this.kieSession.dispose();
    }
    this.statelessKieSession = null;
}
 
Example 25
Source Project: springdoc-openapi   Source File: SpringDocApp9Test.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
private void clean() throws IllegalAccessException {
	Field convertersField2 = FieldUtils.getDeclaredField(ObjectMapper.class, "_mixIns", true);
	SimpleMixInResolver _mixIns = (SimpleMixInResolver) convertersField2.get(Json.mapper());
	Field convertersField3 = FieldUtils.getDeclaredField(SimpleMixInResolver.class, "_localMixIns", true);
	Map<ClassKey, Class<?>> _localMixIns = (Map<ClassKey, Class<?>>) convertersField3.get(_mixIns);
	_localMixIns.putAll(springMixins);
}
 
Example 26
Source Project: camel-quarkus   Source File: QuteTestBase.java    License: Apache License 2.0 5 votes vote down vote up
@AfterEach
void afterEach() {
    if (template != null) {
        template.stop();
    }
    if (context != null) {
        context.stop();
    }
}
 
Example 27
@AfterEach
void tearDown() throws IOException {
    packageJsonInputStream.close();
}
 
Example 28
Source Project: kogito-runtimes   Source File: JbpmBpmn2TestCase.java    License: Apache License 2.0 4 votes vote down vote up
@AfterEach
public void clear() {
    clearHistory();
}
 
Example 29
Source Project: kogito-runtimes   Source File: BooleanHandlerTest.java    License: Apache License 2.0 4 votes vote down vote up
@AfterEach
public void destroy() {
    registry.clear();
}
 
Example 30
Source Project: smithy   Source File: SmithyBuildTest.java    License: Apache License 2.0 4 votes vote down vote up
@AfterEach
public void after() throws IOException {
    Files.walk(outputDirectory).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
}