aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java/org')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java52
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java82
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java42
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java56
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java56
6 files changed, 289 insertions, 1 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
index 5483792a84..3757769769 100644
--- 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
@@ -42,7 +42,7 @@ public class SDNCLcmDmaapClientTest extends BaseTest {
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 static final String DMAAP_PARTITION_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_PARTITION;
protected String testWriteTopic = "TEST-WRITE-TOPIC";
protected String testReadTopic = "TEST-READ-TOPIC";
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java
new file mode 100644
index 0000000000..bee07f2022
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java
@@ -0,0 +1,52 @@
+/*-
+ * ============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.payload;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class ActivateNESwPayloadTest extends LcmBasePayloadTest {
+ private static String expectedActivateNESwPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\","
+ + "\"playbook-name\":\"test_playbook\"," + "\"swVersionToBeActivated\":\"v2\"" + "}";
+
+ public ActivateNESwPayload buildActivateNESwPayload() {
+ ActivateNESwPayload activateNESwPayload = new ActivateNESwPayload();
+
+ activateNESwPayload.setIpaddressV4Oam(ipaddressV4Oam);
+ activateNESwPayload.setPlaybookName(playbookName);
+ activateNESwPayload.setSwVersionToBeActivated("v2");
+
+ return activateNESwPayload;
+ }
+
+ @Test
+ public final void testActivateNESwPayload() {
+ ActivateNESwPayload activateNESwPayload = buildActivateNESwPayload();
+
+ try {
+ String activateNESwPayloadString = convertToSting(activateNESwPayload);
+ assertEquals(expectedActivateNESwPayload, activateNESwPayloadString);
+ } catch (Exception e) {
+ fail("Convert ActivateNESwPayload to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java
new file mode 100644
index 0000000000..f9fa679790
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java
@@ -0,0 +1,82 @@
+/*-
+ * ============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.payload;
+
+import java.util.Collections;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class DownloadNESwPayloadTest extends LcmBasePayloadTest {
+ private static String expectedSwToBeDownloadedElement = "{" + "\"swLocation\":\"http://192.168.1.20/test.zip\","
+ + "\"swFileSize\":123456," + "\"swFileCompression\":\"ZIP\"," + "\"swFileFormat\":\"binary\"" + "}";
+
+ private static String expectedDownloadNESwPayload =
+ "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + "\"playbook-name\":\"test_playbook\","
+ + "\"swToBeDownloaded\":[" + expectedSwToBeDownloadedElement + "]" + "}";
+
+ public SwToBeDownloadedElement buildSwToBeDownloadedElement() {
+ SwToBeDownloadedElement swToBeDownloadedElement = new SwToBeDownloadedElement();
+
+ swToBeDownloadedElement.setSwLocation("http://192.168.1.20/test.zip");
+ swToBeDownloadedElement.setSwFileSize(123456);
+ swToBeDownloadedElement.setSwFileCompression("ZIP");
+ swToBeDownloadedElement.setSwFileFormat("binary");
+
+ return swToBeDownloadedElement;
+ }
+
+ public DownloadNESwPayload buildDownloadNESwPayload() {
+ DownloadNESwPayload downloadNESwPayload = new DownloadNESwPayload();
+
+ downloadNESwPayload.setIpaddressV4Oam(ipaddressV4Oam);
+ downloadNESwPayload.setPlaybookName(playbookName);
+
+ SwToBeDownloadedElement swToBeDownloadedElement = buildSwToBeDownloadedElement();
+ downloadNESwPayload.setSwToBeDownloaded(Collections.singletonList(swToBeDownloadedElement));
+
+ return downloadNESwPayload;
+ }
+
+ @Test
+ public final void testSwToBeDownloadedElement() {
+ SwToBeDownloadedElement swToBeDownloadedElement = buildSwToBeDownloadedElement();
+
+ try {
+ String swToBeDownloadedElementString = convertToSting(swToBeDownloadedElement);
+ assertEquals(expectedSwToBeDownloadedElement, swToBeDownloadedElementString);
+ } catch (Exception e) {
+ fail("Convert SwToBeDownloadedElement to String error: " + e.toString());
+ }
+ }
+
+ @Test
+ public final void testDownloadNESwPayload() {
+ DownloadNESwPayload downloadNESwPayload = buildDownloadNESwPayload();
+
+ try {
+ String downloadNESwPayloadString = convertToSting(downloadNESwPayload);
+ assertEquals(expectedDownloadNESwPayload, downloadNESwPayloadString);
+ } catch (Exception e) {
+ fail("Convert DownloadNESwPayload to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java
new file mode 100644
index 0000000000..5452166d03
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============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.payload;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LcmBasePayloadTest {
+ private static Logger logger = LoggerFactory.getLogger(LcmBasePayloadTest.class);
+
+ protected String ipaddressV4Oam = "192.168.1.10";
+ protected String playbookName = "test_playbook";
+
+ 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/payload/UpgradePostCheckPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java
new file mode 100644
index 0000000000..acd447e890
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.payload;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class UpgradePostCheckPayloadTest extends LcmBasePayloadTest {
+ private static String expectedUpgradePostCheckPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\","
+ + "\"playbook-name\":\"test_playbook\"," + "\"oldSwVersion\":\"v1\"," + "\"targetSwVersion\":\"v2\","
+ + "\"ruleName\":\"r102\"," + "\"additionalData\":\"{}\"" + "}";
+
+ public UpgradePostCheckPayload buildUpgradePostCheckPayload() {
+ UpgradePostCheckPayload upgradePostCheckPayload = new UpgradePostCheckPayload();
+
+ upgradePostCheckPayload.setIpaddressV4Oam(ipaddressV4Oam);
+ upgradePostCheckPayload.setPlaybookName(playbookName);
+ upgradePostCheckPayload.setOldSwVersion("v1");
+ upgradePostCheckPayload.setTargetSwVersion("v2");
+ upgradePostCheckPayload.setRuleName("r102");
+ upgradePostCheckPayload.setAdditionalData("{}");
+
+ return upgradePostCheckPayload;
+ }
+
+ @Test
+ public final void testUpgradePostCheckPayload() {
+ UpgradePostCheckPayload upgradePostCheckPayload = buildUpgradePostCheckPayload();
+
+ try {
+ String upgradePostCheckPayloadString = convertToSting(upgradePostCheckPayload);
+ assertEquals(expectedUpgradePostCheckPayload, upgradePostCheckPayloadString);
+ } catch (Exception e) {
+ fail("Convert UpgradePostCheckPayload to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java
new file mode 100644
index 0000000000..8bc0714fff
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.payload;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class UpgradePreCheckPayloadTest extends LcmBasePayloadTest {
+ private static String expectedUpgradePreCheckPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\","
+ + "\"playbook-name\":\"test_playbook\"," + "\"oldSwVersion\":\"v1\"," + "\"targetSwVersion\":\"v2\","
+ + "\"ruleName\":\"r101\"," + "\"additionalData\":\"{}\"" + "}";
+
+ public UpgradePreCheckPayload buildUpgradePreCheckPayload() {
+ UpgradePreCheckPayload upgradePreCheckPayload = new UpgradePreCheckPayload();
+
+ upgradePreCheckPayload.setIpaddressV4Oam(ipaddressV4Oam);
+ upgradePreCheckPayload.setPlaybookName(playbookName);
+ upgradePreCheckPayload.setOldSwVersion("v1");
+ upgradePreCheckPayload.setTargetSwVersion("v2");
+ upgradePreCheckPayload.setRuleName("r101");
+ upgradePreCheckPayload.setAdditionalData("{}");
+
+ return upgradePreCheckPayload;
+ }
+
+ @Test
+ public final void testUpgradePreCheckPayload() {
+ UpgradePreCheckPayload upgradePreCheckPayload = buildUpgradePreCheckPayload();
+
+ try {
+ String upgradePreCheckPayloadString = convertToSting(upgradePreCheckPayload);
+ assertEquals(expectedUpgradePreCheckPayload, upgradePreCheckPayloadString);
+ } catch (Exception e) {
+ fail("Convert UpgradePreCheckPayload to String error: " + e.toString());
+ }
+ }
+}