summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-03-26 11:51:52 -0400
committerJim Hahn <jrh3@att.com>2020-03-26 11:57:54 -0400
commit67d13b7e11677e3f2678e137471923222ec9b329 (patch)
tree33e593477680612418e53130a2adac03c9707a49
parent81c5709370fe2cb60872f704c69a98e1f6cabfd0 (diff)
Discard requests in APPC legacy actor
The new actor for legacy APPC attempts to discard request messages received on the response topic by discarding those that have a null response. Unfortunately, when it decodes them, the Response object creates a status object, even if there isn't one in the json message, thus the test fails and the actor treats it as a failed response. Issue-ID: POLICY-2434 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I26cfb25443ff2ed394781d309f9097d50b8f160b Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java3
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java7
2 files changed, 9 insertions, 1 deletions
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
index 068f0b5a1..0fd3a8a42 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
@@ -37,6 +37,7 @@ import org.junit.Test;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
+import org.onap.policy.appc.ResponseStatus;
import org.onap.policy.appc.util.Serialization;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.controlloop.ControlLoopEventStatus;
@@ -194,6 +195,7 @@ public class AppcServiceProviderTest extends BasicActor {
assertFalse(jsonRequest.contains(SUBVALUE + ".0"));
Response appcResponse = new Response(appcRequest);
+ appcResponse.setStatus(new ResponseStatus());
appcResponse.getStatus().setCode(ResponseCode.SUCCESS.getValue());
appcResponse.getStatus().setDescription("AppC success");
/* Print out request as json to make sure serialization works */
@@ -237,6 +239,7 @@ public class AppcServiceProviderTest extends BasicActor {
assertTrue(jsonRequest.contains(GENERIC_VNF_ID));
Response appcResponse = new Response(appcRequest);
+ appcResponse.setStatus(new ResponseStatus());
appcResponse.getStatus().setCode(ResponseCode.SUCCESS.getValue());
appcResponse.getStatus().setDescription("AppC success");
/* Print out request as json to make sure serialization works */
diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java
index ae8b76423..fb70151f6 100644
--- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java
+++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java
@@ -38,8 +38,13 @@ public class Response implements Serializable {
@SerializedName("CommonHeader")
private CommonHeader commonHeader;
+ /**
+ * This should only be populated if the incoming message actually has a "Status"
+ * field. Otherwise, actor.appc will be unable to use this to distinguish between
+ * Request and Response objects.
+ */
@SerializedName("Status")
- private ResponseStatus status = new ResponseStatus();
+ private ResponseStatus status;
@SerializedName("Payload")
private Map<String, Object> payload = new HashMap<>();