aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-acm/src/test/java
diff options
context:
space:
mode:
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>2024-07-17 09:12:52 +0100
committerrameshiyer27 <ramesh.murugan.iyer@est.tech>2024-09-18 09:27:05 +0100
commit683a4a788de041d390d57c5a8f71c4d83fff8820 (patch)
tree4ee82966876ac62e37cf5f83e8475370733a7060 /examples/examples-acm/src/test/java
parent827a10e2abc1a0967cd215988de63c94a83d6e64 (diff)
Apex pdp code improvements
Fix compilation issues in windows Replace Acm policy with kafka coverage improvements Issue-ID: POLICY-5059 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: Idfac722cce2d1a2fa471e8c77286006bd883e9a7
Diffstat (limited to 'examples/examples-acm/src/test/java')
-rw-r--r--examples/examples-acm/src/test/java/org/onap/policy/apex/examples/acm/TestApexAcmExample.java36
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();
}