aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java139
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java93
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java78
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java84
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java54
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java54
10 files changed, 756 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java
new file mode 100644
index 0000000000..5483792a84
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java
@@ -0,0 +1,139 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm;
+
+import java.util.List;
+import org.apache.http.HttpStatus;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.fail;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import org.onap.so.BaseTest;
+import org.onap.so.client.restproperties.SDNCLcmPropertiesImpl;
+import org.onap.so.client.sdnc.lcm.beans.*;
+
+public class SDNCLcmDmaapClientTest extends BaseTest {
+
+ protected SDNCLcmMessageBuilderTest sdncLcmMessageBuilderTest = new SDNCLcmMessageBuilderTest();
+
+ protected static final String DMAAP_HOST_PROP = SDNCLcmPropertiesImpl.DMAAP_HOST;
+ protected static final String DMAAP_WRITE_TOPIC_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_WRITE_TOPIC;
+ protected static final String DMAAP_READ_TOPIC_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_READ_TOPIC;
+ protected static final String DMAAP_PARTITION_PROP = SDNCLcmPropertiesImpl.DMAAP_PARTITION;
+
+ protected String testWriteTopic = "TEST-WRITE-TOPIC";
+ protected String testReadTopic = "TEST-READ-TOPIC";
+ protected String testPartition = "TESTMSO";
+ protected final String defaultConsumerName = "consumer1";
+
+ private void clearSystemProperty() {
+ System.clearProperty(DMAAP_HOST_PROP);
+ System.clearProperty(DMAAP_WRITE_TOPIC_PROP);
+ System.clearProperty(DMAAP_READ_TOPIC_PROP);
+ System.clearProperty(DMAAP_PARTITION_PROP);
+ }
+
+ public SDNCLcmDmaapClient buildSDNCLcmDmaapClient() {
+ String testHost = "http://localhost:" + wireMockPort;
+
+ System.setProperty(DMAAP_HOST_PROP, testHost);
+ System.setProperty(DMAAP_WRITE_TOPIC_PROP, testWriteTopic);
+ System.setProperty(DMAAP_READ_TOPIC_PROP, testReadTopic);
+ System.setProperty(DMAAP_PARTITION_PROP, testPartition);
+
+ SDNCLcmProperties sdncLcmProperties = new SDNCLcmPropertiesImpl();
+ SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(sdncLcmProperties);
+
+ try {
+ return sdncLcmClientBuilder.newSDNCLcmDmaapClient();
+ } catch (Exception e) {
+ clearSystemProperty();
+ fail("Create SDNCLcmDmaapClient error: " + e.toString());
+ return null;
+ }
+ }
+
+ @Test
+ public final void testSDNCLcmDmaapClientSendRequest() {
+ SDNCLcmDmaapClient sdncLcmDmaapClient = buildSDNCLcmDmaapClient();
+
+ assertNotEquals(null, sdncLcmDmaapClient);
+
+ String testDmaapWritePath = "/events/" + testWriteTopic;
+ String expectedWriteResponse = "{\"serverTimeMs\":2,\"count\":1}";
+ wireMockServer.stubFor(post(urlPathEqualTo(testDmaapWritePath))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(expectedWriteResponse)
+ .withStatus(HttpStatus.SC_OK)));
+
+ LcmInput lcmInput = sdncLcmMessageBuilderTest.buildLcmInputForPnf();
+ LcmDmaapRequest lcmDmaapRequest =
+ SDNCLcmMessageBuilder.buildLcmDmaapRequest(sdncLcmMessageBuilderTest.getOperation(), lcmInput);
+
+ try {
+ sdncLcmDmaapClient.sendRequest(lcmDmaapRequest);
+ } catch (Exception e) {
+ clearSystemProperty();
+ fail("SDNCLcmDmaapClient sends request error: " + e.toString());
+ return;
+ }
+
+ String testDmaapReadPath = "/events/" + testReadTopic + "/" + testPartition + "/" + defaultConsumerName;
+
+ String expectedLcmDmaapResponse = LcmDmaapResponseTest.getExpectedLcmDmaapResponse();
+ String expectedResponseListItem;
+ try {
+ expectedResponseListItem = sdncLcmMessageBuilderTest.convertToSting(expectedLcmDmaapResponse);
+ } catch (JsonProcessingException e) {
+ clearSystemProperty();
+ fail("Convert LcmDmaapResponse String to List item error: " + e.toString());
+ return;
+ }
+ String expectedReadResponse = "[" + expectedResponseListItem + "]";
+ wireMockServer.stubFor(get(urlPathEqualTo(testDmaapReadPath))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(expectedReadResponse)
+ .withStatus(HttpStatus.SC_OK)));
+
+ List<LcmDmaapResponse> LcmDmaapResponseList = sdncLcmDmaapClient.getResponse();
+
+ clearSystemProperty();
+
+ if (LcmDmaapResponseList.size() < 1) {
+ clearSystemProperty();
+ fail("Can not get LcmDmaapResponse list");
+ return;
+ }
+
+ LcmOutput lcmOutput = LcmDmaapResponseList.get(0).getBody().getOutput();
+
+ String expectedLcmOutput = LcmOutputTest.getExpectedLcmOutput();
+ try {
+ String lcmOutputString = sdncLcmMessageBuilderTest.convertToSting(lcmOutput);
+ assertEquals(expectedLcmOutput, lcmOutputString);
+ } catch (Exception e) {
+ fail("Convert LcmOutput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java
new file mode 100644
index 0000000000..d930c6728c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import org.onap.so.client.sdnc.lcm.beans.LcmBeanTest;
+import org.onap.so.client.sdnc.lcm.beans.LcmInput;
+import org.onap.so.client.sdnc.lcm.beans.LcmInputTest;
+
+public class SDNCLcmMessageBuilderTest extends LcmBeanTest {
+
+ public LcmInput buildLcmInputForPnf() {
+ LcmInput lcmInput =
+ SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, action, inputPayload);
+
+ lcmInput.getCommonHeader().setTimestamp(timestamp);
+
+ return lcmInput;
+ }
+
+ @Test
+ public final void testBuildLcmRestRequestForPnf() {
+ LcmInput lcmInput = buildLcmInputForPnf();
+
+ String expectedLcmInput = LcmInputTest.getExpectedLcmInput();
+ try {
+ String lcmInputString = convertToSting(lcmInput);
+ assertEquals(expectedLcmInput, lcmInputString);
+ } catch (Exception e) {
+ fail("Convert LcmInput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java
new file mode 100644
index 0000000000..04cfc6e3c8
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm;
+
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.fail;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.BaseTest;
+import org.onap.so.client.restproperties.SDNCLcmPropertiesImpl;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+import org.onap.so.client.sdnc.lcm.beans.*;
+
+public class SDNCLcmRestClientTest extends BaseTest {
+
+ protected SDNCLcmMessageBuilderTest sdncLcmMessageBuilderTest = new SDNCLcmMessageBuilderTest();
+
+ protected static final String SDNC_HOST_PROP = SDNCLcmPropertiesImpl.SDNC_HOST;
+ protected static final String SDNC_PATH_PROP = SDNCLcmPropertiesImpl.LCM_PATH;
+
+ private void clearSystemProperty() {
+ System.clearProperty(SDNC_HOST_PROP);
+ System.clearProperty(SDNC_PATH_PROP);
+ }
+
+ public SDNCLcmRestClient buildSDNCLcmRestClient() {
+ String testHost = "http://localhost:" + wireMockPort;
+
+ System.setProperty(SDNC_HOST_PROP, testHost);
+ System.setProperty(SDNC_PATH_PROP, SDNCConstants.LCM_API_BASE_PATH);
+
+ SDNCLcmProperties sdncLcmProperties = new SDNCLcmPropertiesImpl();
+ SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(sdncLcmProperties);
+
+ try {
+ return sdncLcmClientBuilder.newSDNCLcmRestClient(sdncLcmMessageBuilderTest.getOperation());
+ } catch (Exception e) {
+ clearSystemProperty();
+ fail("Create SDNCLcmRestClient error: " + e.toString());
+ return null;
+ }
+ }
+
+ @Test
+ public final void testSDNCLcmRestClientSendRequest() {
+ SDNCLcmRestClient sdncLcmRestClient = buildSDNCLcmRestClient();
+
+ assertNotEquals(null, sdncLcmRestClient);
+ assertEquals(ONAPComponents.SDNC, sdncLcmRestClient.getTargetEntity());
+
+ String testLcmApiPath = SDNCConstants.LCM_API_BASE_PATH + sdncLcmMessageBuilderTest.getOperation();
+ String expectedLcmRestResponse = LcmRestResponseTest.getExpectedLcmRestResponse();
+ wireMockServer.stubFor(post(urlPathEqualTo(testLcmApiPath))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(expectedLcmRestResponse)
+ .withStatus(HttpStatus.SC_OK)));
+
+ LcmInput lcmInput = sdncLcmMessageBuilderTest.buildLcmInputForPnf();
+ LcmOutput lcmOutput = sdncLcmRestClient.sendRequest(lcmInput);
+
+ clearSystemProperty();
+
+ String expectedLcmOutput = LcmOutputTest.getExpectedLcmOutput();
+ try {
+ String lcmOutputString = sdncLcmMessageBuilderTest.convertToSting(lcmOutput);
+ assertEquals(expectedLcmOutput, lcmOutputString);
+ } catch (Exception e) {
+ fail("Convert LcmOutput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java
new file mode 100644
index 0000000000..5562444a46
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+
+public class LcmBeanTest {
+ private static Logger logger = LoggerFactory.getLogger(LcmBeanTest.class);
+
+ protected String requestId = "9f77f437-1515-44bd-a420-0aaf8a3c31a0";
+ protected String subRequestId = "c197a4b5-18d9-48a2-ad2d-a3b56858501c";
+ protected String timestamp = "2020-02-25T10:20:28.116Z";
+
+ protected String pnfName = "testpnf";
+ protected String action = "TestAction";
+ protected String operation = "test-operation";
+
+ protected String inputPayload = "{\"testPayload\": \"input test\"}";
+ protected String outputPayload = "{\"testPayload\": \"output test\"}";
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public LcmFlags buildSDNCFlags() {
+ LcmFlags lcmFlags = new LcmFlags();
+
+ lcmFlags.setMode(SDNCConstants.LCM_FLAGS_MODE_NORMAL);
+ lcmFlags.setForce(SDNCConstants.LCM_FLAGS_FORCE_FALSE);
+ lcmFlags.setTtl(SDNCConstants.LCM_FLAGS_TTL);
+
+ return lcmFlags;
+ }
+
+ public LcmCommonHeader buildLcmCommonHeader() {
+ LcmCommonHeader lcmCommonHeader = new LcmCommonHeader();
+
+ lcmCommonHeader.setApiVer(SDNCConstants.LCM_API_VER);
+ lcmCommonHeader.setFlags(buildSDNCFlags());
+ lcmCommonHeader.setOriginatorId(SDNCConstants.SYSTEM_NAME);
+ lcmCommonHeader.setRequestId(requestId);
+ lcmCommonHeader.setSubRequestId(subRequestId);
+ lcmCommonHeader.setTimestamp(timestamp);
+
+ return lcmCommonHeader;
+ }
+
+ public String convertToSting(Object msgObject) throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String msgString = mapper.writeValueAsString(msgObject);
+ logger.debug(msgObject.getClass().getSimpleName() + "\n" + msgString);
+
+ return msgString;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java
new file mode 100644
index 0000000000..709a557937
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmDmaapRequestTest extends LcmBeanTest {
+ private static String expectedLcmDmaapRequest = "{" + "\"version\":\"1.0\"," + "\"type\":\"request\","
+ + "\"cambria.partition\":\"MSO\","
+ + "\"correlation-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0-c197a4b5-18d9-48a2-ad2d-a3b56858501c\","
+ + "\"rpc-name\":\"test-operation\"," + "\"body\":" + LcmRestRequestTest.getExpectedLcmRestRequest() + "}";
+
+ public LcmDmaapRequest buildLcmDmaapRequest() {
+ LcmDmaapRequest lcmDmaapRequest = new LcmDmaapRequest();
+
+ LcmRestRequestTest lcmRestRequestTest = new LcmRestRequestTest();
+ LcmRestRequest lcmRestRequest = lcmRestRequestTest.buildLcmRestRequest();
+ LcmCommonHeader lcmCommonHeader = lcmRestRequest.getInput().getCommonHeader();
+ String correlationId = lcmCommonHeader.getRequestId() + "-" + lcmCommonHeader.getSubRequestId();
+
+ lcmDmaapRequest.setVersion(SDNCConstants.LCM_DMAAP_MSG_VER);
+ lcmDmaapRequest.setType(SDNCConstants.LCM_DMAAP_MSG_TYPE_REQUEST);
+ lcmDmaapRequest.setCambriaPartition(SDNCConstants.SYSTEM_NAME);
+ lcmDmaapRequest.setCorrelationId(correlationId);
+ lcmDmaapRequest.setRpcName(operation);
+ lcmDmaapRequest.setBody(lcmRestRequest);
+
+ return lcmDmaapRequest;
+ }
+
+ public static String getExpectedLcmDmaapRequest() {
+ return expectedLcmDmaapRequest;
+ }
+
+ @Test
+ public final void testLcmDmaapRequest() {
+ LcmDmaapRequest lcmDmaapRequest = buildLcmDmaapRequest();
+
+ try {
+ String lcmDmaapRequestString = convertToSting(lcmDmaapRequest);
+ assertEquals(expectedLcmDmaapRequest, lcmDmaapRequestString);
+ } catch (Exception e) {
+ fail("Convert LcmDmaapRequest to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java
new file mode 100644
index 0000000000..0cdbeebb27
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmDmaapResponseTest extends LcmBeanTest {
+ private static String expectedLcmDmaapResponse = "{" + "\"version\":\"1.0\"," + "\"type\":\"response\","
+ + "\"cambria.partition\":\"MSO\","
+ + "\"correlation-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0-c197a4b5-18d9-48a2-ad2d-a3b56858501c\","
+ + "\"rpc-name\":\"test-operation\"," + "\"body\":" + LcmRestResponseTest.getExpectedLcmRestResponse() + "}";
+
+ public LcmDmaapResponse buildLcmDmaapResponse() {
+ LcmDmaapResponse lcmDmaapResponse = new LcmDmaapResponse();
+
+ LcmRestResponseTest lcmRestResponseTest = new LcmRestResponseTest();
+ LcmRestResponse lcmRestResponse = lcmRestResponseTest.buildLcmRestResponse();
+ LcmCommonHeader lcmCommonHeader = lcmRestResponse.getOutput().getCommonHeader();
+ String correlationId = lcmCommonHeader.getRequestId() + "-" + lcmCommonHeader.getSubRequestId();
+
+ lcmDmaapResponse.setVersion(SDNCConstants.LCM_DMAAP_MSG_VER);
+ lcmDmaapResponse.setType(SDNCConstants.LCM_DMAAP_MSG_TYPE_RESPONSE);
+ lcmDmaapResponse.setCambriaPartition(SDNCConstants.SYSTEM_NAME);
+ lcmDmaapResponse.setCorrelationId(correlationId);
+ lcmDmaapResponse.setRpcName(operation);
+ lcmDmaapResponse.setBody(lcmRestResponse);
+
+ return lcmDmaapResponse;
+ }
+
+ public static String getExpectedLcmDmaapResponse() {
+ return expectedLcmDmaapResponse;
+ }
+
+ @Test
+ public final void testLcmDmaapResponse() {
+ LcmDmaapResponse lcmDmaapResponse = buildLcmDmaapResponse();
+
+ try {
+ String lcmDmaapResponseString = convertToSting(lcmDmaapResponse);
+ assertEquals(expectedLcmDmaapResponse, lcmDmaapResponseString);
+ } catch (Exception e) {
+ fail("Convert LcmDmaapResponse to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java
new file mode 100644
index 0000000000..b8c34fcbc7
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmInputTest extends LcmBeanTest {
+ private static String expectedLcmInput = "{" + "\"common-header\":{" + "\"api-ver\":\"2.00\","
+ + "\"flags\":{\"mode\":\"NORMAL\",\"force\":\"FALSE\",\"ttl\":65000}," + "\"originator-id\":\"MSO\","
+ + "\"request-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0\","
+ + "\"sub-request-id\":\"c197a4b5-18d9-48a2-ad2d-a3b56858501c\","
+ + "\"timestamp\":\"2020-02-25T10:20:28.116Z\"" + "}," + "\"action\":\"TestAction\","
+ + "\"action-identifiers\":{\"pnf-name\":\"testpnf\"},"
+ + "\"payload\":\"{\\\"testPayload\\\": \\\"input test\\\"}\"}";
+
+ public LcmInput buildLcmInput() {
+ LcmInput lcmInput = new LcmInput();
+
+ LcmCommonHeader lcmCommonHeader = buildLcmCommonHeader();
+
+ LcmActionIdentifiers lcmActionIdentifiers = new LcmActionIdentifiers();
+ lcmActionIdentifiers.setPnfName(pnfName);
+
+ lcmInput.setCommonHeader(lcmCommonHeader);
+ lcmInput.setAction(action);
+ lcmInput.setActionIdentifiers(lcmActionIdentifiers);
+ lcmInput.setPayload(inputPayload);
+
+ return lcmInput;
+ }
+
+ public static String getExpectedLcmInput() {
+ return expectedLcmInput;
+ }
+
+ @Test
+ public final void testLcmInput() {
+ LcmInput lcmInput = buildLcmInput();
+
+ try {
+ String lcmInputString = convertToSting(lcmInput);
+ assertEquals(expectedLcmInput, lcmInputString);
+ } catch (Exception e) {
+ fail("Convert LcmInput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java
new file mode 100644
index 0000000000..1530be38a7
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+
+public class LcmOutputTest extends LcmBeanTest {
+ private static String expectedLcmOutput = "{" + "\"common-header\":{" + "\"api-ver\":\"2.00\","
+ + "\"originator-id\":\"MSO\"," + "\"request-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0\","
+ + "\"sub-request-id\":\"c197a4b5-18d9-48a2-ad2d-a3b56858501c\"" + "},"
+ + "\"status\":{\"code\":400,\"message\":\"Test output message\"},"
+ + "\"payload\":\"{\\\"testPayload\\\": \\\"output test\\\"}\"}";
+
+ @Override
+ public LcmCommonHeader buildLcmCommonHeader() {
+ LcmCommonHeader lcmCommonHeader = new LcmCommonHeader();
+
+ lcmCommonHeader.setApiVer(SDNCConstants.LCM_API_VER);
+ lcmCommonHeader.setOriginatorId(SDNCConstants.SYSTEM_NAME);
+ lcmCommonHeader.setRequestId(requestId);
+ lcmCommonHeader.setSubRequestId(subRequestId);
+
+ return lcmCommonHeader;
+ }
+
+ public LcmStatus buildLcmStatus() {
+ LcmStatus lcmStatus = new LcmStatus();
+
+ lcmStatus.setCode(400);
+ lcmStatus.setMessage("Test output message");
+
+ return lcmStatus;
+ }
+
+ public LcmOutput buildLcmOutput() {
+ LcmOutput lcmOutput = new LcmOutput();
+
+ LcmCommonHeader lcmCommonHeader = buildLcmCommonHeader();
+ LcmStatus lcmStatus = buildLcmStatus();
+
+ lcmOutput.setCommonHeader(lcmCommonHeader);
+ lcmOutput.setStatus(lcmStatus);
+ lcmOutput.setPayload(outputPayload);
+
+ return lcmOutput;
+ }
+
+ public static String getExpectedLcmOutput() {
+ return expectedLcmOutput;
+ }
+
+ @Test
+ public final void testLcmOutput() {
+ LcmOutput lcmOutput = buildLcmOutput();
+
+ try {
+ String lcmOutputString = convertToSting(lcmOutput);
+ assertEquals(expectedLcmOutput, lcmOutputString);
+ } catch (Exception e) {
+ fail("Convert LcmOutput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java
new file mode 100644
index 0000000000..c078326c82
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmRestRequestTest extends LcmBeanTest {
+ private static String expectedLcmRestRequest = "{" + "\"input\":" + LcmInputTest.getExpectedLcmInput() + "}";
+
+ public LcmRestRequest buildLcmRestRequest() {
+ LcmRestRequest lcmRestRequest = new LcmRestRequest();
+
+ LcmInputTest lcmInputTest = new LcmInputTest();
+ lcmRestRequest.setInput(lcmInputTest.buildLcmInput());
+
+ return lcmRestRequest;
+ }
+
+ public static String getExpectedLcmRestRequest() {
+ return expectedLcmRestRequest;
+ }
+
+ @Test
+ public final void testLcmRestRequest() {
+ LcmRestRequest lcmRestRequest = buildLcmRestRequest();
+
+ try {
+ String lcmRestRequestString = convertToSting(lcmRestRequest);
+ assertEquals(expectedLcmRestRequest, lcmRestRequestString);
+ } catch (Exception e) {
+ fail("Convert LcmRestRequest to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java
new file mode 100644
index 0000000000..5867acb421
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmRestResponseTest extends LcmBeanTest {
+ private static String expectedLcmRestResponse = "{" + "\"output\":" + LcmOutputTest.getExpectedLcmOutput() + "}";
+
+ public LcmRestResponse buildLcmRestResponse() {
+ LcmRestResponse lcmRestResponse = new LcmRestResponse();
+
+ LcmOutputTest lcmOutputTest = new LcmOutputTest();
+ lcmRestResponse.setOutput(lcmOutputTest.buildLcmOutput());
+
+ return lcmRestResponse;
+ }
+
+ public static String getExpectedLcmRestResponse() {
+ return expectedLcmRestResponse;
+ }
+
+ @Test
+ public final void testLcmRestResponse() {
+ LcmRestResponse lcmRestResponse = buildLcmRestResponse();
+
+ try {
+ String lcmRestResponseString = convertToSting(lcmRestResponse);
+ assertEquals(expectedLcmRestResponse, lcmRestResponseString);
+ } catch (Exception e) {
+ fail("Convert LcmRestResponse to String error: " + e.toString());
+ }
+ }
+}