Fixing JSONParser for JSONArray element 25/99825/1
authorSingal, Kapil (ks220y) <ks220y@att.com>
Thu, 19 Dec 2019 16:07:59 +0000 (11:07 -0500)
committerSingal, Kapil (ks220y) <ks220y@att.com>
Thu, 19 Dec 2019 16:07:59 +0000 (11:07 -0500)
Refactoring Related JUnit and fixing test JSON Files

Change-Id: I1cd7ba04f53798e4b3f5451de6bfed24054d3ea5
Issue-ID: CCSDK-2008
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
29 files changed:
restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java
restapi-call-node/provider/src/main/resources/actokentemplate.json
restapi-call-node/provider/src/main/resources/default-ueb-message.json
restapi-call-node/provider/src/main/resources/get-multicast-data.json
restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json
restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json
restapi-call-node/provider/src/main/resources/l3smsitetemplate.json
restapi-call-node/provider/src/main/resources/l3smvpntemplate.json
restapi-call-node/provider/src/main/resources/l3smvrftemplate.json
restapi-call-node/provider/src/main/resources/northbound-api-template.json
restapi-call-node/provider/src/main/resources/service-configuration-notification-northbound-template.json
restapi-call-node/provider/src/main/resources/sptn-l3vpn-template.json
restapi-call-node/provider/src/main/resources/update-vpe-data-with-apply-group.json
restapi-call-node/provider/src/main/resources/vnf-information-update.json
restapi-call-node/provider/src/main/resources/vpn-allocation-request.json
restapi-call-node/provider/src/main/resources/vpn-information-update.json
restapi-call-node/provider/src/main/resources/vrf-service-configuration-information-template.json
restapi-call-node/provider/src/main/resources/vrf-update-vlan-status-template.json
restapi-call-node/provider/src/main/resources/vrf-update.json
restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java
restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
restapi-call-node/provider/src/test/resources/actokentemplate.json
restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json
restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json
restapi-call-node/provider/src/test/resources/l3smsitetemplate.json
restapi-call-node/provider/src/test/resources/l3smvpntemplate.json
restapi-call-node/provider/src/test/resources/l3smvrftemplate.json
restapi-call-node/provider/src/test/resources/test-template.json
restapi-call-node/provider/src/test/resources/test.json

index 910baf5..4c3ba7f 100644 (file)
@@ -10,7 +10,7 @@
  * 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.
 
 package org.onap.ccsdk.sli.plugins.restapicall;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
@@ -35,6 +32,8 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 public final class JsonParser {
 
     private static final Logger log = LoggerFactory.getLogger(JsonParser.class);
@@ -45,34 +44,51 @@ public final class JsonParser {
 
     @SuppressWarnings("unchecked")
     public static Map<String, String> convertToProperties(String s)
-        throws SvcLogicException {
+            throws SvcLogicException {
 
         checkNotNull(s, "Input should not be null.");
 
         try {
-            JSONObject json = null;
+            Map<String, Object> wm = new HashMap<>();
+            String topLvlArrLength = null;
+            JSONObject json;
+            JSONArray jsonArr;
             //support top level list in json response
             if (s.startsWith("[")) {
-                JSONArray jsonArr = new JSONArray(s);
-                json = jsonArr.getJSONObject(0);
+                jsonArr = new JSONArray(s);
+                topLvlArrLength = String.valueOf(jsonArr.length());
+                for (int i = 0, length = jsonArr.length(); i < length; i++) {
+                    json = jsonArr.getJSONObject(i);
+                    Iterator<String> ii = json.keys();
+                    while (ii.hasNext()) {
+                        String key = ii.next();
+                        String key1 = "[" + i + "]." + key;
+                        String[] subKey = key1.split(":");
+                        if (subKey.length == 2) {
+                            wm.put(subKey[1], json.get(key));
+                        } else {
+                            wm.put(key1, json.get(key));
+                        }
+                    }
+                }
             } else {
                 json = new JSONObject(s);
-            }
-
-            Map<String, Object> wm = new HashMap<>();
-            Iterator<String> ii = json.keys();
-            while (ii.hasNext()) {
-                String key1 = ii.next();
-                String[] subKey = key1.split(":");
-                if (subKey.length == 2) {
-                    wm.put(subKey[1], json.get(key1));
-                } else {
-                    wm.put(key1, json.get(key1));
+                Iterator<String> ii = json.keys();
+                while (ii.hasNext()) {
+                    String key1 = ii.next();
+                    String[] subKey = key1.split(":");
+                    if (subKey.length == 2) {
+                        wm.put(subKey[1], json.get(key1));
+                    } else {
+                        wm.put(key1, json.get(key1));
+                    }
                 }
             }
 
             Map<String, String> mm = new HashMap<>();
-
+            if (topLvlArrLength != null) {
+                mm.put("_length", topLvlArrLength);
+            }
             while (!wm.isEmpty()) {
                 for (String key : new ArrayList<>(wm.keySet())) {
                     Object o = wm.get(key);
@@ -111,4 +127,5 @@ public final class JsonParser {
             throw new SvcLogicException("Unable to convert JSON to properties" + e.getLocalizedMessage(), e);
         }
     }
+
 }
index 31bf0ee..02e6240 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "userName": ${prop.sdncRestApi.thirdpartySdnc.user},
   "password": ${prop.sdncRestApi.thirdpartySdnc.password}
index 6ef6be7..484d872 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
     "event":{
         "header":{
index f6155ee..3b9997f 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "input": {
     "sdnc-request-header": {
index f180756..e0896bb 100644 (file)
@@ -1,21 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "l2-dci-connect": {
     "id": ${prop.dci-connects.id},
index c011b07..41df794 100644 (file)
@@ -1,23 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 Intel Corp. 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=========================================================
- */
-
 {
   "l3-dci-connect": {
     "id": ${prop.dci-connects.id},
index 016879c..8f81566 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "site":[
   {
index 67f127c..30f30a2 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "vpn-service": [
     {
index 732af27..52359a7 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
     "vrf-attribute": [
         {
index 73a61b6..f185c8f 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
 "input":
             {
index 0cb7d0b..c646617 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "input": {
     "svc-request-id": ${service-configuration-notification-input.svc-request-id},
index 9e1e920..e850cb9 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "snc-l3vpn": {
     "-xmlns": "urn:chinamobile:l3vpn",
index a82a6b4..9798575 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "vrf-export-details": [
   ${repeat:restapi-result.ApplyGroupResponse.ApplyGroupResponseData[0].VrfDetails.VrfExport_length:
index 425f0f3..d554624 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
 "generic-vnf-service" :${vnf-service.generic-vnf-service}
 }
index 6c84274..7a689bd 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "AllocateVpnResourcesRequest": {
     "message-id": "${service-data.oper-status.modify-timestamp}",
index 7977066..3ac16e2 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-{ 
-"vpn-information" :${vpe-vpn-service.vpn-information} 
+{
+"vpn-information" :${vpe-vpn-service.vpn-information}
 }
index f7e8432..c6defb4 100644 (file)
@@ -1,32 +1,11 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "input": {
-  
+
     "e2e-vpn-key": ${service-data.avpn-logicalchannel-information.e2e-vpn-id},
     "logical-channel-id": ${service-data.service-information.service-instance-id},
     "vpe-name": ${service-data.avpn-logicalchannel-information.evc-endpoint-information.vpe-name},
     "rpc-action": ${tmp.rpc-action},
-    
+
     "vpn-information": ${vpe-vpn-service.vpn-information},
     "vrf-details": ${vpe-vpn-service.vpn-information.vrf-details},
     "vrf-vlan-resources": {
index 7a6cab3..f638125 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "input": {
     "e2e-vpn-key": ${service-data.avpn-logicalchannel-information.e2e-vpn-id},
index 778e4b2..cdaef4d 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "vpn-vame": ${allocate-vpn-resource-notification-input.vpn-data[0].vpn-name},
   "vpn-id": ${allocate-vpn-resource-notification-input.vpn-data[0].vpn-id},
@@ -63,7 +42,7 @@
   "spoke-routes": {
     "route-target": ${allocate-vpn-resource-notification-input.vpn-data[0].spoke-route-target.route-target}
   },
-  
+
    "route-target-details": [
   ${repeat:allocate-vpn-resource-notification-input.vpn-data[0].route-target-details_length:
     {
@@ -72,6 +51,6 @@
     }
     }
   ],
-  
+
   "e2e-vpn-key": ${allocate-vpn-resource-notification-input.vpn-data[0].e2e-vpn-id}
 }
index 21b66b2..569719d 100644 (file)
@@ -8,9 +8,9 @@
  * 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.
@@ -68,14 +68,7 @@ public class TestJsonParser {
         String path = "src/test/resources/ArrayMenu.json";
         String content = new String(Files.readAllBytes(Paths.get(path)));
         Map<String, String> mm = JsonParser.convertToProperties(content);
-        assertEquals("plain", mm.get("name"));
-        assertEquals("true", mm.get("vegetarian"));
-        assertEquals("1", mm.get("id"));
-        assertEquals("1000", mm.get("calories"));
-        assertEquals("pizza", mm.get("type"));
-
-        // The below statements are how I expected it to work, but it does not work this way
-/*
+
         assertEquals("1000", mm.get("[0].calories"));
         assertEquals("1", mm.get("[0].id"));
         assertEquals("plain", mm.get("[0].name"));
@@ -104,7 +97,6 @@ public class TestJsonParser {
         assertEquals("pizza", mm.get("[2].type"));
         assertEquals("true", mm.get("[2].vegetarian"));
         assertEquals("3", mm.get("_length"));
-*/
     }
 
     @Test
@@ -222,8 +214,8 @@ public class TestJsonParser {
 
         // Break the embedded json object into properties
         mm = JsonParser.convertToProperties(mm.get("input.parameters[0].value"));
-        assertEquals("0.2.0.0/16", mm.get("id"));
-        // assertEquals("ge04::/64", mm.get("id")); this second value gets lost
+        assertEquals("0.2.0.0/16", mm.get("[0].id"));
+        assertEquals("ge04::/64", mm.get("[1].id"));
     }
 
 }
index 0704d29..8cabaad 100755 (executable)
@@ -29,15 +29,11 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.codehaus.jettison.json.JSONObject;
-import org.glassfish.grizzly.http.server.HttpServer;
-import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
-import org.glassfish.jersey.media.multipart.MultiPartFeature;
-import org.glassfish.jersey.server.ResourceConfig;
 
+import org.junit.Before;
 import org.junit.Test;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,6 +42,11 @@ public class TestRestapiCallNode {
     @SuppressWarnings("unused")
     private static final Logger log = LoggerFactory.getLogger(TestRestapiCallNode.class);
 
+    @Before
+    public void init() {
+        System.setProperty("SDNC_CONFIG_DIR", "src/test/resources");
+    }
+
     @Test
     public void testDelete() throws SvcLogicException {
         SvcLogicContext ctx = new SvcLogicContext();
@@ -476,7 +477,7 @@ public class TestRestapiCallNode {
         assertEquals(partnerTwoUsername,details.username);
         assertEquals(partnerTwoPassword,details.password);
         assertNull(rcn.partnerStore.get("partnerThree"));
-        
+
         //In this scenario the caller expects username, password and url to be picked up from the partners json
         Map<String, String> paramMap = new HashMap<String,String>();
         paramMap.put("partner", partnerTwoKey);
@@ -497,7 +498,7 @@ public class TestRestapiCallNode {
         assertEquals(partnerTwoPassword,p.restapiPassword);
         assertEquals("http://localhost:7002/networking/v1/instance/3",p.restapiUrl);
     }
-    
+
     @Test
     public void retryPolicyBean() throws Exception {
        Integer retries = 3;
index 31bf0ee..02e6240 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "userName": ${prop.sdncRestApi.thirdpartySdnc.user},
   "password": ${prop.sdncRestApi.thirdpartySdnc.password}
index f180756..e0896bb 100644 (file)
@@ -1,21 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "l2-dci-connect": {
     "id": ${prop.dci-connects.id},
index c011b07..41df794 100644 (file)
@@ -1,23 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 Intel Corp. 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=========================================================
- */
-
 {
   "l3-dci-connect": {
     "id": ${prop.dci-connects.id},
index 016879c..8f81566 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "site":[
   {
index 67f127c..30f30a2 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "vpn-service": [
     {
index 732af27..52359a7 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
     "vrf-attribute": [
         {
index faefef3..ae519a7 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
   "sdn-circuit-request": [
     ${repeat:tmp.sdn-circuit-req-row_length:
index b48eb6b..7515539 100644 (file)
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
 {
     "equipment-data": [
         {