aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-grpc/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-grpc/src/test/java')
-rw-r--r--examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/GrpcTestRestSimEndpoint.java2
-rw-r--r--examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/TestApexGrpcExample.java11
2 files changed, 8 insertions, 5 deletions
diff --git a/examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/GrpcTestRestSimEndpoint.java b/examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/GrpcTestRestSimEndpoint.java
index 4e88afe83..17b99c986 100644
--- a/examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/GrpcTestRestSimEndpoint.java
+++ b/examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/GrpcTestRestSimEndpoint.java
@@ -68,7 +68,7 @@ public class GrpcTestRestSimEndpoint {
public Response policyLogRequest(final String jsonString) {
LOGGER.info("\n*** POLICY LOG ENTRY START ***\n {} \n *** POLICY LOG ENTRY END ***", jsonString);
synchronized (lock) {
- loggedOutputEvent = jsonString;
+ loggedOutputEvent += jsonString + "\n";
}
return Response.status(200).build();
}
diff --git a/examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/TestApexGrpcExample.java b/examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/TestApexGrpcExample.java
index 7f799c24f..a197432ba 100644
--- a/examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/TestApexGrpcExample.java
+++ b/examples/examples-grpc/src/test/java/org/onap/policy/apex/examples/grpc/TestApexGrpcExample.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
- * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,8 @@
package org.onap.policy.apex.examples.grpc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -85,9 +85,12 @@ public class TestApexGrpcExample {
Response response = client.target(getLoggedEventUrl).request("application/json").get();
sim.tearDown();
String responseEntity = response.readEntity(String.class);
-
String expectedLoggedOutputEvent = Files
.readString(Paths.get("src/main/resources/examples/events/APEXgRPC/LogEvent.json")).replaceAll("\r", "");
- assertEquals(expectedLoggedOutputEvent, responseEntity);
+ String expectedStatusEvent =
+ Files.readString(Paths.get("src/main/resources/examples/events/APEXgRPC/CDSResponseStatusEvent.json"))
+ .replaceAll("\r", "");
+ // Both LogEvent and CDSResponseStatusEvent are generated from the final state in the policy
+ assertThat(responseEntity).contains(expectedStatusEvent + expectedLoggedOutputEvent);
}
}