Fix for null dmaap return status 08/89208/2
authorPatrick Brady <patrick.brady@att.com>
Tue, 4 Jun 2019 05:13:50 +0000 (22:13 -0700)
committerPatrick Brady <patrick.brady@att.com>
Tue, 4 Jun 2019 05:56:49 +0000 (22:56 -0700)
The setResponse method was returning before actually
setting the status values in cases where the status
field was not first initialized. This behavior did
not make sense since the status field would never be
initialized in cases where the OutgoingMessage was
generated using the IncomingMessage.toOutgoing().

Change-Id: Ib399daf3644095a2eeffe718d0f6a27473b01ee9
Signed-off-by: Patrick Brady <patrick.brady@att.com>
Issue-ID: APPC-1619

appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/demo/model/OutgoingMessage.java
appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/demo/model/TestIncomingMessage.java

index 375dde5..100d55b 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP : APPC
  * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * ================================================================================
@@ -170,6 +170,8 @@ public class OutgoingMessage extends CommonMessage {
     public void setResponse(Status newStatus) {
         if(this.status == null){
             this.status = new OutStatus();
+        }
+        if(newStatus == null) {
             return;
         }
 
index fe3406a..d8d0986 100644 (file)
@@ -39,6 +39,8 @@ public class TestIncomingMessage {
     public void testToOutgoing() {
         String expected = "{\"Status\":{\"Value\":null,\"Code\":null}}";
         assertEquals(expected, incomingMessage.toOutgoing(null));
+        expected = "{\"Status\":{\"Value\":\""+Status.ACCEPTED.getValue()+"\",\"Code\":\"100\"}}";
+        assertEquals(expected, incomingMessage.toOutgoing(Status.ACCEPTED));
     }
 
 }