aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/test
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-20 16:10:18 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-21 14:40:34 -0500
commit63bee11f255fcd2cc39a3d87c208aa6e517a8f85 (patch)
treed7b13599feffd4cc2cfd9836e83385c32869b448 /common/src/test
parent9756b9992858a5f513953f1d16b4d9b396a8397a (diff)
Bug fixes from AT&T January 20th
sorted vfmodules by base last for negative action reqs store Response in execution as String on network delete added functionality to skip rollback based on flag # Conflicts: # bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflo w/tasks/WorkflowAction.java require XML in the header for delete network request Update APP-C LCM Client library version to 1.7.0. replaced wiremock style test with mockito test Handle AAIClient Exps in CreateCustomerV1 getServiceInstance() changed default status code to be configurable Replace vnfType by nfRole in the healthcheck request to SDNO. updated error messages in sdnc handler and flow status updated flow status message on completion of flow Send GenericVnf object for AAI VNF update for vnf-api updates Add a JUnit test file for SDNOValidatorImpl.java Set nodeType on the inner SDNO request as per update from SDNO. updated rollbackToAssigned logic to remove unassign flows updated sdnc handler error message for client error added exception handling for httpclienterror in sdnc out map workflow exception so error is reported throws sdnc error message on bad response from sdnc add catalog entries for TRANSPORT service delete flows change script number that was duplicate add find method to NorthBoundRequestRepository include serviceType in hash code use asterisk for all non-TRANSPORT flow db entries alacart true, rm not needed transport srvc model steps correct insert query syntax for orchestration_flow support serviceType (TRANSPORT) process flow fix SDNCAdapterException causing no callback to bpmn use JsonAlias for alternate case when deserializing GRM client will accept both "serviceEndPointList" and "ServiceEndPointList" root node in the JSON response. AAIRestClient now uses getSystemName in headers finishtime should not be returned in requeststatus Change-Id: I81a185252b057020f7f36f125c85c3357756da88 Issue-ID: SO-1403 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'common/src/test')
-rw-r--r--common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java24
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java57
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java2
-rw-r--r--common/src/test/resources/__files/grm/endpoints2.json145
4 files changed, 227 insertions, 1 deletions
diff --git a/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java b/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java
index a1fb43ea5e..d0d0e6701b 100644
--- a/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java
+++ b/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java
@@ -58,6 +58,30 @@ public class ServiceEndPointListTest {
assertEquals("DEV", se.getProperties().get(0).getValue());
}
+ @Test
+ public void testUnmarshallServiceEndpointListStartsWithUppercase() throws Exception {
+ String endpointsJson = getFileContentsAsString("__files/grm/endpoints2.json");
+ ServiceEndPointList sel = mapper.readValue(endpointsJson, ServiceEndPointList.class);
+
+ List<ServiceEndPoint> list = sel.getServiceEndPointList();
+ ServiceEndPoint se = list.get(0);
+
+ assertEquals(3, list.size());
+ assertEquals("dummy.pod.ns.dummy-pod3", se.getName());
+ assertEquals(Integer.valueOf(1), Integer.valueOf(se.getVersion().getMajor()));
+ assertEquals(Integer.valueOf(0), Integer.valueOf(se.getVersion().getMinor()));
+ assertEquals(Integer.valueOf(0), Integer.valueOf(se.getVersion().getPatch()));
+ assertEquals("192.168.120.218", se.getHostAddress());
+ assertEquals("32004", se.getListenPort());
+ assertEquals("37.7022", se.getLatitude());
+ assertEquals("121.9358", se.getLongitude());
+ assertEquals("/", se.getContextPath());
+ assertEquals("edge", se.getOperationalInfo().getCreatedBy());
+ assertEquals("edge", se.getOperationalInfo().getUpdatedBy());
+ assertEquals("Environment", se.getProperties().get(0).getName());
+ assertEquals("DEV", se.getProperties().get(0).getValue());
+ }
+
protected String getFileContentsAsString(String fileName) {
String content = "";
diff --git a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
new file mode 100644
index 0000000000..79ce196bd3
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.sdno;
+
+import static org.junit.Assert.assertEquals;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.so.client.sdno.beans.RequestHealthDiagnostic;
+import org.onap.so.client.sdno.beans.SDNO;
+
+public class SDNOValidatorImplTest {
+
+ @Test
+ public void buildRequestDiagnosticTest() throws Exception {
+ SDNOValidatorImpl validator = new SDNOValidatorImpl();
+ UUID uuid = UUID.randomUUID();
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfName("VNFNAME");
+ vnf.setVnfId("test");
+ vnf.setIpv4OamAddress("1.2.3.4");
+ vnf.setNfRole("VPE");
+ SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
+ assertEquals(request.getNodeType(), "VPE");
+ assertEquals(request.getOperation(), "health-diagnostic");
+
+ RequestHealthDiagnostic innerRequest = request.getBody().getInput().getRequestHealthDiagnostic();
+ assertEquals(innerRequest.getRequestClientName(), "MSO");
+ assertEquals(innerRequest.getRequestNodeName(), "VNFNAME");
+ assertEquals(innerRequest.getRequestNodeUuid(), "test");
+ assertEquals(innerRequest.getRequestNodeType(), "VPE");
+ assertEquals(innerRequest.getRequestNodeIp(), "1.2.3.4");
+ assertEquals(innerRequest.getRequestUserId(), "mechid");
+ assertEquals(innerRequest.getRequestId(), uuid.toString());
+ assertEquals(innerRequest.getHealthDiagnosticCode(), "default");
+
+ }
+}
diff --git a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
index d66f5f64f7..9794c9b622 100644
--- a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
@@ -100,7 +100,7 @@ public class SDNOValidatorTest {
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("test");
vnf.setIpv4OamAddress("1.2.3.4");
- vnf.setVnfType("VPE");
+ vnf.setNfRole("VPE");
SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(request);
diff --git a/common/src/test/resources/__files/grm/endpoints2.json b/common/src/test/resources/__files/grm/endpoints2.json
new file mode 100644
index 0000000000..7c9816ff55
--- /dev/null
+++ b/common/src/test/resources/__files/grm/endpoints2.json
@@ -0,0 +1,145 @@
+{
+ "ServiceEndPointList": [
+ {
+ "name": "dummy.pod.ns.dummy-pod3",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "192.168.120.218",
+ "listenPort": "32004",
+ "latitude": "37.7022",
+ "longitude": "121.9358",
+ "registrationTime": "2017-07-18T15:39:17.367+0000",
+ "expirationTime": "9999-10-09T15:39:17.368+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:17.367+0000",
+ "updatedTimestamp": "2017-07-18T15:39:17.367+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ },
+ {
+ "name": "dummy.pod.ns.dummy-pod3",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "192.168.120.22",
+ "listenPort": "32004",
+ "latitude": "1.0",
+ "longitude": "1.0",
+ "registrationTime": "2017-07-18T15:39:17.816+0000",
+ "expirationTime": "9999-10-09T15:39:17.817+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:17.816+0000",
+ "updatedTimestamp": "2017-07-18T15:39:17.816+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ },
+ {
+ "name": "dummy.pod.ns.dummy-pod1",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "192.168.120.218",
+ "listenPort": "32002",
+ "latitude": "1.0",
+ "longitude": "1.0",
+ "registrationTime": "2017-07-18T15:39:14.443+0000",
+ "expirationTime": "9999-10-09T15:39:14.453+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:14.443+0000",
+ "updatedTimestamp": "2017-07-18T15:39:14.443+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ }
+ ]
+} \ No newline at end of file