summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/test/java
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2018-11-07 17:46:59 +0100
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2018-11-07 17:46:59 +0100
commit1c554c3332ccf6be4e576e9159bbb0f901197379 (patch)
tree2f27cccca3b87c7ef220339852a7d760fa35081b /bpmn/so-bpmn-infrastructure-common/src/test/java
parent2073a3b4c20965252c7f3a0c1aea8e4407e876fa (diff)
bug fixing with reading dmaap message
Change-Id: I259337e866d1b401b574ba427219157dfc4987af Issue-ID: SO-1191 Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/test/java')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java36
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java22
2 files changed, 19 insertions, 39 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java
index 24d1810ac6..fde112b009 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2018 Nokia.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -24,30 +26,18 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import org.junit.Test;
-import org.onap.so.bpmn.infrastructure.pnf.dmaap.JsonUtilForCorrelationId;
public class JsonUtilForCorrelationIdTest {
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n"
- + " {\n"
- + " \"pnfRegistrationFields\" : {\n"
- + " \"correlationId\" : \"corrTest1\",\n"
- + " \"value\" : \"value1\"\n"
- + " }\n"
- + " },\n"
- + " {\n"
- + " \"pnfRegistrationFields\" : {\n"
- + " \"correlationId\" : \"corrTest2\",\n"
- + " \"value\" : \"value2\"\n"
- + " }\n"
- + " }\n"
- + "]";
+ private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"corrTest1\","
+ + "\"key1\":\"value1\"},{\"correlationId\": \"corrTest2\",\"key2\":\"value2\"}]";
+
+ private static final String JSON_WITH_ONE_CORRELATION_ID = "[{\"correlationId\":\"corrTest3\"}]";
+
+ private static final String JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS =
+ "[\"{\\\"correlationId\\\":\\\"corrTest4\\\"}\", \"{\\\"correlationId\\\":\\\"corrTest5\\\"}\"]";
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID2 = "{\"pnfRegistrationFields\":{\"correlationId\":\"corrTest3\"}}";
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID3 = "[\"{\\\"pnfRegistrationFields\\\":"
- + "{\\\"correlationId\\\":\\\"corrTest4\\\"}}\", \"{\\\"pnfRegistrationFields\\\":"
- + "{\\\"correlationId\\\":\\\"corrTest5\\\"}}\"]";
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID4 = "{\"header\":{\"key\":\"value\"}}";
+ private static final String JSON_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
@Test
public void parseJsonSuccessful() {
@@ -56,21 +46,21 @@ public class JsonUtilForCorrelationIdTest {
assertThat(expectedResult).containsExactly("corrTest1", "corrTest2");
List<String> expectedResult2 = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID2);
+ .parseJsonToGelAllCorrelationId(JSON_WITH_ONE_CORRELATION_ID);
assertThat(expectedResult2).containsExactly("corrTest3");
}
@Test
public void parseJsonWithEscapeCharacters_Successful() {
List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID3);
+ .parseJsonToGelAllCorrelationId(JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS);
assertThat(expectedResult).containsExactly("corrTest4", "corrTest5");
}
@Test
public void parseJson_emptyListReturnedWhenNothingFound() {
List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID4);
+ .parseJsonToGelAllCorrelationId(JSON_WITH_NO_CORRELATION_ID);
assertThat(expectedResult).isEmpty();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index aab01c0a3e..1b0169d6d3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2018 Nokia.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -55,22 +57,10 @@ public class PnfEventReadyDmaapClientTest {
private static final String CORRELATION_ID = "corrTestId";
private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId";
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n"
- + " {\n"
- + " \"pnfRegistrationFields\" : {\n"
- + " \"correlationId\" : \"%s\",\n"
- + " \"value\" : \"value1\"\n"
- + " }\n"
- + " },\n"
- + " {\n"
- + " \"pnfRegistrationFields\" : {\n"
- + " \"correlationId\" : \"corr\",\n"
- + " \"value\" : \"value2\"\n"
- + " }\n"
- + " }\n"
- + "]";
- private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID =
- "{\"pnfRegistrationFields\":{\"field\":\"value\"}}";
+ private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"%s\","
+ + "\"value\":\"value1\"},{\"correlationId\": \"corr\",\"value\":\"value2\"}]";
+
+ private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
private static final String HOST = "hostTest";
private static final int PORT = 1234;