diff options
author | 2018-03-28 13:32:44 +0000 | |
---|---|---|
committer | 2018-03-28 13:32:44 +0000 | |
commit | fa0fd7c1fe8dcb746cc8bdb9cc8d8e09ef10f7ad (patch) | |
tree | 500e451f4520d83ce97d96de55e1ba69fde8fbbc /dmaap-listener/src/test/java | |
parent | 4a8c2cb9920983f8b8af75be90f7511a59e923f5 (diff) |
Add Aai event listener
Add support for Aai and Pserver incoming messages from Dmaap
Change-Id: I6ace2395476a1410ea3b7ffe0bebc1766d19e474
Issue-ID: CCSDK-223
Signed-off-by: Serban Popescu <sp5226@att.com>
Diffstat (limited to 'dmaap-listener/src/test/java')
-rw-r--r-- | dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java index db7cbd72..b9b20a6c 100644 --- a/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java +++ b/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java @@ -9,12 +9,16 @@ package org.onap.ccsdk.sli.northbound.dmaapclient; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; import java.util.Properties; import org.junit.Before; import org.junit.Test; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + public class TestSdncPserverDmaapReceiver { private static final String aaiInput = "{\r\n" + " \"cambria.partition\": \"AAI\",\r\n" + @@ -75,10 +79,20 @@ public class TestSdncPserverDmaapReceiver { Properties props = new Properties(); String rpcMsgbody = new SdncAaiDmaapConsumer(props).publish("src/main/resources/template-pserver.vt", aaiInput); + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode aaiRootNode; + try { + aaiRootNode = oMapper.readTree(rpcMsgbody); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse json object", e); + } - assertTrue(rpcMsgbody.indexOf("input") != -1); - assertTrue(rpcMsgbody.indexOf("payload") != -1); - assertTrue(rpcMsgbody.indexOf("common-header") != -1); + assertTrue(aaiRootNode.get("input").get("payload") != null); + assertTrue(aaiRootNode.get("input").get("common-header") != null); + + assertEquals(aaiRootNode.get("input").get("action-identifiers").get("action-name").textValue(), "dmaap-notification"); + assertEquals(aaiRootNode.get("input").get("action-identifiers").get("mode").textValue(), "async"); } |