org.junit.jupiter.api.AfterEach Java Examples

The following examples show how to use org.junit.jupiter.api.AfterEach. 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: CamelSourceAWSKinesisITCase.java    From camel-kafka-connector with Apache License 2.0 6 votes vote down vote up
@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 File: CamelSinkAWSSQSITCase.java    From camel-kafka-connector with Apache License 2.0 5 votes vote down vote up
@AfterEach
public void tearDown() {
    deleteKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()));
    if (!awssqsClient.deleteQueue(queueName)) {
        fail("Failed to delete queue");
    }
}
 
Example #3
Source File: QuteTestBase.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@AfterEach
void afterEach() {
    if (template != null) {
        template.stop();
    }
    if (context != null) {
        context.stop();
    }
}
 
Example #4
Source File: SpannerTestKit.java    From cloud-spanner-r2dbc with 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 #5
Source File: RulesResourceIT.java    From apicurio-registry with 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 #6
Source File: RegistryMojoTestBase.java    From apicurio-registry with 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 #7
Source File: DynamicEvalTest.java    From kogito-runtimes with 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 #8
Source File: CorsAcceptanceTest.java    From ethsigner with 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 #9
Source File: MultiKeyAcceptanceTestBase.java    From ethsigner with Apache License 2.0 5 votes vote down vote up
@AfterEach
public void cleanUp() {
  if (ethSigner != null) {
    ethSigner.shutdown();
    ethSigner = null;
  }
}
 
Example #10
Source File: ServerSideTlsAcceptanceTest.java    From ethsigner with Apache License 2.0 5 votes vote down vote up
@AfterEach
void cleanup() {
  if (ethSigner != null) {
    ethSigner.shutdown();
    ethSigner = null;
  }
}
 
Example #11
Source File: ClientSideTlsAcceptanceTest.java    From ethsigner with Apache License 2.0 5 votes vote down vote up
@AfterEach
void cleanup() {
  serverFactory.shutdown();
  if (signer != null) {
    signer.shutdown();
    signer = null;
  }
}
 
Example #12
Source File: ServerSideTlsCaClientAcceptanceTest.java    From ethsigner with Apache License 2.0 5 votes vote down vote up
@AfterEach
void cleanup() {
  if (ethSigner != null) {
    ethSigner.shutdown();
    ethSigner = null;
  }
}
 
Example #13
Source File: AllArtifactTypesIT.java    From apicurio-registry with 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 #14
Source File: ReadTimeoutAcceptanceTest.java    From ethsigner with 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 #15
Source File: CamelSourceAWSSQSITCase.java    From camel-kafka-connector with Apache License 2.0 5 votes vote down vote up
@AfterEach
public void tearDown() {
    deleteKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()));

    if (!awssqsClient.deleteQueue(queueName)) {
        fail("Failed to delete queue");
    }
}
 
Example #16
Source File: ArtifactsIT.java    From apicurio-registry with 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 File: ClientCaOrWhitelistTest.java    From incubator-tuweni with 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 #18
Source File: ClientWhitelistTest.java    From incubator-tuweni with 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 #19
Source File: KubeClientConfigTest.java    From kogito-runtimes with 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 #20
Source File: SimpleBatchExecutionTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@AfterEach
public void disposeKSession() throws Exception {
    if( ksession != null ) { 
        ksession.dispose();
        ksession = null;
    }
}
 
Example #21
Source File: ServerWhitelistTest.java    From incubator-tuweni with 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 #22
Source File: SpringDocApp9Test.java    From springdoc-openapi with 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 #23
Source File: SystemStreamTests.java    From vividus with Apache License 2.0 5 votes vote down vote up
@After
@AfterEach
public void after()
{
    out.reset();
    err.reset();
}
 
Example #24
Source File: ListenersTest.java    From kogito-runtimes with 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 File: CamelSourceSalesforceITCase.java    From camel-kafka-connector with Apache License 2.0 5 votes vote down vote up
@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 #26
Source File: CamelSinkCassandraITCase.java    From camel-kafka-connector with Apache License 2.0 5 votes vote down vote up
@AfterEach
public void tearDown() {
    cassandraClient = cassandraService.getClient();

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

    deleteKafkaTopic(TestUtils.getDefaultTestTopic(this.getClass()));
}
 
Example #27
Source File: SpannerIT.java    From cloud-spanner-r2dbc with Apache License 2.0 4 votes vote down vote up
@AfterEach
public void shutdown() {
  this.grpcClient.close().block();
}
 
Example #28
Source File: AnalyticsStoryReporterTests.java    From vividus with Apache License 2.0 4 votes vote down vote up
@AfterEach
void afterEach()
{
    EnvironmentConfigurer.ENVIRONMENT_CONFIGURATION.values().forEach(Map::clear);
}
 
Example #29
Source File: KnativeHttpTest.java    From camel-k-runtime with Apache License 2.0 4 votes vote down vote up
@AfterEach
public void after() {
    if (this.context != null) {
        this.context.stop();
    }
}
 
Example #30
Source File: Neo4jClientTest.java    From sdn-rx with Apache License 2.0 4 votes vote down vote up
@AfterEach
void verifyNoMoreInteractionsWithMocks() {
	verifyNoMoreInteractions(driver, session, result, resultSummary, record1, record2);
}