diff options
Diffstat (limited to 'examples/examples-acm/src/test')
-rw-r--r-- | examples/examples-acm/src/test/java/org/onap/policy/apex/examples/acm/TestApexAcmExample.java | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/examples/examples-acm/src/test/java/org/onap/policy/apex/examples/acm/TestApexAcmExample.java b/examples/examples-acm/src/test/java/org/onap/policy/apex/examples/acm/TestApexAcmExample.java index be4bec096..8b360d39b 100644 --- a/examples/examples-acm/src/test/java/org/onap/policy/apex/examples/acm/TestApexAcmExample.java +++ b/examples/examples-acm/src/test/java/org/onap/policy/apex/examples/acm/TestApexAcmExample.java @@ -20,13 +20,14 @@ package org.onap.policy.apex.examples.acm; -import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertTrue; -import jakarta.ws.rs.client.ClientBuilder; -import java.util.concurrent.TimeUnit; +import java.nio.file.Files; +import java.nio.file.Path; import org.junit.jupiter.api.Test; import org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain; -import org.onap.policy.apex.service.engine.main.ApexMain; + /** * Test class to run an example policy for ACM interaction. Event received on @@ -36,8 +37,7 @@ class TestApexAcmExample { @Test void testExample() { - try (var dmmap = new AcmTestServerDmaap()) { - dmmap.validate(); + try { // @formatter:off final String[] cliArgs = new String[] { @@ -54,29 +54,9 @@ class TestApexAcmExample { }; // @formatter:on - new ApexCliToscaEditorMain(cliArgs); - - // @formatter:off - final String[] apexArgs = { - "-rfr", - "target/classes", - "-p", - "target/classes/APEXacElementPolicy.json" - }; - // @formatter:on - - final var client = ClientBuilder.newClient(); - final var apexMain = new ApexMain(apexArgs); - - await().atMost(5000, TimeUnit.MILLISECONDS).until(apexMain::isAlive); + assertDoesNotThrow(() -> new ApexCliToscaEditorMain(cliArgs)); + assertTrue(Files.exists(Path.of("target/classes/APEXacElementPolicy.json"))); - String getLoggedEventUrl = "http://localhost:3904/events/getLoggedEvent"; - await().atMost(20000, TimeUnit.MILLISECONDS).until(() -> { - var response = client.target(getLoggedEventUrl).request("application/json").get(); - var responseEntity = response.readEntity(String.class); - return responseEntity != null && !responseEntity.isEmpty(); - }); - apexMain.shutdown(); } catch (Exception e) { e.printStackTrace(); } |