summaryrefslogtreecommitdiffstats
path: root/restapi-call-node/provider
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2019-12-19 11:07:59 -0500
committerSingal, Kapil (ks220y) <ks220y@att.com>2019-12-19 11:07:59 -0500
commitc185a9bf56303dc4ad9feb4ba5b6227a038f4153 (patch)
tree38cacc09ba79d7405569a75b4fba5476c51e67f7 /restapi-call-node/provider
parent767b8eac24dba80a8aa815879c13b721015b7ab4 (diff)
Fixing JSONParser for JSONArray element
Refactoring Related JUnit and fixing test JSON Files Change-Id: I1cd7ba04f53798e4b3f5451de6bfed24054d3ea5 Issue-ID: CCSDK-2008 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Diffstat (limited to 'restapi-call-node/provider')
-rw-r--r--restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java57
-rw-r--r--restapi-call-node/provider/src/main/resources/actokentemplate.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/default-ueb-message.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/get-multicast-data.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json18
-rw-r--r--restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json20
-rw-r--r--restapi-call-node/provider/src/main/resources/l3smsitetemplate.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/l3smvpntemplate.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/l3smvrftemplate.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/northbound-api-template.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/service-configuration-notification-northbound-template.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/sptn-l3vpn-template.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/update-vpe-data-with-apply-group.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/vnf-information-update.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/vpn-allocation-request.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/vpn-information-update.json25
-rw-r--r--restapi-call-node/provider/src/main/resources/vrf-service-configuration-information-template.json25
-rw-r--r--restapi-call-node/provider/src/main/resources/vrf-update-vlan-status-template.json21
-rw-r--r--restapi-call-node/provider/src/main/resources/vrf-update.json25
-rw-r--r--restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java18
-rwxr-xr-xrestapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java15
-rw-r--r--restapi-call-node/provider/src/test/resources/actokentemplate.json21
-rw-r--r--restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json18
-rw-r--r--restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json20
-rw-r--r--restapi-call-node/provider/src/test/resources/l3smsitetemplate.json21
-rw-r--r--restapi-call-node/provider/src/test/resources/l3smvpntemplate.json21
-rw-r--r--restapi-call-node/provider/src/test/resources/l3smvrftemplate.json21
-rw-r--r--restapi-call-node/provider/src/test/resources/test-template.json21
-rw-r--r--restapi-call-node/provider/src/test/resources/test.json21
29 files changed, 56 insertions, 584 deletions
diff --git a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java
index 910baf52b..4c3ba7f8e 100644
--- a/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java
+++ b/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/JsonParser.java
@@ -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.
@@ -21,13 +21,10 @@
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);
}
}
+
}
diff --git a/restapi-call-node/provider/src/main/resources/actokentemplate.json b/restapi-call-node/provider/src/main/resources/actokentemplate.json
index 31bf0ee2b..02e62400f 100644
--- a/restapi-call-node/provider/src/main/resources/actokentemplate.json
+++ b/restapi-call-node/provider/src/main/resources/actokentemplate.json
@@ -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}
diff --git a/restapi-call-node/provider/src/main/resources/default-ueb-message.json b/restapi-call-node/provider/src/main/resources/default-ueb-message.json
index 6ef6be7f6..484d872f5 100644
--- a/restapi-call-node/provider/src/main/resources/default-ueb-message.json
+++ b/restapi-call-node/provider/src/main/resources/default-ueb-message.json
@@ -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":{
diff --git a/restapi-call-node/provider/src/main/resources/get-multicast-data.json b/restapi-call-node/provider/src/main/resources/get-multicast-data.json
index f6155ee32..3b9997f64 100644
--- a/restapi-call-node/provider/src/main/resources/get-multicast-data.json
+++ b/restapi-call-node/provider/src/main/resources/get-multicast-data.json
@@ -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": {
diff --git a/restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json b/restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json
index f18075686..e0896bbaa 100644
--- a/restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json
+++ b/restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json
@@ -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},
diff --git a/restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json b/restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json
index c011b077b..41df794fd 100644
--- a/restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json
+++ b/restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json
@@ -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},
diff --git a/restapi-call-node/provider/src/main/resources/l3smsitetemplate.json b/restapi-call-node/provider/src/main/resources/l3smsitetemplate.json
index 016879c3c..8f8156698 100644
--- a/restapi-call-node/provider/src/main/resources/l3smsitetemplate.json
+++ b/restapi-call-node/provider/src/main/resources/l3smsitetemplate.json
@@ -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":[
{
diff --git a/restapi-call-node/provider/src/main/resources/l3smvpntemplate.json b/restapi-call-node/provider/src/main/resources/l3smvpntemplate.json
index 67f127ce9..30f30a24f 100644
--- a/restapi-call-node/provider/src/main/resources/l3smvpntemplate.json
+++ b/restapi-call-node/provider/src/main/resources/l3smvpntemplate.json
@@ -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": [
{
diff --git a/restapi-call-node/provider/src/main/resources/l3smvrftemplate.json b/restapi-call-node/provider/src/main/resources/l3smvrftemplate.json
index 732af278c..52359a7fd 100644
--- a/restapi-call-node/provider/src/main/resources/l3smvrftemplate.json
+++ b/restapi-call-node/provider/src/main/resources/l3smvrftemplate.json
@@ -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": [
{
diff --git a/restapi-call-node/provider/src/main/resources/northbound-api-template.json b/restapi-call-node/provider/src/main/resources/northbound-api-template.json
index 73a61b636..f185c8f5d 100644
--- a/restapi-call-node/provider/src/main/resources/northbound-api-template.json
+++ b/restapi-call-node/provider/src/main/resources/northbound-api-template.json
@@ -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":
{
diff --git a/restapi-call-node/provider/src/main/resources/service-configuration-notification-northbound-template.json b/restapi-call-node/provider/src/main/resources/service-configuration-notification-northbound-template.json
index 0cb7d0b06..c64661720 100644
--- a/restapi-call-node/provider/src/main/resources/service-configuration-notification-northbound-template.json
+++ b/restapi-call-node/provider/src/main/resources/service-configuration-notification-northbound-template.json
@@ -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},
diff --git a/restapi-call-node/provider/src/main/resources/sptn-l3vpn-template.json b/restapi-call-node/provider/src/main/resources/sptn-l3vpn-template.json
index 9e1e92068..e850cb9a0 100644
--- a/restapi-call-node/provider/src/main/resources/sptn-l3vpn-template.json
+++ b/restapi-call-node/provider/src/main/resources/sptn-l3vpn-template.json
@@ -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",
diff --git a/restapi-call-node/provider/src/main/resources/update-vpe-data-with-apply-group.json b/restapi-call-node/provider/src/main/resources/update-vpe-data-with-apply-group.json
index a82a6b4a6..979857521 100644
--- a/restapi-call-node/provider/src/main/resources/update-vpe-data-with-apply-group.json
+++ b/restapi-call-node/provider/src/main/resources/update-vpe-data-with-apply-group.json
@@ -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:
diff --git a/restapi-call-node/provider/src/main/resources/vnf-information-update.json b/restapi-call-node/provider/src/main/resources/vnf-information-update.json
index 425f0f3d7..d554624c7 100644
--- a/restapi-call-node/provider/src/main/resources/vnf-information-update.json
+++ b/restapi-call-node/provider/src/main/resources/vnf-information-update.json
@@ -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}
}
diff --git a/restapi-call-node/provider/src/main/resources/vpn-allocation-request.json b/restapi-call-node/provider/src/main/resources/vpn-allocation-request.json
index 6c8427495..7a689bd5c 100644
--- a/restapi-call-node/provider/src/main/resources/vpn-allocation-request.json
+++ b/restapi-call-node/provider/src/main/resources/vpn-allocation-request.json
@@ -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}",
diff --git a/restapi-call-node/provider/src/main/resources/vpn-information-update.json b/restapi-call-node/provider/src/main/resources/vpn-information-update.json
index 7977066bd..3ac16e291 100644
--- a/restapi-call-node/provider/src/main/resources/vpn-information-update.json
+++ b/restapi-call-node/provider/src/main/resources/vpn-information-update.json
@@ -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}
}
diff --git a/restapi-call-node/provider/src/main/resources/vrf-service-configuration-information-template.json b/restapi-call-node/provider/src/main/resources/vrf-service-configuration-information-template.json
index f7e843246..c6defb405 100644
--- a/restapi-call-node/provider/src/main/resources/vrf-service-configuration-information-template.json
+++ b/restapi-call-node/provider/src/main/resources/vrf-service-configuration-information-template.json
@@ -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": {
diff --git a/restapi-call-node/provider/src/main/resources/vrf-update-vlan-status-template.json b/restapi-call-node/provider/src/main/resources/vrf-update-vlan-status-template.json
index 7a6cab35e..f6381256f 100644
--- a/restapi-call-node/provider/src/main/resources/vrf-update-vlan-status-template.json
+++ b/restapi-call-node/provider/src/main/resources/vrf-update-vlan-status-template.json
@@ -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},
diff --git a/restapi-call-node/provider/src/main/resources/vrf-update.json b/restapi-call-node/provider/src/main/resources/vrf-update.json
index 778e4b294..cdaef4d82 100644
--- a/restapi-call-node/provider/src/main/resources/vrf-update.json
+++ b/restapi-call-node/provider/src/main/resources/vrf-update.json
@@ -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}
}
diff --git a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java
index 21b66b221..569719d6c 100644
--- a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java
+++ b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java
@@ -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"));
}
}
diff --git a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
index 0704d297a..8cabaadcf 100755
--- a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
+++ b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
@@ -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;
diff --git a/restapi-call-node/provider/src/test/resources/actokentemplate.json b/restapi-call-node/provider/src/test/resources/actokentemplate.json
index 31bf0ee2b..02e62400f 100644
--- a/restapi-call-node/provider/src/test/resources/actokentemplate.json
+++ b/restapi-call-node/provider/src/test/resources/actokentemplate.json
@@ -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}
diff --git a/restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json b/restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json
index f18075686..e0896bbaa 100644
--- a/restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json
+++ b/restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json
@@ -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},
diff --git a/restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json b/restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json
index c011b077b..41df794fd 100644
--- a/restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json
+++ b/restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json
@@ -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},
diff --git a/restapi-call-node/provider/src/test/resources/l3smsitetemplate.json b/restapi-call-node/provider/src/test/resources/l3smsitetemplate.json
index 016879c3c..8f8156698 100644
--- a/restapi-call-node/provider/src/test/resources/l3smsitetemplate.json
+++ b/restapi-call-node/provider/src/test/resources/l3smsitetemplate.json
@@ -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":[
{
diff --git a/restapi-call-node/provider/src/test/resources/l3smvpntemplate.json b/restapi-call-node/provider/src/test/resources/l3smvpntemplate.json
index 67f127ce9..30f30a24f 100644
--- a/restapi-call-node/provider/src/test/resources/l3smvpntemplate.json
+++ b/restapi-call-node/provider/src/test/resources/l3smvpntemplate.json
@@ -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": [
{
diff --git a/restapi-call-node/provider/src/test/resources/l3smvrftemplate.json b/restapi-call-node/provider/src/test/resources/l3smvrftemplate.json
index 732af278c..52359a7fd 100644
--- a/restapi-call-node/provider/src/test/resources/l3smvrftemplate.json
+++ b/restapi-call-node/provider/src/test/resources/l3smvrftemplate.json
@@ -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": [
{
diff --git a/restapi-call-node/provider/src/test/resources/test-template.json b/restapi-call-node/provider/src/test/resources/test-template.json
index faefef31e..ae519a731 100644
--- a/restapi-call-node/provider/src/test/resources/test-template.json
+++ b/restapi-call-node/provider/src/test/resources/test-template.json
@@ -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:
diff --git a/restapi-call-node/provider/src/test/resources/test.json b/restapi-call-node/provider/src/test/resources/test.json
index b48eb6b43..75155393c 100644
--- a/restapi-call-node/provider/src/test/resources/test.json
+++ b/restapi-call-node/provider/src/test/resources/test.json
@@ -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": [
{