diff options
author | Skip Wonnell <kw5258@att.com> | 2017-08-28 22:02:54 -0500 |
---|---|---|
committer | Skip Wonnell <kw5258@att.com> | 2017-08-28 22:44:49 -0500 |
commit | 574417bd1d70e30e7074f7f3375ea443b44740ab (patch) | |
tree | afd17b4edcb4ea0261caa5c44a49d94b6737ed4e /appc-directed-graph/appc-dgraph | |
parent | d0bcf2eca3ff91fa69b20aabc8b6c57b789fb0ff (diff) |
Clean up directed graph java code
Issue-ID: APPC-90
Change-Id: I3ea4912523eed1fed85aa2e5909ec897bb13b72b
Signed-off-by: Skip Wonnell <kw5258@att.com>
Diffstat (limited to 'appc-directed-graph/appc-dgraph')
7 files changed, 283 insertions, 469 deletions
diff --git a/appc-directed-graph/appc-dgraph/pom.xml b/appc-directed-graph/appc-dgraph/pom.xml index d421dd3cb..508bcfcee 100644 --- a/appc-directed-graph/appc-dgraph/pom.xml +++ b/appc-directed-graph/appc-dgraph/pom.xml @@ -1,6 +1,31 @@ <?xml version="1.0" encoding="UTF-8"?> -<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/maven-v4_0_0.xsd"> +<!-- + ============LICENSE_START======================================================= + ONAP : APPC + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs + ============================================================================= + 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. + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + ============LICENSE_END========================================================= + --> + +<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/maven-v4_0_0.xsd"> <parent> <groupId>org.openecomp.appc</groupId> <artifactId>appc-directed-graph</artifactId> @@ -13,7 +38,7 @@ <artifactId>appc-dgraph</artifactId> <version>1.1.0-SNAPSHOT</version> - <name>APPC DG</name> + <name>APPC Directed Graph</name> <description>APPC DG Module</description> <properties> @@ -23,31 +48,9 @@ <openecomp.sdnc.sli.version>1.1.0</openecomp.sdnc.sli.version> <openecomp.sdnc.dblib.version>1.1.0</openecomp.sdnc.dblib.version> <openecomp.sdnc.sql-resource.version>1.1.0</openecomp.sdnc.sql-resource.version> + <licenseDir>${project.parent.parent.basedir}</licenseDir> </properties> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.openecomp.sdnctl</groupId> - <artifactId>appc-dg-provider</artifactId> - <version>${project.version}</version> - </dependency> - - <!-- OpenEcomp --> - <dependency> - <groupId>org.openecomp.sdnc.core</groupId> - <artifactId>sli-provider</artifactId> - </dependency> - - <dependency> - <groupId>org.openecomp.sdnc.core</groupId> - <artifactId>dblib-provider</artifactId> - <version>${sdnctl.dblib.version}</version> - </dependency> - </dependencies> - </dependencyManagement> - <profiles> <profile> <id>default</id> diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestPublishConfiguration.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestPublishConfiguration.java index bae40347b..357896e30 100644 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestPublishConfiguration.java +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestPublishConfiguration.java @@ -39,94 +39,13 @@ import org.slf4j.LoggerFactory; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -/* need to move to OPENSOURCE -import org.apache.sling.testing.mock.osgi.MockOsgi; -import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; -import com.att.sdnctl.dgtestlibrary.DGTestCase; -import com.att.sdnctl.dgtestlibrary.GraphKey; -*/ import org.openecomp.sdnc.sli.SvcLogicContext; import org.openecomp.sdnc.sli.provider.ExecuteNodeExecutor; import org.openecomp.sdnc.sli.provider.SvcLogicAdaptorFactory; -public class TestPublishConfiguration /* extends AbstractDGTestCase */ { - //private final static Logger logger = LoggerFactory.getLogger(TestGetParams.class); - private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestPublishConfiguration.class); - public static String PublishConfigurationXML = "src/main/resources/xml/APPC_PublishConfiguration.xml"; - - -/* - - @Test - public void TestPublishConfigurationSuccess() { - try { - - String propertyfileName = "APPC/PublishConfiguration/PublishConfig_Success.properties"; - Map<String, Object> serviceReferences = new HashMap<String, Object>(); - - - serviceReferences.put("org.openecomp.sdnc.config.generator.convert.ConvertNode", new org.openecomp.sdnc.config.generator.convert.ConvertNode()); - - - - serviceReferences.put("org.openecomp.sdnc.config.generator.writer.FileWriterNode", new org.openecomp.sdnc.config.generator.writer.FileWriterNode()); - // Register Call graphs - String injectGraphXmls[] = new String[] { PublishConfigurationXML }; - - - GraphKey graphKey = new GraphKey("APPC", null, "PublishConfiguration", null); - DGTestCase tc = new DGTestCase(graphKey); - tc.setInjectGraphXmls(injectGraphXmls); - tc.setServiceReferences(serviceReferences); - tc.setPropertyfileName(propertyfileName); - - SvcLogicContext ctx = new SvcLogicContext(); - processTestCase(tc, ctx); - - System.out.println("JSON " + ctx.getAttribute("tmp.jsonConversion.jsonContent")); - - - } catch (Exception e) { - e.printStackTrace(); - } - - } - - - - - @Test - public void TestPublishConfigurationFailure() { - try { - - String propertyfileName = "APPC/PublishConfiguration/PublishConfig_Failure.properties"; - Map<String, Object> serviceReferences = new HashMap<String, Object>(); - - - // Register Call graphs - String injectGraphXmls[] = new String[] { PublishConfigurationXML }; - - - GraphKey graphKey = new GraphKey("APPC", null, "PublishConfiguration", null); - DGTestCase tc = new DGTestCase(graphKey); - tc.setInjectGraphXmls(injectGraphXmls); - tc.setServiceReferences(serviceReferences); - tc.setPropertyfileName(propertyfileName); - - SvcLogicContext ctx = new SvcLogicContext(); - processTestCase(tc, ctx); - - - } catch (Exception e) { - e.printStackTrace(); - } - - } - - - -*/ - +public class TestPublishConfiguration { + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestPublishConfiguration.class); + public static String PublishConfigurationXML = "src/main/resources/xml/APPC_PublishConfiguration.xml"; } diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockAaiResource.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockAaiResource.java index 5e55f2f31..9a271fae4 100644 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockAaiResource.java +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockAaiResource.java @@ -35,211 +35,150 @@ import static org.junit.Assert.*; public class MockAaiResource implements SvcLogicResource { - private final static Logger logger = LoggerFactory.getLogger(MockAaiResource.class); - - @Override - public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { - - return QueryStatus.SUCCESS; - - } - - @Override - public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { - - return QueryStatus.SUCCESS; - } - - - - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) throws SvcLogicException { - - if (ctx.getAttribute("j").equals("0") && "tmp.aai-data-vm".equals(prefix)) { - logger.info("Mock VM Get query1 called " + ctx.getAttribute("j") ); - - assertEquals(resource, "vserver"); - assertEquals(key, "'vserver-name = $request-parameters.vm[$j].vm-name'"); - - ctx.setAttribute("tmp.aai-data-vm.vserver-id", "vserverid1"); - - ctx.setAttribute("tmp.aai-data-vm.tenant-id", "tenantid1"); - ctx.setAttribute("tmp.aai-data-vm.cloud-owner", "att-aic"); - ctx.setAttribute("tmp.aai-data-vm.cloud-region-id", "cloudregionid1"); - } - else if (ctx.getAttribute("j").equals("1") && "tmp.aai-data-vm".equals(prefix)) { - logger.info("Mock VM Get query1 called " + ctx.getAttribute("j") ); - - assertEquals(resource, "vserver"); - assertEquals(key, "'vserver-name = $request-parameters.vm[$j].vm-name'"); - - - ctx.setAttribute("tmp.aai-data-vm.vserver-id", "vserverid2"); - - ctx.setAttribute("tmp.aai-data-vm.tenant-id", "tenantid2"); - ctx.setAttribute("tmp.aai-data-vm.cloud-owner", "att-aic"); - ctx.setAttribute("tmp.aai-data-vm.cloud-region-id", "cloudregionid2"); - } - else if ("tmp.aai-data-vnfc".equals(prefix)) { - logger.info("Mock VNFC Get query1 called " ); - - assertEquals(resource, "vnfc"); - assertEquals(key, "'vnfc-name = $request-parameters.vm[$j].vnfc[$k].vnfc-name'"); - - return QueryStatus.NOT_FOUND; - } - return QueryStatus.SUCCESS; - } - - - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { - - logger.info("Mock query2 called " + ctx.getAttribute("j")); - - - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus reserve(String resource, String select, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { - - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map<String, String> parms, String prefix, SvcLogicContext ctx) throws SvcLogicException { - - logger.info("Mock Save called"); - if (ctx.getAttribute("j").equals("0") && - ctx.getAttribute("k").equals("0") && - "tmp.vnfc-sys-controller".equals(prefix)) { - - assertEquals(resource, "vnfc"); - - assertEquals(key, "'vnfc-name = $request-parameters.vm[$j].vnfc[$k].vnfc-name'"); - - - assertEquals(parms.get("prov-status"), "NVTPROV"); - assertEquals(parms.get("orchestration-status"), "CONFIGURED"); - assertEquals(parms.get("in-maint"), "false"); - assertEquals(parms.get("is-closed-loop"), "false"); - - - assertEquals(parms.get("vnfc-function-code"), "funccode"); - assertEquals(parms.get("vnfc-type"), "vnfctype"); - assertEquals(parms.get("ipaddress-v4-oam-vip"), "135.1.1.1"); - assertEquals(parms.get("group-notation"), "groupnotation"); - - assertEquals(parms.get("relationship-list.relationship[0].related-to"), "vserver"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[0].relationship-key"), "vserver.vserver-id"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[0].relationship-value"), "vserverid1"); - - - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[1].relationship-key"), "tenant.tenant-id"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[1].relationship-value"), "tenantid1"); - - - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[2].relationship-key"), "cloud-region.cloud-owner"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[2].relationship-value"), "att-aic"); - - - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[3].relationship-key"), "cloud-region.cloud-region-id"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[3].relationship-value"), "cloudregionid1"); - - - assertEquals(parms.get("relationship-list.relationship[1].related-to"), "generic-vnf"); - assertEquals(parms.get("relationship-list.relationship[1].relationship-data[0].relationship-key"), "generic-vnf.vnf-id"); - assertEquals(parms.get("relationship-list.relationship[1].relationship-data[0].relationship-value"), "ibcx0001v"); - - - assertEquals(parms.get("relationship-list.relationship[2].related-to"), "vf-module"); - assertEquals(parms.get("relationship-list.relationship[2].relationship-data[0].relationship-key"), "generic-vnf.vnf-id"); - assertEquals(parms.get("relationship-list.relationship[2].relationship-data[0].relationship-value"), "ibcx0001v"); - - assertEquals(parms.get("relationship-list.relationship[2].relationship-data[1].relationship-key"), "vf-module.vf-module-id"); - assertEquals(parms.get("relationship-list.relationship[2].relationship-data[1].relationship-value"), "1"); - - } - else if (ctx.getAttribute("j").equals("1") && - ctx.getAttribute("k").equals("0") && - "tmp.vnfc-sys-controller".equals(prefix)) { - - assertEquals(resource, "vnfc"); - - assertEquals(key, "'vnfc-name = $request-parameters.vm[$j].vnfc[$k].vnfc-name'"); - - - assertEquals(parms.get("prov-status"), "NVTPROV"); - assertEquals(parms.get("orchestration-status"), "CONFIGURED"); - assertEquals(parms.get("in-maint"), "false"); - assertEquals(parms.get("is-closed-loop"), "false"); - - - assertEquals(parms.get("vnfc-function-code"), "funccode1"); - assertEquals(parms.get("vnfc-type"), "vnfctype1"); - assertEquals(parms.get("ipaddress-v4-oam-vip"), "135.2.2.2"); - assertEquals(parms.get("group-notation"), "groupnotation1"); - - assertEquals(parms.get("relationship-list.relationship[0].related-to"), "vserver"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[0].relationship-key"), "vserver.vserver-id"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[0].relationship-value"), "vserverid2"); - - - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[1].relationship-key"), "tenant.tenant-id"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[1].relationship-value"), "tenantid2"); - - - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[2].relationship-key"), "cloud-region.cloud-owner"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[2].relationship-value"), "att-aic"); - - - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[3].relationship-key"), "cloud-region.cloud-region-id"); - assertEquals(parms.get("relationship-list.relationship[0].relationship-data[3].relationship-value"), "cloudregionid2"); - - - assertEquals(parms.get("relationship-list.relationship[1].related-to"), "generic-vnf"); - assertEquals(parms.get("relationship-list.relationship[1].relationship-data[0].relationship-key"), "generic-vnf.vnf-id"); - assertEquals(parms.get("relationship-list.relationship[1].relationship-data[0].relationship-value"), "ibcx0001v"); - - - assertEquals(parms.get("relationship-list.relationship[2].related-to"), "vf-module"); - assertEquals(parms.get("relationship-list.relationship[2].relationship-data[0].relationship-key"), "generic-vnf.vnf-id"); - assertEquals(parms.get("relationship-list.relationship[2].relationship-data[0].relationship-value"), "ibcx0001v"); - - assertEquals(parms.get("relationship-list.relationship[2].relationship-data[1].relationship-key"), "vf-module.vf-module-id"); - assertEquals(parms.get("relationship-list.relationship[2].relationship-data[1].relationship-value"), "1"); - } - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - - return QueryStatus.SUCCESS; - } - - - - @Override - public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) throws SvcLogicException { - - - - return QueryStatus.SUCCESS; - } - - - public QueryStatus update(String resource, String key, - Map<String, String> parms, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - - return QueryStatus.SUCCESS; - } + private final static Logger logger = LoggerFactory.getLogger(MockAaiResource.class); + + @Override + public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { + return QueryStatus.SUCCESS; + } + + @Override + public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { + return QueryStatus.SUCCESS; + } + + public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) throws SvcLogicException { + if (ctx.getAttribute("j").equals("0") && "tmp.aai-data-vm".equals(prefix)) { + logger.info("Mock VM Get query1 called " + ctx.getAttribute("j") ); + + assertEquals(resource, "vserver"); + assertEquals(key, "'vserver-name = $request-parameters.vm[$j].vm-name'"); + + ctx.setAttribute("tmp.aai-data-vm.vserver-id", "vserverid1"); + + ctx.setAttribute("tmp.aai-data-vm.tenant-id", "tenantid1"); + ctx.setAttribute("tmp.aai-data-vm.cloud-owner", "att-aic"); + ctx.setAttribute("tmp.aai-data-vm.cloud-region-id", "cloudregionid1"); + } + else if (ctx.getAttribute("j").equals("1") && "tmp.aai-data-vm".equals(prefix)) { + logger.info("Mock VM Get query1 called " + ctx.getAttribute("j") ); + + assertEquals(resource, "vserver"); + assertEquals(key, "'vserver-name = $request-parameters.vm[$j].vm-name'"); + + ctx.setAttribute("tmp.aai-data-vm.vserver-id", "vserverid2"); + ctx.setAttribute("tmp.aai-data-vm.tenant-id", "tenantid2"); + ctx.setAttribute("tmp.aai-data-vm.cloud-owner", "att-aic"); + ctx.setAttribute("tmp.aai-data-vm.cloud-region-id", "cloudregionid2"); + } + else if ("tmp.aai-data-vnfc".equals(prefix)) { + logger.info("Mock VNFC Get query1 called " ); + + assertEquals(resource, "vnfc"); + assertEquals(key, "'vnfc-name = $request-parameters.vm[$j].vnfc[$k].vnfc-name'"); + return QueryStatus.NOT_FOUND; + } + return QueryStatus.SUCCESS; + } + + public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock query2 called " + ctx.getAttribute("j")); + return QueryStatus.SUCCESS; + } + + @Override + public QueryStatus reserve(String resource, String select, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { + return QueryStatus.SUCCESS; + } + + @Override + public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map<String, String> parms, String prefix, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock Save called"); + if (ctx.getAttribute("j").equals("0") && + ctx.getAttribute("k").equals("0") && + "tmp.vnfc-sys-controller".equals(prefix)) { + assertEquals(resource, "vnfc"); + assertEquals(key, "'vnfc-name = $request-parameters.vm[$j].vnfc[$k].vnfc-name'"); + assertEquals(parms.get("prov-status"), "NVTPROV"); + assertEquals(parms.get("orchestration-status"), "CONFIGURED"); + assertEquals(parms.get("in-maint"), "false"); + assertEquals(parms.get("is-closed-loop"), "false"); + assertEquals(parms.get("vnfc-function-code"), "funccode"); + assertEquals(parms.get("vnfc-type"), "vnfctype"); + assertEquals(parms.get("ipaddress-v4-oam-vip"), "135.1.1.1"); + assertEquals(parms.get("group-notation"), "groupnotation"); + assertEquals(parms.get("relationship-list.relationship[0].related-to"), "vserver"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[0].relationship-key"), "vserver.vserver-id"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[0].relationship-value"), "vserverid1"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[1].relationship-key"), "tenant.tenant-id"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[1].relationship-value"), "tenantid1"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[2].relationship-key"), "cloud-region.cloud-owner"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[2].relationship-value"), "att-aic"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[3].relationship-key"), "cloud-region.cloud-region-id"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[3].relationship-value"), "cloudregionid1"); + assertEquals(parms.get("relationship-list.relationship[1].related-to"), "generic-vnf"); + assertEquals(parms.get("relationship-list.relationship[1].relationship-data[0].relationship-key"), "generic-vnf.vnf-id"); + assertEquals(parms.get("relationship-list.relationship[1].relationship-data[0].relationship-value"), "ibcx0001v"); + assertEquals(parms.get("relationship-list.relationship[2].related-to"), "vf-module"); + assertEquals(parms.get("relationship-list.relationship[2].relationship-data[0].relationship-key"), "generic-vnf.vnf-id"); + assertEquals(parms.get("relationship-list.relationship[2].relationship-data[0].relationship-value"), "ibcx0001v"); + assertEquals(parms.get("relationship-list.relationship[2].relationship-data[1].relationship-key"), "vf-module.vf-module-id"); + assertEquals(parms.get("relationship-list.relationship[2].relationship-data[1].relationship-value"), "1"); + } + else if (ctx.getAttribute("j").equals("1") && + ctx.getAttribute("k").equals("0") && + "tmp.vnfc-sys-controller".equals(prefix)) { + assertEquals(resource, "vnfc"); + assertEquals(key, "'vnfc-name = $request-parameters.vm[$j].vnfc[$k].vnfc-name'"); + assertEquals(parms.get("prov-status"), "NVTPROV"); + assertEquals(parms.get("orchestration-status"), "CONFIGURED"); + assertEquals(parms.get("in-maint"), "false"); + assertEquals(parms.get("is-closed-loop"), "false"); + assertEquals(parms.get("vnfc-function-code"), "funccode1"); + assertEquals(parms.get("vnfc-type"), "vnfctype1"); + assertEquals(parms.get("ipaddress-v4-oam-vip"), "135.2.2.2"); + assertEquals(parms.get("group-notation"), "groupnotation1"); + assertEquals(parms.get("relationship-list.relationship[0].related-to"), "vserver"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[0].relationship-key"), "vserver.vserver-id"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[0].relationship-value"), "vserverid2"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[1].relationship-key"), "tenant.tenant-id"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[1].relationship-value"), "tenantid2"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[2].relationship-key"), "cloud-region.cloud-owner"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[2].relationship-value"), "att-aic"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[3].relationship-key"), "cloud-region.cloud-region-id"); + assertEquals(parms.get("relationship-list.relationship[0].relationship-data[3].relationship-value"), "cloudregionid2"); + assertEquals(parms.get("relationship-list.relationship[1].related-to"), "generic-vnf"); + assertEquals(parms.get("relationship-list.relationship[1].relationship-data[0].relationship-key"), "generic-vnf.vnf-id"); + assertEquals(parms.get("relationship-list.relationship[1].relationship-data[0].relationship-value"), "ibcx0001v"); + assertEquals(parms.get("relationship-list.relationship[2].related-to"), "vf-module"); + assertEquals(parms.get("relationship-list.relationship[2].relationship-data[0].relationship-key"), "generic-vnf.vnf-id"); + assertEquals(parms.get("relationship-list.relationship[2].relationship-data[0].relationship-value"), "ibcx0001v"); + assertEquals(parms.get("relationship-list.relationship[2].relationship-data[1].relationship-key"), "vf-module.vf-module-id"); + assertEquals(parms.get("relationship-list.relationship[2].relationship-data[1].relationship-value"), "1"); + } + return QueryStatus.SUCCESS; + } + + @Override + public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { + return QueryStatus.SUCCESS; + } + + @Override + public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { + return QueryStatus.SUCCESS; + } + + @Override + public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) throws SvcLogicException { + return QueryStatus.SUCCESS; + } + + public QueryStatus update(String resource, String key, + Map<String, String> parms, String prefix, SvcLogicContext ctx) + throws SvcLogicException { + return QueryStatus.SUCCESS; + } } diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockConfigureNodeExecutor.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockConfigureNodeExecutor.java index 165c39905..bcfd61316 100644 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockConfigureNodeExecutor.java +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockConfigureNodeExecutor.java @@ -28,51 +28,44 @@ import org.openecomp.sdnc.sli.SvcLogicContext; public class MockConfigureNodeExecutor implements SvcLogicAdaptor{ - @Override - public ConfigStatus configure(String key, Map<String, String> parameters, SvcLogicContext ctx) { - - - if ( "get".equals(key)) { - - if ("135.1.1.1".equals(parameters.get("host") )) { - String fullPathFileName = parameters.get("fullPathFileName"); - if (("SuccessFile").equals(fullPathFileName ) ) - return ConfigStatus.FAILURE; - if (("FailureFile").equals(fullPathFileName ) ) - return ConfigStatus.SUCCESS; - if (("FailureLogFile").equals(fullPathFileName ) ) - return ConfigStatus.SUCCESS; - } - else if ("135.2.2.2".equals(parameters.get("host")) ) { - String fullPathFileName = parameters.get("fullPathFileName"); - if (("SuccessFile").equals(fullPathFileName ) ) - return ConfigStatus.FAILURE; - if (("FailureFile").equals(fullPathFileName ) ) - return ConfigStatus.FAILURE; - - } - - return ConfigStatus.SUCCESS; - } - else { - ctx.setAttribute("Status", "Success"); - - return ConfigStatus.SUCCESS; - } - } + @Override + public ConfigStatus configure(String key, Map<String, String> parameters, SvcLogicContext ctx) { - @Override - public ConfigStatus activate(String key, SvcLogicContext ctx) { - // TODO Auto-generated method stub - return null; - } + if ( "get".equals(key)) { - @Override - public ConfigStatus deactivate(String key, SvcLogicContext ctx) { - // TODO Auto-generated method stub - return null; - } + if ("135.1.1.1".equals(parameters.get("host") )) { + String fullPathFileName = parameters.get("fullPathFileName"); + if (("SuccessFile").equals(fullPathFileName ) ) + return ConfigStatus.FAILURE; + if (("FailureFile").equals(fullPathFileName ) ) + return ConfigStatus.SUCCESS; + if (("FailureLogFile").equals(fullPathFileName ) ) + return ConfigStatus.SUCCESS; + } + else if ("135.2.2.2".equals(parameters.get("host")) ) { + String fullPathFileName = parameters.get("fullPathFileName"); + if (("SuccessFile").equals(fullPathFileName ) ) + return ConfigStatus.FAILURE; + if (("FailureFile").equals(fullPathFileName ) ) + return ConfigStatus.FAILURE; + } + return ConfigStatus.SUCCESS; + } + else { + ctx.setAttribute("Status", "Success"); + return ConfigStatus.SUCCESS; + } + } + @Override + public ConfigStatus activate(String key, SvcLogicContext ctx) { + return null; + } + + @Override + public ConfigStatus deactivate(String key, SvcLogicContext ctx) { + return null; + } } diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java index e13212600..9bf7e412e 100644 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java @@ -33,116 +33,74 @@ import org.openecomp.sdnc.sli.SvcLogicException; import org.openecomp.sdnc.sli.SvcLogicJavaPlugin; public class MockSvcLogicJavaPlugin implements SvcLogicJavaPlugin{ - private final static Logger logger = LoggerFactory.getLogger(MockSvcLogicJavaPlugin.class); - public static String INPUT_PARAM_RESPONSE_PREFIX = "responsePrefix"; - public static String OUTPUT_STATUS_SUCCESS = "success"; - public static String OUTPUT_STATUS_FAILURE = "failure"; - public static String OUTPUT_PARAM_STATUS = "status"; - - - public void mountDevice(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException{ - logger.info("Executed MountDevice Plugin"); - } - - public void downloadDeviceConfiguration(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException{ - ctx.setAttribute("downloadStatus", "success"); - logger.info("Executed Download Device Configuration Plugin"); - throw new SvcLogicException("failed in Download.."); - } - - - - - public void getCommonConfigInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException, FileNotFoundException, IOException { - logger.info("Mock getCommonConfigInfo Called...."); - - - /*** - ctx.setAttribute("device-authentication.USER-NAME", "root"); - - String responsePrefix = inParams.get(INPUT_PARAM_RESPONSE_PREFIX); - responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : ""; - - - ctx.setAttribute(responsePrefix +OUTPUT_PARAM_STATUS, - OUTPUT_STATUS_SUCCESS); - - **/ - - } - - - public void getConfigFileReference(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { - logger.info("Mock getConfigFileReference Called...."); - } - - - - public void getTemplate(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { - - logger.info("Mock getTemplate Called...."); - } - - - - public void saveConfigFiles(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { - - logger.info("Mock saveConfigFiles called..."); - - } - - - - public void updateUploadConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { - - logger.info("Mock updateUploadConfig called..."); - } - - - - - public void savePrepareRelationship(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { - logger.info("Mock savePrepareRelationship called..."); - } - - - - - - public void saveConfigBlock(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { - logger.info("Mock saveConfigBlock called..."); - - if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) { - logger.info("No params..."); - ctx.setAttribute("file-category", "device_configuration"); - ctx.setAttribute("deviceconfig-file-content", "deviceConfig"); - - } else { - logger.info("Config params exist..."); - ctx.setAttribute("file-category", "device_configuration"); - ctx.setAttribute("file-category1", "configuration_block"); - ctx.setAttribute("file-category2", "config_data"); - - } - - } - - public void saveTemplateConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { - - logger.info("Mock saveTemplateConfig called..."); - - if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) { - logger.info("No params..."); - ctx.setAttribute("file-category", "device_configuration"); - ctx.setAttribute("deviceconfig-file-content", "deviceConfig"); - - } else { - logger.info("Config params exist..."); - ctx.setAttribute("file-category", "device_configuration"); - ctx.setAttribute("file-category1", "config_data"); - - } - - - } + private final static Logger logger = LoggerFactory.getLogger(MockSvcLogicJavaPlugin.class); + public static String INPUT_PARAM_RESPONSE_PREFIX = "responsePrefix"; + public static String OUTPUT_STATUS_SUCCESS = "success"; + public static String OUTPUT_STATUS_FAILURE = "failure"; + public static String OUTPUT_PARAM_STATUS = "status"; + + + public void mountDevice(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException{ + logger.info("Executed MountDevice Plugin"); + } + + public void downloadDeviceConfiguration(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException{ + ctx.setAttribute("downloadStatus", "success"); + logger.info("Executed Download Device Configuration Plugin"); + throw new SvcLogicException("failed in Download.."); + } + + public void getCommonConfigInfo(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException, FileNotFoundException, IOException { + logger.info("Mock getCommonConfigInfo Called...."); + } + + public void getConfigFileReference(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock getConfigFileReference Called...."); + } + + public void getTemplate(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock getTemplate Called...."); + } + + public void saveConfigFiles(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock saveConfigFiles called..."); + } + + public void updateUploadConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock updateUploadConfig called..."); + } + + public void savePrepareRelationship(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock savePrepareRelationship called..."); + } + + public void saveConfigBlock(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock saveConfigBlock called..."); + + if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) { + logger.info("No params..."); + ctx.setAttribute("file-category", "device_configuration"); + ctx.setAttribute("deviceconfig-file-content", "deviceConfig"); + } else { + logger.info("Config params exist..."); + ctx.setAttribute("file-category", "device_configuration"); + ctx.setAttribute("file-category1", "configuration_block"); + ctx.setAttribute("file-category2", "config_data"); + } + } + + public void saveTemplateConfig(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock saveTemplateConfig called..."); + + if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) { + logger.info("No params..."); + ctx.setAttribute("file-category", "device_configuration"); + ctx.setAttribute("deviceconfig-file-content", "deviceConfig"); + + } else { + logger.info("Config params exist..."); + ctx.setAttribute("file-category", "device_configuration"); + ctx.setAttribute("file-category1", "config_data"); + } + } } diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/resources/properties/APPC/PublishConfiguration/PublishConfig_Failure.properties b/appc-directed-graph/appc-dgraph/provider/src/test/resources/properties/APPC/PublishConfiguration/PublishConfig_Failure.properties index 4e2dccfd5..2a84acc81 100644 --- a/appc-directed-graph/appc-dgraph/provider/src/test/resources/properties/APPC/PublishConfiguration/PublishConfig_Failure.properties +++ b/appc-directed-graph/appc-dgraph/provider/src/test/resources/properties/APPC/PublishConfiguration/PublishConfig_Failure.properties @@ -17,6 +17,7 @@ # limitations under the License. # ============LICENSE_END========================================================= ### + input.vnf-id=ibcx0001v input.tmp.uploadConfigInfo.VNF-ID=ibcx0001v input.tmp.uploadConfigInfo.UPLOAD-CONFIG-ID=12434 diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/resources/properties/APPC/PublishConfiguration/PublishConfig_Success.properties b/appc-directed-graph/appc-dgraph/provider/src/test/resources/properties/APPC/PublishConfiguration/PublishConfig_Success.properties index bf851ed37..a1e160fb0 100644 --- a/appc-directed-graph/appc-dgraph/provider/src/test/resources/properties/APPC/PublishConfiguration/PublishConfig_Success.properties +++ b/appc-directed-graph/appc-dgraph/provider/src/test/resources/properties/APPC/PublishConfiguration/PublishConfig_Success.properties @@ -17,6 +17,7 @@ # limitations under the License. # ============LICENSE_END========================================================= ### + input.vnf-id=ibcx0001v input.tmp.uploadConfigInfo.VNF-ID=ibcx0001v input.tmp.uploadConfigInfo.UPLOAD-CONFIG-ID=12434 |