diff options
author | Patrick Brady <patrick.brady@att.com> | 2019-06-03 22:13:50 -0700 |
---|---|---|
committer | Takamune Cho <takamune.cho@att.com> | 2019-06-04 13:48:41 +0000 |
commit | cc699ebd58f10c947a382ff695a8039f3d0744d8 (patch) | |
tree | 1c01c596f7d178bcdf32698f67315985e622e73e /appc-event-listener | |
parent | 7155b808084ff6e49f6eef01ac7defd9a7754a3a (diff) |
Fix for null dmaap return status
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
(cherry picked from commit 62433c522bb1feddc2caa22868192edca0b4082f)
Diffstat (limited to 'appc-event-listener')
2 files changed, 5 insertions, 1 deletions
diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/demo/model/OutgoingMessage.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/demo/model/OutgoingMessage.java index 375dde55f..100d55bf2 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/demo/model/OutgoingMessage.java +++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/onap/appc/listener/demo/model/OutgoingMessage.java @@ -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; } diff --git a/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/demo/model/TestIncomingMessage.java b/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/demo/model/TestIncomingMessage.java index fe3406a13..d8d0986ce 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/demo/model/TestIncomingMessage.java +++ b/appc-event-listener/appc-event-listener-bundle/src/test/java/org/onap/appc/listener/demo/model/TestIncomingMessage.java @@ -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)); } } |