diff options
author | Marcus G K Williams <marcus.williams@intel.com> | 2017-08-23 11:47:08 -0700 |
---|---|---|
committer | Marcus Williams <marcus.williams@intel.com> | 2017-08-23 19:03:23 +0000 |
commit | 9042880234791fbe2e0ef033091ba93cb7f088f5 (patch) | |
tree | 3be335ecff8f5c8eae98c676fd93b902fb04dad7 /restapi-call-node/provider/src/test | |
parent | 0c7f2223a42ae9f1a9ac8954e9b9194e929b72f6 (diff) |
Conform ccsdk/sli/plugins to ONAP Style
Per ONAP Style Guide:
1. Convert tabs to 4 spaces.
2. Break lines to be less than 120 characters
3. Clean ecomp references
4. Remove extraneous spaces
Issue-Id: CCSDK-1
Change-Id: I5638326170aa3ab26774b373ab573643840e97ab
Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
Diffstat (limited to 'restapi-call-node/provider/src/test')
7 files changed, 404 insertions, 359 deletions
diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java index 107e8c88..dbca5ad7 100644 --- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java +++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java @@ -35,31 +35,33 @@ import org.slf4j.LoggerFactory; public class TestJsonParser { - private static final Logger log = LoggerFactory.getLogger(TestJsonParser.class); + private static final Logger log = LoggerFactory.getLogger(TestJsonParser.class); - @Test - public void test() throws Exception { - BufferedReader in = new BufferedReader(new InputStreamReader(ClassLoader.getSystemResourceAsStream("test.json"))); - String ss = ""; - String line = null; - while ((line = in.readLine()) != null) - ss += line + '\n'; + @Test + public void test() throws Exception { + BufferedReader in = new BufferedReader( + new InputStreamReader(ClassLoader.getSystemResourceAsStream("test.json")) + ); + String ss = ""; + String line = null; + while ((line = in.readLine()) != null) + ss += line + '\n'; - Map<String, String> mm = JsonParser.convertToProperties(ss); + Map<String, String> mm = JsonParser.convertToProperties(ss); - logProperties(mm); + logProperties(mm); - in.close(); - } + in.close(); + } - private void logProperties(Map<String, String> mm) { - List<String> ll = new ArrayList<>(); - for (Object o : mm.keySet()) - ll.add((String) o); - Collections.sort(ll); + private void logProperties(Map<String, String> mm) { + List<String> ll = new ArrayList<>(); + for (Object o : mm.keySet()) + ll.add((String) o); + Collections.sort(ll); - log.info("Properties:"); - for (String name : ll) - log.info("--- " + name + ": " + mm.get(name)); - } + log.info("Properties:"); + for (String name : ll) + log.info("--- " + name + ": " + mm.get(name)); + } } diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java index 5b03bff4..ff971480 100644 --- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java +++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java @@ -32,61 +32,61 @@ import org.slf4j.LoggerFactory; public class TestRestapiCallNode { - private static final Logger log = LoggerFactory.getLogger(TestRestapiCallNode.class); + private static final Logger log = LoggerFactory.getLogger(TestRestapiCallNode.class); - @Test - public void testDelete() throws Exception { - SvcLogicContext ctx = new SvcLogicContext(); + @Test + public void testDelete() throws Exception { + SvcLogicContext ctx = new SvcLogicContext(); - Map<String, String> p = new HashMap<String, String>(); - p.put("restapiUrl", "https://echo.getpostman.com/delete"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "pwd1"); - p.put("httpMethod", "delete"); - p.put("skipSending", "true"); + Map<String, String> p = new HashMap<String, String>(); + p.put("restapiUrl", "https://echo.getpostman.com/delete"); + p.put("restapiUser", "user1"); + p.put("restapiPassword", "pwd1"); + p.put("httpMethod", "delete"); + p.put("skipSending", "true"); - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } - @Test - public void testJsonTemplate() throws Exception { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.sdn-circuit-req-row_length", "3"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].clci", "clci"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].clci", "clci"); + @Test + public void testJsonTemplate() throws Exception { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("tmp.sdn-circuit-req-row_length", "3"); + ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123"); + ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete"); + ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0"); + ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New"); + ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New"); + ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1"); + ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci"); + ctx.setAttribute("tmp.sdn-circuit-req-row[1].source-uid", "APIDOC-123"); + ctx.setAttribute("tmp.sdn-circuit-req-row[1].action", "delete"); + ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-timestamp", "2016-09-09 16:30:35.0"); + ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-status", "New"); + ctx.setAttribute("tmp.sdn-circuit-req-row[1].processing-status", "New"); + ctx.setAttribute("tmp.sdn-circuit-req-row[1].service-clfi", "testClfi1"); + ctx.setAttribute("tmp.sdn-circuit-req-row[1].clci", "clci"); + ctx.setAttribute("tmp.sdn-circuit-req-row[2].source-uid", "APIDOC-123"); + ctx.setAttribute("tmp.sdn-circuit-req-row[2].action", "delete"); + ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-timestamp", "2016-09-09 16:30:35.0"); + ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-status", "New"); + ctx.setAttribute("tmp.sdn-circuit-req-row[2].processing-status", "New"); + ctx.setAttribute("tmp.sdn-circuit-req-row[2].service-clfi", "testClfi1"); + ctx.setAttribute("tmp.sdn-circuit-req-row[2].clci", "clci"); - Map<String, String> p = new HashMap<String, String>(); - p.put("templateFileName", "src/test/resources/test-template.json"); - p.put("restapiUrl", "http://echo.getpostman.com"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "abc123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "response"); - p.put("skipSending", "true"); + Map<String, String> p = new HashMap<String, String>(); + p.put("templateFileName", "src/test/resources/test-template.json"); + p.put("restapiUrl", "http://echo.getpostman.com"); + p.put("restapiUser", "user1"); + p.put("restapiPassword", "abc123"); + p.put("format", "json"); + p.put("httpMethod", "post"); + p.put("responsePrefix", "response"); + p.put("skipSending", "true"); - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } + RestapiCallNode rcn = new RestapiCallNode(); + rcn.sendRequest(p, ctx); + } } diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestXmlJsonUtil.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestXmlJsonUtil.java index ad1c34e9..579d194d 100644 --- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestXmlJsonUtil.java +++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestXmlJsonUtil.java @@ -40,57 +40,98 @@ public class TestXmlJsonUtil { Map<String, String> mm = new HashMap<>(); mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].vnf-type", "N-SBG"); mm.put("service-data.service-information.service-instance-id", "someinstance001"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].dns-server-ip-address", "10.11.12.13"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].escf-domain-name", "hclab.atttest.com"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].snmp-target-v3_length", "2"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].snmp-target-v3[0].snmp-target-v3-id", "1"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].snmp-target-v3[0].snmp-target-ip-address", "127.0.0.1"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].snmp-target-v3[0].snmp-security-level", "NO_AUTH_NO_PRIV"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].snmp-target-v3[1].snmp-target-v3-id", "2"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].snmp-target-v3[1].snmp-target-ip-address", "192.168.1.8"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].snmp-target-v3[1].snmp-security-level", "NO_AUTH_NO_PRIV"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].dns-ip-address-1", "2001:1890:1001:2224::1"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].dns-ip-address-2", "2001:1890:1001:2424::1"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].diameter-rf-realm-name", "uvp.els-an.att.net"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].diameter-rf-peer-ip-address", "192.168.1.66"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].bgf-controller-ip-address", "192.168.1.186"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].bgf-control-link-name", "mg3/69@192.168.1.226"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].rf-interface-nexthop-ip-address", "10.111.108.150"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].rf-mated-pair-ip-address", "10.111.108.146"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].dns-server-ip-address", "10.11.12.13"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].escf-domain-name", "hclab.atttest.com"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].snmp-target-v3_length", "2"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].snmp-target-v3[0].snmp-target-v3-id", "1"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].snmp-target-v3[0].snmp-target-ip-address", "127.0.0.1"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].snmp-target-v3[0].snmp-security-level", "NO_AUTH_NO_PRIV"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].snmp-target-v3[1].snmp-target-v3-id", "2"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].snmp-target-v3[1].snmp-target-ip-address", "192.168.1.8"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].snmp-target-v3[1].snmp-security-level", "NO_AUTH_NO_PRIV"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].dns-ip-address-1", "2001:1890:1001:2224::1"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].dns-ip-address-2", "2001:1890:1001:2424::1"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].diameter-rf-realm-name", "uvp.els-an.att.net"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].diameter-rf-peer-ip-address", "192.168.1.66"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].bgf-controller-ip-address", "192.168.1.186"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].bgf-control-link-name", "mg3/69@192.168.1.226"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].rf-interface-nexthop-ip-address", "10.111.108.150"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].rf-mated-pair-ip-address", "10.111.108.146"); mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf_length", "4"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[0].network-name", "UvpbUgnAccess1"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[0].sip-pa-termination-ip-address", "10.111.108.146"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[0].network-name", "UvpbUgnAccess1"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[0].sip-pa-termination-ip-address", "10.111.108.146"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[1].network-name", "MIS"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[1].proactive-transcoding-profile", "trinity-transcodingProfile"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[1].next-hop-ip-address", "10.111.108.158"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[1].subnet-mask-length", "10.111.108.154"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[1].network-name", "MIS"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[1].proactive-transcoding-profile", + "trinity-transcodingProfile"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[1].next-hop-ip-address", "10.111.108.158"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[1].subnet-mask-length", "10.111.108.154"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[2].network-name", "AVPN1"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[2].proactive-transcoding-profile", "trinity-transcodingProfile"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[2].next-hop-ip-address", "10.111.108.166"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[2].subnet-mask-length", "10.111.108.162"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[2].network-name", "AVPN1"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[2].proactive-transcoding-profile", + "trinity-transcodingProfile"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[2].next-hop-ip-address", "10.111.108.166"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[2].subnet-mask-length", "10.111.108.162"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[3].network-name", "AVPN1"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[3].proactive-transcoding-profile", "trinity-transcodingProfile"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[3].next-hop-ip-address", "10.129.108.166"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].access-net-pcscf[3].subnet-mask-length", "10.129.108.162"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[3].network-name", "AVPN1"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[3].proactive-transcoding-profile", + "trinity-transcodingProfile"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[3].next-hop-ip-address", "10.129.108.166"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].access-net-pcscf[3].subnet-mask-length", "10.129.108.162"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].core-net-pcscf_length", "1"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].core-net-pcscf_length", "1"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].core-net-pcscf[0].network-name", "Core"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].core-net-pcscf[0].next-hop-ip-address", "10.111.108.142"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].core-net-pcscf[0].sip-pa-termination-ip-address", "10.111.108.138"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].core-net-pcscf[0].network-name", "Core"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].core-net-pcscf[0].next-hop-ip-address", "10.111.108.142"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].core-net-pcscf[0].sip-pa-termination-ip-address", "10.111.108.138"); - mm.put("service-data.vnf-config-parameters-list.vnf-config-parameters[0].mated-pair-fully-qualified-domain-name", "mt1nj01sbg01pyl-mt1nj01sbg02pyl.ar1ga.uvp.els-an.att.net"); + mm.put("service-data.vnf-config-parameters-list." + + "vnf-config-parameters[0].mated-pair-fully-qualified-domain-name", + "mt1nj01sbg01pyl-mt1nj01sbg02pyl.ar1ga.uvp.els-an.att.net"); mm.put("service-data.appc-request-header.svc-request-id", "SOMESERVICEREQUEST123451000"); mm.put("service-data.vnf-config-information.vnf-host-ip-address", "192.168.13.151"); mm.put("service-data.vnf-config-information.vendor", "Netconf"); - mm.put("service-data.vnf-config-information.escape-test", "blah blah \"xxx&nnn<>\\'\"there>blah<&''\"\"123\\\\\\'''blah blah &"); + mm.put("service-data.vnf-config-information.escape-test", + "blah blah \"xxx&nnn<>\\'\"there>blah<&''\"\"123\\\\\\'''blah blah &"); String ss = XmlJsonUtil.getXml(mm, "service-data.vnf-config-parameters-list"); log.info(ss); diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestXmlParser.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestXmlParser.java index 6d506cce..544d259e 100644 --- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestXmlParser.java +++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestXmlParser.java @@ -37,39 +37,41 @@ import org.slf4j.LoggerFactory; public class TestXmlParser { - private static final Logger log = LoggerFactory.getLogger(TestXmlParser.class); + private static final Logger log = LoggerFactory.getLogger(TestXmlParser.class); - @Test - public void test() throws Exception { - BufferedReader in = new BufferedReader(new InputStreamReader(ClassLoader.getSystemResourceAsStream("test3.xml"))); - String ss = ""; - String line = null; - while ((line = in.readLine()) != null) - ss += line + '\n'; + @Test + public void test() throws Exception { + BufferedReader in = new BufferedReader( + new InputStreamReader(ClassLoader.getSystemResourceAsStream("test3.xml")) + ); + String ss = ""; + String line = null; + while ((line = in.readLine()) != null) + ss += line + '\n'; - Set<String> listNameList = new HashSet<String>(); - listNameList.add("project.dependencies.dependency"); - listNameList.add("project.build.plugins.plugin"); - listNameList.add("project.build.plugins.plugin.executions.execution"); - listNameList.add("project.build.pluginManagement.plugins.plugin"); - listNameList.add( - "project.build.pluginManagement.plugins.plugin.configuration.lifecycleMappingMetadata.pluginExecutions.pluginExecution"); + Set<String> listNameList = new HashSet<String>(); + listNameList.add("project.dependencies.dependency"); + listNameList.add("project.build.plugins.plugin"); + listNameList.add("project.build.plugins.plugin.executions.execution"); + listNameList.add("project.build.pluginManagement.plugins.plugin"); + listNameList.add("project.build.pluginManagement." + + "plugins.plugin.configuration.lifecycleMappingMetadata.pluginExecutions.pluginExecution"); - Map<String, String> mm = XmlParser.convertToProperties(ss, listNameList); + Map<String, String> mm = XmlParser.convertToProperties(ss, listNameList); - logProperties(mm); + logProperties(mm); - in.close(); - } + in.close(); + } - private void logProperties(Map<String, String> mm) { - List<String> ll = new ArrayList<>(); - for (Object o : mm.keySet()) - ll.add((String) o); - Collections.sort(ll); + private void logProperties(Map<String, String> mm) { + List<String> ll = new ArrayList<>(); + for (Object o : mm.keySet()) + ll.add((String) o); + Collections.sort(ll); - log.info("Properties:"); - for (String name : ll) - log.info("--- " + name + ": " + mm.get(name)); - } + log.info("Properties:"); + for (String name : ll) + log.info("--- " + name + ": " + mm.get(name)); + } } diff --git a/restapi-call-node/provider/src/test/resources/test.json b/restapi-call-node/provider/src/test/resources/test.json index 885e6602..a34f7e2a 100644 --- a/restapi-call-node/provider/src/test/resources/test.json +++ b/restapi-call-node/provider/src/test/resources/test.json @@ -20,29 +20,29 @@ */ { - "equipment-data": [ - { - "server-count": "4", - "max-server-speed": "1600000", - "number-primary-servers": "2", - "equipment-id": "Server1", - "server-model": "Unknown", - "server-id": "Server1" - } - ], - "resource-state": { - "threshold-value": "1600000", - "last-added": "1605000", - "used": "1605000", - "limit-value": "1920000" - }, - "resource-rule": { - "endpoint-position": "VCE-Cust", - "soft-limit-expression": "0.6 * max-server-speed * number-primary-servers", - "resource-name": "Bandwidth", - "service-model": "DUMMY", - "hard-limit-expression": "max-server-speed * number-primary-servers", - "equipment-level": "Server" - }, - "message": "The provisioned access bandwidth is at or exceeds 50% of the total server capacity." + "equipment-data": [ + { + "server-count": "4", + "max-server-speed": "1600000", + "number-primary-servers": "2", + "equipment-id": "Server1", + "server-model": "Unknown", + "server-id": "Server1" + } + ], + "resource-state": { + "threshold-value": "1600000", + "last-added": "1605000", + "used": "1605000", + "limit-value": "1920000" + }, + "resource-rule": { + "endpoint-position": "VCE-Cust", + "soft-limit-expression": "0.6 * max-server-speed * number-primary-servers", + "resource-name": "Bandwidth", + "service-model": "DUMMY", + "hard-limit-expression": "max-server-speed * number-primary-servers", + "equipment-level": "Server" + }, + "message": "The provisioned access bandwidth is at or exceeds 50% of the total server capacity." } diff --git a/restapi-call-node/provider/src/test/resources/test.xml b/restapi-call-node/provider/src/test/resources/test.xml index 391c9b3e..b60b5356 100644 --- a/restapi-call-node/provider/src/test/resources/test.xml +++ b/restapi-call-node/provider/src/test/resources/test.xml @@ -21,152 +21,152 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.ccsdk.sli.plugins</groupId> - <artifactId>restapi-call-node</artifactId> - <version>6.0.0-SNAPSHOT</version> - </parent> - <artifactId>restapi-call-node-provider</artifactId> - <packaging>bundle</packaging> - <name>RESTAPI Call Node - Provider</name> - <url>http://maven.apache.org</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <version>3.1.4.RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli</groupId> - <artifactId>sli-common</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli</groupId> - <artifactId>sli-provider</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - <version>3.1.4.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>3.1.4.RELEASE</version> - </dependency> - <dependency> - <groupId>xerces</groupId> - <artifactId>xerces</artifactId> - <version>2.4.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-client</artifactId> - <version>1.17</version> - </dependency> - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - </dependency> - </dependencies> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.sli.plugins</groupId> + <artifactId>restapi-call-node</artifactId> + <version>6.0.0-SNAPSHOT</version> + </parent> + <artifactId>restapi-call-node-provider</artifactId> + <packaging>bundle</packaging> + <name>RESTAPI Call Node - Provider</name> + <url>http://maven.apache.org</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>3.1.4.RELEASE</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli</groupId> + <artifactId>sli-common</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli</groupId> + <artifactId>sli-provider</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>${slf4j.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>3.1.4.RELEASE</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>3.1.4.RELEASE</version> + </dependency> + <dependency> + <groupId>xerces</groupId> + <artifactId>xerces</artifactId> + <version>2.4.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + <version>1.17</version> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>com.brocade.developer</groupId> - <artifactId>providermodule-plugin</artifactId> - <configuration> - <packageId>org.onap.ccsdk.sli.plugins</packageId> - <appName>restapi-call-node</appName> - </configuration> - <executions> - <execution> - <phase>process-sources</phase> - <goals> - <goal>process</goal> - </goals> - </execution> - </executions> - </plugin> + <build> + <plugins> + <plugin> + <groupId>com.brocade.developer</groupId> + <artifactId>providermodule-plugin</artifactId> + <configuration> + <packageId>org.onap.ccsdk.sli.plugins</packageId> + <appName>restapi-call-node</appName> + </configuration> + <executions> + <execution> + <phase>process-sources</phase> + <goals> + <goal>process</goal> + </goals> + </execution> + </executions> + </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-SymbolicName>org.onap.ccsdk.sli.plugins.restapicall</Bundle-SymbolicName> - <Export-Package>org.onap.ccsdk.sli.plugins.restapicall</Export-Package> - <Import-Package>*</Import-Package> - </instructions> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Bundle-SymbolicName>org.onap.ccsdk.sli.plugins.restapicall</Bundle-SymbolicName> + <Export-Package>org.onap.ccsdk.sli.plugins.restapicall</Export-Package> + <Import-Package>*</Import-Package> + </instructions> - <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation> + <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation> - </configuration> + </configuration> - </plugin> + </plugin> - </plugins> - <pluginManagement> - <plugins> - <!--This plugin's configuration is used to store Eclipse m2e settings - only. It has no influence on the Maven build itself. --> - <plugin> - <groupId>org.eclipse.m2e</groupId> - <artifactId>lifecycle-mapping</artifactId> - <version>1.0.0</version> - <configuration> - <lifecycleMappingMetadata> - <pluginExecutions> - <pluginExecution> - <pluginExecutionFilter> - <groupId> - com.brocade.developer - </groupId> - <artifactId> - providermodule-plugin - </artifactId> - <versionRange> - [1.2.0.100-SNAPSHOT,) - </versionRange> - <goals> - <goal>process</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore /> - </action> - </pluginExecution> - </pluginExecutions> - </lifecycleMappingMetadata> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> + </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings + only. It has no influence on the Maven build itself. --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + com.brocade.developer + </groupId> + <artifactId> + providermodule-plugin + </artifactId> + <versionRange> + [1.2.0.100-SNAPSHOT,) + </versionRange> + <goals> + <goal>process</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> </project> diff --git a/restapi-call-node/provider/src/test/resources/test3.xml b/restapi-call-node/provider/src/test/resources/test3.xml index 809a208e..ade41268 100644 --- a/restapi-call-node/provider/src/test/resources/test3.xml +++ b/restapi-call-node/provider/src/test/resources/test3.xml @@ -21,62 +21,62 @@ --> <ApplyGroupResponse xmlns="http://onap.org/vpn/schema/v1" - xmlns:ns2="http://onap.org/prov/vpn/schema/v2"> - <ApplyGroupResponseData> - <ServiceInstanceId>ICOREPVC-81114561</ServiceInstanceId> - <VrfDetails> - <End2EndVpnKey>VPNL811182</End2EndVpnKey> - <VpnId>811182</VpnId> - <VrfName>21302:811182</VrfName> - <VrfImport>SET_BVOIP_IN</VrfImport> - <VrfImport>SET6_BVOIP_IN</VrfImport> - <VrfExport>SET6_DSU</VrfExport> - <VrfExport>SET_DSU</VrfExport> - <VrfExport>SET6_MANAGED</VrfExport> - <VrfExport>SET_MANAGED</VrfExport> - <VrfExport>SET_LOVRF_COMMUNITY</VrfExport> - <VrfExport>SET_RESET_LP</VrfExport> - <ApplyGroup> - <ns2:ApplyGroup>AG_MAX_MCASTROUTES</ns2:ApplyGroup> - </ApplyGroup> - </VrfDetails> - <RoutingApplyGroups> - <RoutingProtocol>BGP4_PROTOCOL</RoutingProtocol> - <Family>v4</Family> - <PeerGroupName>gp_21302:811182</PeerGroupName> - <ApplyGroupPeer> - <ns2:ApplyGroup>AG_L3VPN_EBGP</ns2:ApplyGroup> - </ApplyGroupPeer> - <ApplyGroupPeer> - <ns2:ApplyGroup>AG_MAX_PREFIX</ns2:ApplyGroup> - </ApplyGroupPeer> - <ApplyGroupNeighbour> - <ns2:ApplyGroup>AG_BGP_UNMANAGED</ns2:ApplyGroup> - </ApplyGroupNeighbour> - <ApplyGroupNeighbour> - <ns2:ApplyGroup>AG_BFD_BGP_3000</ns2:ApplyGroup> - </ApplyGroupNeighbour> - </RoutingApplyGroups> - <RoutingApplyGroups> - <RoutingProtocol>BGP4_PROTOCOL</RoutingProtocol> - <Family>v6</Family> - <PeerGroupName>gp6_21302:811182</PeerGroupName> - <ApplyGroupPeer> - <ns2:ApplyGroup>AG6_L3VPN_EBGP</ns2:ApplyGroup> - </ApplyGroupPeer> - <ApplyGroupPeer> - <ns2:ApplyGroup>AG6_MAX_PREFIX</ns2:ApplyGroup> - </ApplyGroupPeer> - <ApplyGroupNeighbour> - <ns2:ApplyGroup>AG6_BGP_UNMANAGED</ns2:ApplyGroup> - </ApplyGroupNeighbour> - <ApplyGroupNeighbour> - <ns2:ApplyGroup>AG6_BFD_BGP_3000</ns2:ApplyGroup> - </ApplyGroupNeighbour> - </RoutingApplyGroups> - </ApplyGroupResponseData> - <response-code>200</response-code> - <response-message>Success</response-message> - <ack-final-indicator>Y</ack-final-indicator> + xmlns:ns2="http://onap.org/prov/vpn/schema/v2"> + <ApplyGroupResponseData> + <ServiceInstanceId>ICOREPVC-81114561</ServiceInstanceId> + <VrfDetails> + <End2EndVpnKey>VPNL811182</End2EndVpnKey> + <VpnId>811182</VpnId> + <VrfName>21302:811182</VrfName> + <VrfImport>SET_BVOIP_IN</VrfImport> + <VrfImport>SET6_BVOIP_IN</VrfImport> + <VrfExport>SET6_DSU</VrfExport> + <VrfExport>SET_DSU</VrfExport> + <VrfExport>SET6_MANAGED</VrfExport> + <VrfExport>SET_MANAGED</VrfExport> + <VrfExport>SET_LOVRF_COMMUNITY</VrfExport> + <VrfExport>SET_RESET_LP</VrfExport> + <ApplyGroup> + <ns2:ApplyGroup>AG_MAX_MCASTROUTES</ns2:ApplyGroup> + </ApplyGroup> + </VrfDetails> + <RoutingApplyGroups> + <RoutingProtocol>BGP4_PROTOCOL</RoutingProtocol> + <Family>v4</Family> + <PeerGroupName>gp_21302:811182</PeerGroupName> + <ApplyGroupPeer> + <ns2:ApplyGroup>AG_L3VPN_EBGP</ns2:ApplyGroup> + </ApplyGroupPeer> + <ApplyGroupPeer> + <ns2:ApplyGroup>AG_MAX_PREFIX</ns2:ApplyGroup> + </ApplyGroupPeer> + <ApplyGroupNeighbour> + <ns2:ApplyGroup>AG_BGP_UNMANAGED</ns2:ApplyGroup> + </ApplyGroupNeighbour> + <ApplyGroupNeighbour> + <ns2:ApplyGroup>AG_BFD_BGP_3000</ns2:ApplyGroup> + </ApplyGroupNeighbour> + </RoutingApplyGroups> + <RoutingApplyGroups> + <RoutingProtocol>BGP4_PROTOCOL</RoutingProtocol> + <Family>v6</Family> + <PeerGroupName>gp6_21302:811182</PeerGroupName> + <ApplyGroupPeer> + <ns2:ApplyGroup>AG6_L3VPN_EBGP</ns2:ApplyGroup> + </ApplyGroupPeer> + <ApplyGroupPeer> + <ns2:ApplyGroup>AG6_MAX_PREFIX</ns2:ApplyGroup> + </ApplyGroupPeer> + <ApplyGroupNeighbour> + <ns2:ApplyGroup>AG6_BGP_UNMANAGED</ns2:ApplyGroup> + </ApplyGroupNeighbour> + <ApplyGroupNeighbour> + <ns2:ApplyGroup>AG6_BFD_BGP_3000</ns2:ApplyGroup> + </ApplyGroupNeighbour> + </RoutingApplyGroups> + </ApplyGroupResponseData> + <response-code>200</response-code> + <response-message>Success</response-message> + <ack-final-indicator>Y</ack-final-indicator> </ApplyGroupResponse> - + |