diff options
author | Skip Wonnell <kw5258@att.com> | 2017-08-15 21:18:04 -0500 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-08-18 05:46:40 +0000 |
commit | cf4b15ab00249af6f4d05afd75d16bec689f3241 (patch) | |
tree | 14468fef53aecf04700eab421acca88fc8e853d4 /appc-directed-graph/appc-dgraph/provider/src/test/java/org | |
parent | ab6c2c0cd441cf40723016e9a82aeeeb933fec7e (diff) |
Initial add of appc-directed-graph bundles
Directed Graph library
Additional JIRA Issues: APPC-66, APPC-71, APPC-74
Issue-ID: APPC-65
Change-Id: I1bd643f7675dec19e562e99db65bafa0dcda6ef4
Signed-off-by: Skip Wonnell <kw5258@att.com>
Diffstat (limited to 'appc-directed-graph/appc-dgraph/provider/src/test/java/org')
20 files changed, 3341 insertions, 0 deletions
diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCheckConfigStatus.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCheckConfigStatus.java new file mode 100644 index 000000000..631001be9 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCheckConfigStatus.java @@ -0,0 +1,217 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; + +/* TODO: move the dgtest to opensource +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 com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class TestCheckConfigStatus /* extends AbstractDGTestCase */ { + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestCheckConfigStatus.class); + public static String CheckConfigStatusXML = "src/main/resources/xml/APPC_CheckConfigStatus.xml"; + + + +/* + @Test + public void testCheckConfigStatusSuccess() { + try { + + String propertyfileName = "APPC/CheckConfigStatus/CheckConfigStatus_Success.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { CheckConfigStatusXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", 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(); + } + } + + + @Test + public void testCheckConfigStatusFailure() { + try { + + String propertyfileName = "APPC/CheckConfigStatus/CheckConfigStatus_Failure.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { CheckConfigStatusXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", 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(); + } + } + + + + + @Test + public void testParseErrorLogFail() { + try { + + String propertyfileName = "APPC/CheckConfigStatus/ParseErrorLogFail.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { CheckConfigStatusXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + serviceReferences.put("org.openecomp.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor()); + + GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", 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("error-message "+ ctx.getAttribute("error-message")); + + + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testParseErrorLogSuccess() { + try { + + String propertyfileName = "APPC/CheckConfigStatus/ParseErrorLogSuccess.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { CheckConfigStatusXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + serviceReferences.put("org.openecomp.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor()); + + GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", 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(); + } + } + + + @Test + public void testMaxRetries() { + try { + + String propertyfileName = "APPC/CheckConfigStatus/MaxRetries.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { CheckConfigStatusXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + serviceReferences.put("org.openecomp.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor()); + + GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", 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(); + } + } + +*/ +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCommonConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCommonConfig.java new file mode 100644 index 000000000..17ad0d651 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCommonConfig.java @@ -0,0 +1,230 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; +import org.openecomp.sdnc.config.generator.convert.ConvertNode; +import org.openecomp.sdnc.config.generator.merge.MergeNode; +/* move to open source +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; + +public class TestCommonConfig /* extends AbstractDGTestCase */ { + +/* + + public String jsonPath = "src/main/resources/json"; + public String xmlpath = "src/main/resources/xml"; + + @Test + public void testCommonConfig() { + try { + //DGXMLGenerator generator = new DGXMLGenerator(); + //generator.generateXMLFromJSON(jsonPath, xmlpath, null); + + String propertyfileName = "APPC/CommonConfiguration/APPC_method_CommonConfiguration_TC2.properties"; + + String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml"; + String callGraph1XML = "src/main/resources/xml/APPC_GetConfigParams.xml"; + String callGraph2XML = "src/main/resources/xml/APPC_Configure.xml"; + String callGraph3XML = "src/main/resources/xml/APPC_SetStatus.xml"; + String callGraph4XML = "src/main/resources/xml/APPC_DownloadRestconfConfig.xml"; + String callGraph5XML = "src/main/resources/xml/APPC_GenerateConfig.xml"; + String callGraph6XML = "src/main/resources/xml/APPC_DownloadXmlConfig.xml"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { commonConfigureXML, + callGraph1XML, + callGraph2XML, + callGraph3XML, + callGraph4XML, + callGraph5XML, + callGraph6XML }; + + + 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.merge.MergeNode", new org.openecomp.sdnc.config.generator.merge.MergeNode()); + //serviceReferences.put("com.att.appc.config.generator.node.ConfigResourceNode", new MockConfigResourceNode()); + serviceReferences.put("org.openecomp.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor()); + + GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", 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(); + } + + } + + + + + @Test + public void testGetConfigParamsFailure() { + try { + //DGXMLGenerator generator = new DGXMLGenerator(); + //generator.generateXMLFromJSON(jsonPath, xmlpath, null); + + String propertyfileName = "APPC/CommonConfiguration/GetConfigParamsFail.properties"; + + String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml"; + + + // Register Call graphs + String injectGraphXmls[] = new String[] { commonConfigureXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", 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(); + } + + } + + + @Test + public void testInvalidRequestAction() { + try { + //DGXMLGenerator generator = new DGXMLGenerator(); + //generator.generateXMLFromJSON(jsonPath, xmlpath, null); + + String propertyfileName = "APPC/CommonConfiguration/InvalidRequestAction.properties"; + + String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml"; + + + // Register Call graphs + String injectGraphXmls[] = new String[] { commonConfigureXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", 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(); + } + + } + + @Test + public void testCommonConfigISBCTemplateSuccess() { + try { + //DGXMLGenerator generator = new DGXMLGenerator(); + //generator.generateXMLFromJSON(jsonPath, xmlpath, null); + + String propertyfileName = "APPC/CommonConfiguration/ISBCTemplateSuccess.properties"; + + String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml"; + String callGraph1XML = "src/main/resources/xml/APPC_GetConfigParams.xml"; + String callGraph2XML = "src/main/resources/xml/APPC_Configure.xml"; + String callGraph3XML = "src/main/resources/xml/APPC_SetStatus.xml"; + String callGraph4XML = "src/main/resources/xml/APPC_GenerateTemplateConfig.xml"; + String callGraph5XML = "src/main/resources/xml/APPC_CheckConfigStatus.xml"; + String callGraph6XML = "src/main/resources/xml/APPC_DownloadIsbcConfig.xml"; + String callGraph7XML = "src/main/resources/xml/APPC_UpdateAaiInfo.xml"; + String callGraph8XML = "src/main/resources/xml/APPC_GetVfModuleInfo.xml"; + String callGraph9XML = "src/main/resources/xml/APPC_SaveRunningConfig.xml"; + String callGraph10XML = "src/main/resources/xml/APPC_GetDeviceRunningConfig.xml"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { commonConfigureXML, + callGraph1XML, + callGraph2XML, + callGraph3XML, + callGraph4XML, + callGraph5XML, + callGraph6XML, + callGraph7XML, + callGraph8XML, + callGraph9XML, + callGraph10XML }; + + 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.merge.MergeNode", new org.openecomp.sdnc.config.generator.merge.MergeNode()); + + + + GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + + Map<String, Object> resourceReferences = new HashMap<String, Object>(); + tc.setResourceReferences(resourceReferences); + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + + } catch (Exception e) { + e.printStackTrace(); + } + + } +*/ +} + + + + + diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigurationDocumentRequest.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigurationDocumentRequest.java new file mode 100644 index 000000000..211c14215 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigurationDocumentRequest.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +/* move to opensource +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; + +public class TestConfigurationDocumentRequest /* extends AbstractDGTestCase */ { + +/* + @Test + public void testASDCMessage() { + try { + String propertyfileName = "ASDC-MESSAGE_method_configuration-document-request_TC1.properties"; + + String configurationDocumentRequestXML = "src/main/resources/xml/ASDC-MESSAGE_method_configuration-document-request_3.0.0.xml"; + + + // Register Call graphs + String injectGraphXmls[] = new String[] { configurationDocumentRequestXML}; + + 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.merge.MergeNode", new org.openecomp.sdnc.config.generator.merge.MergeNode()); + + GraphKey graphKey = new GraphKey("ASDC-MESSAGE", null, "configuration-document-request", 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(); + } + + } +*/ + +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigure.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigure.java new file mode 100644 index 000000000..c3928f692 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigure.java @@ -0,0 +1,285 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; + +/* need to move to open source +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 com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class TestConfigure /* extends AbstractDGTestCase */ { + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestConfigure.class); + public static String ConfigureXML = "src/main/resources/xml/APPC_Configure.xml"; + +/* + @Test + public void testTemplateConfigureSuccess() { + try { + + String propertyfileName = "APPC/Configure/Configure_Success.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { ConfigureXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + GraphKey graphKey = new GraphKey("APPC", null, "Configure", 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(); + } + } + + + @Test + public void testTemplateConfigureFailure() { + try { + + String propertyfileName = "APPC/Configure/Configure_Failure.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { ConfigureXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + GraphKey graphKey = new GraphKey("APPC", null, "Configure", 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(); + } + } + + + @Test + public void testGetTemplateFailure() { + try { + + String propertyfileName = "APPC/Configure/GetTemplate_Failure.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { ConfigureXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + GraphKey graphKey = new GraphKey("APPC", null, "Configure", 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(); + } + } + + + + @Test + public void testGenerateTemplateConfigFailure() { + try { + + String propertyfileName = "APPC/Configure/GenerateTemplateConfig_Failure.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { ConfigureXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + GraphKey graphKey = new GraphKey("APPC", null, "Configure", 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(); + } + } + + @Test + public void testConfigBlockConfigureSuccess() { + try { + + String propertyfileName = "APPC/Configure/ConfigBlockConfigure_Success.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { ConfigureXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + GraphKey graphKey = new GraphKey("APPC", null, "Configure", 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(); + } + } + + @Test + public void testConfigBlockConfigureFailure() { + try { + + String propertyfileName = "APPC/Configure/ConfigBlockConfigure_Failure.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { ConfigureXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + GraphKey graphKey = new GraphKey("APPC", null, "Configure", 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(); + } + } + + + @Test + public void testGenerateConfigFailure() { + try { + + String propertyfileName = "APPC/Configure/GenerateConfig_Failure.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { ConfigureXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + GraphKey graphKey = new GraphKey("APPC", null, "Configure", 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(); + } + } +*/ +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadCliConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadCliConfig.java new file mode 100644 index 000000000..9c03da22d --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadCliConfig.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* need to move to opensource +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGMockUtils; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; + +public class TestDownloadCliConfig /* extends AbstractDGTestCase */ { + +/* + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestDownloadIsbcConfig.class); + public static String DownloadCliConfigXML = "src/main/resources/xml/APPC_DownloadCliConfig.xml"; + + @Test + public void testDownloadCliConfigSuccess() { + try { + String propertyfileName = "APPC/DownloadCliConfig/DownloadCliConfig_Success.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { DownloadCliConfigXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + GraphKey graphKey = new GraphKey("APPC", null, "DownloadCliConfig", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + + Map<String, Object> resourceReferences = new HashMap<String, Object>(); + tc.setResourceReferences(resourceReferences); + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + //DGMockUtils.printContext(ctx); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testDownloadCliConfigDBFailure() { + try { + + String propertyfileName = "APPC/DownloadCliConfig/DownloadCliConfig_DB_Failure.properties"; + // Register Call graphs + String injectGraphXmls[] = new String[] { DownloadCliConfigXML }; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + GraphKey graphKey = new GraphKey("APPC", null, "DownloadCliConfig", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + + Map<String, Object> resourceReferences = new HashMap<String, Object>(); + tc.setResourceReferences(resourceReferences); + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + //DGMockUtils.printContext(ctx); + + + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testDownloadCliConfigAdaptorFailure() { + try { + + String propertyfileName = "APPC/DownloadCliConfig/DownloadCliConfig_Adaptor_Failure.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { DownloadCliConfigXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + GraphKey graphKey = new GraphKey("APPC", null, "DownloadCliConfig", null); + DGTestCase tc = new DGTestCase(graphKey); + + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + + Map<String, Object> resourceReferences = new HashMap<String, Object>(); + tc.setResourceReferences(resourceReferences); + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + //DGMockUtils.printContext(ctx); + + + } catch (Exception e) { + e.printStackTrace(); + } + } +*/ +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadIsbcConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadIsbcConfig.java new file mode 100644 index 000000000..407c76e24 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadIsbcConfig.java @@ -0,0 +1,152 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; + +/* need to move to open source +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 com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class TestDownloadIsbcConfig /* extends AbstractDGTestCase */{ + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestDownloadIsbcConfig.class); + public static String DownloadIsbcConfigXML = "src/main/resources/xml/APPC_DownloadIsbcConfig.xml"; + +/* + @Test + public void testDownloadIsbcConfigSuccess() { + try { + + String propertyfileName = "APPC/DownloadIsbcConfig/DownloadIsbcConfig_Success.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { DownloadIsbcConfigXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + + GraphKey graphKey = new GraphKey("APPC", null, "DownloadIsbcConfig", 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(); + } + } + + + @Test + public void testConfigFileFailure() { + try { + + String propertyfileName = "APPC/DownloadIsbcConfig/ConfigFile_Failure.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { DownloadIsbcConfigXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + GraphKey graphKey = new GraphKey("APPC", null, "DownloadIsbcConfig", 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(); + } + } + + + @Test + public void testPutFailure() { + try { + + String propertyfileName = "APPC/DownloadIsbcConfig/Put_Failure.properties"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { DownloadIsbcConfigXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + + GraphKey graphKey = new GraphKey("APPC", null, "DownloadIsbcConfig", 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(); + } + } + +*/ + +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateConfig.java new file mode 100644 index 000000000..adcfb9f88 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateConfig.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.powermock.api.mockito.PowerMockito; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* need to move to open source +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +import org.apache.sling.testing.mock.osgi.MockOsgi; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.openecomp.sdnc.sli.provider.ExecuteNodeExecutor; +import org.openecomp.sdnc.sli.provider.SvcLogicAdaptorFactory; + + +public class TestGenerateConfig /* extends AbstractDGTestCase */ { + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestGenerateConfig.class); + public static String generateConfigXML = "src/main/resources/xml/APPC_GenerateConfig.xml"; + +/* + + @Test + public void testGenerateConfigWithParameters() { + try { + + String propertyfileName = "APPC/GenerateConfig/GenerateConfigWithParams.properties"; + //String generateConfigXML = "src/main/resources/xml/APPC_GenerateConfig.xml"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { generateConfigXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + serviceReferences.put("org.openecomp.sdnc.config.generator.merge.MergeNode", new org.openecomp.sdnc.config.generator.merge.MergeNode()); + //serviceReferences.put("com.att.appc.config.generator.node.ConfigResourceNode", new MockConfigResourceNode()); + + serviceReferences.put("org.openecomp.appc.data.services.node.ConfigResourceNode", new MockSvcLogicJavaPlugin()); + + + GraphKey graphKey = new GraphKey("APPC", null, "GenerateConfig", 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(); + } + } + + + + @Test + public void testGenerateConfigWithNoParameters() { + try { + + String propertyfileName = "APPC/GenerateConfig/GenerateConfigNoParams.properties"; + //String generateConfigXML = "src/main/resources/xml/APPC_GenerateConfig.xml"; + + // Register Call graphs + String injectGraphXmls[] = new String[] { generateConfigXML }; + + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + serviceReferences.put("org.openecomp.sdnc.config.generator.merge.MergeNode", new org.openecomp.sdnc.config.generator.merge.MergeNode()); + //serviceReferences.put("com.att.appc.config.generator.node.ConfigResourceNode", new MockConfigResourceNode()); + + serviceReferences.put("org.openecomp.appc.data.services.node.ConfigResourceNode", new MockSvcLogicJavaPlugin()); + + + GraphKey graphKey = new GraphKey("APPC", null, "GenerateConfig", 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(); + } + } + + +*/ +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateTemplateConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateTemplateConfig.java new file mode 100644 index 000000000..93bf554fe --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateTemplateConfig.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* need to move to opensource +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; + +public class TestGenerateTemplateConfig /* extends AbstractDGTestCase */ { + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestGenerateTemplateConfig.class); +/* + public static String generateConfigXML = "src/main/resources/xml/APPC_GenerateTemplateConfig.xml"; + + @Test + public void testGenerateTemplateConfigWithParameters() { + try { + + String propertyfileName = "APPC/GenerateTemplateConfig/GenerateTemplateConfigWithParams.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + serviceReferences.put("org.openecomp.appc.data.services.node.ConfigResourceNode", new MockSvcLogicJavaPlugin()); + serviceReferences.put("org.openecomp.sdnc.config.generator.merge.MergeNode", new org.openecomp.sdnc.config.generator.merge.MergeNode()); + + // Register Call graphs + String injectGraphXmls[] = new String[] { generateConfigXML }; + + GraphKey graphKey = new GraphKey("APPC", null, "GenerateTemplateConfig", 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(); + } + } + + + + @Test + public void testGenerateTemplateConfigWithNoParameters() { + try { + + String propertyfileName = "APPC/GenerateTemplateConfig/GenerateTemplateConfigNoParams.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + serviceReferences.put("org.openecomp.appc.data.services.node.ConfigResourceNode", new MockSvcLogicJavaPlugin()); + serviceReferences.put("org.openecomp.sdnc.config.generator.merge.MergeNode", new org.openecomp.sdnc.config.generator.merge.MergeNode()); + + // Register Call graphs + String injectGraphXmls[] = new String[] { generateConfigXML }; + + GraphKey graphKey = new GraphKey("APPC", null, "GenerateTemplateConfig", 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(); + } + } + +*/ + +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetAaiInfo.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetAaiInfo.java new file mode 100644 index 000000000..5dd9ec3f7 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetAaiInfo.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* need to move to open source +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; + + +public class TestGetAaiInfo /* extends AbstractDGTestCase */{ + +/* + + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestGetAaiInfo.class); + public static String getAaiInfoXML = "src/main/resources/xml/APPC_GetAaiInfo.xml"; + + + + + @Test + public void testGetSuccess() { + try { + + + String propertyfileName = "APPC/GetAaiInfo/GetInfoSuccess.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getAaiInfoXML}; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetAaiInfo", 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(); + } + } + + + @Test + public void testGetVnfFail() { + try { + + + String propertyfileName = "APPC/GetAaiInfo/GetVnfFail.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getAaiInfoXML}; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetAaiInfo", 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(); + } + } + + @Test + public void testGetVServerFail() { + try { + + + String propertyfileName = "APPC/GetAaiInfo/GetVServerFail.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getAaiInfoXML}; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetAaiInfo", 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(); + } + } +*/ +} + + + + diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetConfigParams.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetConfigParams.java new file mode 100644 index 000000000..6926c3229 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetConfigParams.java @@ -0,0 +1,277 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; + +/* move to open source +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; + + +public class TestGetConfigParams /* extends AbstractDGTestCase */ { + + +/* + + public static String getConfigParamsXML = "src/main/resources/xml/APPC_GetConfigParams.xml"; + + + + @Test + public void testGetConfigParamsWithDefaultTemplate() { + try { + + String propertyfileName = "APPC/GetConfigParams/DefaultTemplate.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()); + + // Register Call graphs + String injectGraphXmls[] = new String[] { getConfigParamsXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetConfigParams", 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(); + } + + } + + + + + @Test + public void testGetConfigParamsWithTemplateName() { + try { + + + String propertyfileName = "APPC/GetConfigParams/TemplateName.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()); + + // Register Call graphs + String injectGraphXmls[] = new String[] { getConfigParamsXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetConfigParams", 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(); + } + } + + + @Test + public void testGetConfigParamsWithCliString() { + try { + + String propertyfileName = "APPC/GetConfigParams/CliString.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()); + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getConfigParamsXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetConfigParams", 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(); + } + } + + @Test + public void testGetConfigParamsWithCliJson() { + try { + + + String propertyfileName = "APPC/GetConfigParams/CliJson.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()); + + // Register Call graphs + String injectGraphXmls[] = new String[] { getConfigParamsXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetConfigParams", 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(); + } + } + + + + @Test + public void testGetConfigParamsForRestore() { + try { + String propertyfileName = "APPC/GetConfigParams/Restore.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()); + + // Register Call graphs + String injectGraphXmls[] = new String[] { getConfigParamsXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetConfigParams", 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(); + } + } + + + @Test + public void testGetConfigParamsCommonConfigFail() { + try { + String propertyfileName = "APPC/GetConfigParams/CommonConfigFail.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()); + + // Register Call graphs + String injectGraphXmls[] = new String[] { getConfigParamsXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetConfigParams", 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(); + } + } + + + + @Test + public void testGetConfigParamsJson2DGContextFail() { + try { + String propertyfileName = "APPC/GetConfigParams/Json2DGContextFail.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getConfigParamsXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetConfigParams", 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(); + } + } +*/ +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetDeviceRunningConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetDeviceRunningConfig.java new file mode 100644 index 000000000..8a5d3d54a --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetDeviceRunningConfig.java @@ -0,0 +1,131 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* need to move to open source +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; + +public class TestGetDeviceRunningConfig /* extends AbstractDGTestCase */ { + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestGetConfigParams.class); +/* + public String jsonPath = "src/main/resources/json"; + public String xmlpath = "src/main/resources/xml"; + + @Test + public void testChefRunningConfigSuccess() { + try { + logger.info("********************************* testChefRunningConfigSuccess *************************************"); + //DGMockUtils.generateXMLFile(jsonPath, xmlpath); + + String propertyfileName = "APPC/GetDeviceRunningConfig/Chef_Success.properties"; + + String getDeviceRunningConfigXML = "src/main/resources/xml/APPC_GetDeviceRunningConfig.xml"; + // Register Call graphs + String injectGraphXmls[] = new String[] { getDeviceRunningConfigXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetDeviceRunningConfig", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setPropertyfileName(propertyfileName); + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + assertContextWithProperty(ctx); + + + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testChefRunningConfigFailure() { + try { + + logger.info("********************************* testChefRunningConfigFailure *************************************"); + String propertyfileName = "APPC/GetDeviceRunningConfig/Chef_Failure.properties"; + + String getDeviceRunningConfigXML = "src/main/resources/xml/APPC_GetDeviceRunningConfig.xml"; + // Register Call graphs + String injectGraphXmls[] = new String[] { getDeviceRunningConfigXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetDeviceRunningConfig", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setPropertyfileName(propertyfileName); + + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + assertContextWithProperty(ctx); + + //DGMockUtils.printContext(ctx); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testChefRunningConfigOthers() { + try { + logger.info("********************************* testChefRunningConfigOthers *************************************"); + String propertyfileName = "APPC/GetDeviceRunningConfig/Chef_Others.properties"; + + String getDeviceRunningConfigXML = "src/main/resources/xml/APPC_GetDeviceRunningConfig.xml"; + // Register Call graphs + String injectGraphXmls[] = new String[] { getDeviceRunningConfigXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetDeviceRunningConfig", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setPropertyfileName(propertyfileName); + + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + assertContextWithProperty(ctx); + + //DGMockUtils.printContext(ctx); + + } catch (Exception e) { + e.printStackTrace(); + } + } +*/ +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetVfModuleInfo.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetVfModuleInfo.java new file mode 100644 index 000000000..3e2f34c0f --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetVfModuleInfo.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.powermock.api.mockito.PowerMockito; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* need move to open source +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 TestGetVfModuleInfo /* extends AbstractDGTestCase */ { + + //private final static Logger logger = LoggerFactory.getLogger(TestGetParams.class); + +/* + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestGetVfModuleInfo.class); + public static String GetVfModuleInfoXML = "src/main/resources/xml/APPC_GetVfModuleInfo.xml"; + + + + @Test + public void testGetVfModuleInfoSuccess() { + try { + + String propertyfileName = "APPC/GetVfModuleInfo/GetVfModuleInfo_Success.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + // Register Call graphs + String injectGraphXmls[] = new String[] { GetVfModuleInfoXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetVfModuleInfo", 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(); + } + + } + + + + + @Test + public void testGetVfModuleInfoFailure() { + try { + + String propertyfileName = "APPC/GetVfModuleInfo/GetVfModuleInfo_Failure.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + // Register Call graphs + String injectGraphXmls[] = new String[] { GetVfModuleInfoXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "GetVfModuleInfo", 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(); + } + + } + + +*/ + +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestProcessParameterDefinition.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestProcessParameterDefinition.java new file mode 100644 index 000000000..20d04fde3 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestProcessParameterDefinition.java @@ -0,0 +1,254 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* move to open source +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; + + +public class TestProcessParameterDefinition /* extends AbstractDGTestCase */ { + + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestProcessParameterDefinition.class); + public static String getProcessPDXML = "src/main/resources/xml/APPC_ProcessParameterDefinition.xml"; + +/* + + + @Test + public void testProcessPD() { + try { + + + String propertyfileName = "APPC/ProcessParameterDefinition/ProcessPD.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + serviceReferences.put("org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode", new org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode()); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getProcessPDXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "ProcessParameterDefinition", 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(ctx.getAttribute("tmp.allParams.configuration-parameters")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + @Test + public void testGetPDFail() { + try { + + + String propertyfileName = "APPC/ProcessParameterDefinition/GetPDFail.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + serviceReferences.put("org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode", new org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode()); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getProcessPDXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "ProcessParameterDefinition", 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(); + } + + } + @Test + public void testNoInstarParams() { + try { + + + String propertyfileName = "APPC/ProcessParameterDefinition/NoInstarParams.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + serviceReferences.put("org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode", new org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode()); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getProcessPDXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "ProcessParameterDefinition", 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(); + } + } + + + @Test + public void testGetInstarParamsFail() { + try { + + + String propertyfileName = "APPC/ProcessParameterDefinition/GetInstarParamsFail.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getProcessPDXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "ProcessParameterDefinition", 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(); + } + } + + + @Test + public void testMergeParamsFail() { + try { + + + String propertyfileName = "APPC/ProcessParameterDefinition/MergeParamsFail.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getProcessPDXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "ProcessParameterDefinition", 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(); + } + } + + + @Test + public void testSaveMdSal() { + try { + + + String propertyfileName = "APPC/ProcessParameterDefinition/SaveMdsalFail.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + serviceReferences.put("org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode", new org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode()); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { getProcessPDXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "ProcessParameterDefinition", 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(ctx.getAttribute("tmp.allParams.configuration-parameters")); + } catch (Exception e) { + e.printStackTrace(); + } + } +*/ +} + + + + 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 new file mode 100644 index 000000000..bae40347b --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestPublishConfiguration.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.powermock.api.mockito.PowerMockito; +import org.slf4j.Logger; +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(); + } + + } + + + +*/ + + +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSaveRunningConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSaveRunningConfig.java new file mode 100644 index 000000000..d093811ec --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSaveRunningConfig.java @@ -0,0 +1,152 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.powermock.api.mockito.PowerMockito; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* need to move to open source +import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase; +import com.att.sdnctl.dgtestlibrary.DGTestCase; +import com.att.sdnctl.dgtestlibrary.GraphKey; +import org.apache.sling.testing.mock.osgi.MockOsgi; +*/ +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.openecomp.sdnc.sli.provider.ExecuteNodeExecutor; +import org.openecomp.sdnc.sli.provider.SvcLogicAdaptorFactory; + + +public class TestSaveRunningConfig /* extends AbstractDGTestCase */{ + //private final static Logger logger = LoggerFactory.getLogger(TestGetParams.class); + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestSaveRunningConfig.class); + public static String SaveRunningConfigXML = "src/main/resources/xml/APPC_SaveRunningConfig.xml"; + +/* + + + @Test + public void testSaveRunningConfigSuccess() { + try { + + String propertyfileName = "APPC/SaveRunningConfig/SaveRunningConfig_Success.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { SaveRunningConfigXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "SaveRunningConfig", 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(); + } + + } + + + + + @Test + public void testSaveRunningConfigFailure() { + try { + + String propertyfileName = "APPC/SaveRunningConfig/SaveRunningConfig_Failure.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + // Register Call graphs + String injectGraphXmls[] = new String[] { SaveRunningConfigXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "SaveRunningConfig", 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(); + } + + } + + @Test + public void testSaveRunningUploadConfigFailure() { + try { + + String propertyfileName = "APPC/SaveRunningConfig/UploadConfig_Failure.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + // Register Call graphs + String injectGraphXmls[] = new String[] { SaveRunningConfigXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "SaveRunningConfig", 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(); + } + + } + + +*/ + +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSetStatus.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSetStatus.java new file mode 100644 index 000000000..76ae2032b --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSetStatus.java @@ -0,0 +1,154 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.powermock.api.mockito.PowerMockito; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* need to move to open source +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 TestSetStatus /* extends AbstractDGTestCase */ { + //private final static Logger logger = LoggerFactory.getLogger(TestGetParams.class); + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestSetStatus.class); + public static String SetStatusXML = "src/main/resources/xml/APPC_SetStatus.xml"; + + +/* + @Test + public void testSetStatusSuccess() { + try { + + String propertyfileName = "APPC/SetStatus/SetStatus_Success.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { SetStatusXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "SetStatus", 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(); + } + + } + + + + + @Test + public void testSetStatusAaiFailure() { + try { + + String propertyfileName = "APPC/SetStatus/SetStatus_AaiFailure.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { SetStatusXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "SetStatus", 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(); + } + + } + + + @Test + public void testSetStatusFailure() { + try { + + String propertyfileName = "APPC/SetStatus/SetStatus_SaveRunningFailure.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { SetStatusXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "SetStatus", 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(); + } + + } + + +*/ + +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestUpdateAaiInfo.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestUpdateAaiInfo.java new file mode 100644 index 000000000..c5fed9416 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestUpdateAaiInfo.java @@ -0,0 +1,166 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg; + + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.appc.dg.mock.instance.MockAaiResource; +import org.openecomp.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.openecomp.appc.dg.mock.instance.MockSvcLogicJavaPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.powermock.api.mockito.PowerMockito; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +/* move to open source +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 TestUpdateAaiInfo /* extends AbstractDGTestCase */ { + //private final static Logger logger = LoggerFactory.getLogger(TestGetParams.class); + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestUpdateAaiInfo.class); + public static String UpdateAaiInfoXML = "src/main/resources/xml/APPC_UpdateAaiInfo.xml"; + +/* + + @Test + public void testUpdateAaiInfoSuccess() { + try { + + String propertyfileName = "APPC/UpdateAaiInfo/Update_Success.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + // Register Call graphs + String injectGraphXmls[] = new String[] { UpdateAaiInfoXML }; + + + Map<String, Object> resourceReferences = new HashMap<String, Object>(); + + + resourceReferences.put("org.openecomp.sdnc.sli.aai.AAIService", new MockAaiResource()); + + GraphKey graphKey = new GraphKey("APPC", null, "UpdateAaiInfo", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + tc.setResourceReferences(resourceReferences); + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + + @Test + public void testUpdateAaiInfoFail() { + try { + + String propertyfileName = "APPC/UpdateAaiInfo/Update_Fail.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { UpdateAaiInfoXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "UpdateAaiInfo", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + + + Map<String, Object> resourceReferences = new HashMap<String, Object>(); + tc.setResourceReferences(resourceReferences); + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + + @Test + public void testGetVnfcRefFail() { + try { + + String propertyfileName = "APPC/UpdateAaiInfo/GetVnfcRef_Fail.properties"; + Map<String, Object> serviceReferences = new HashMap<String, Object>(); + + + + // Register Call graphs + String injectGraphXmls[] = new String[] { UpdateAaiInfoXML }; + + + GraphKey graphKey = new GraphKey("APPC", null, "UpdateAaiInfo", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + + Map<String, Object> resourceReferences = new HashMap<String, Object>(); + tc.setResourceReferences(resourceReferences); + + SvcLogicContext ctx = new SvcLogicContext(); + processTestCase(tc, ctx); + + + + } catch (Exception e) { + e.printStackTrace(); + } + + } + +*/ +} 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 new file mode 100644 index 000000000..5e55f2f31 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockAaiResource.java @@ -0,0 +1,249 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg.mock.instance; + + +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.openecomp.sdnc.sli.SvcLogicAdaptor; +import org.openecomp.sdnc.sli.SvcLogicContext; +import org.openecomp.sdnc.sli.SvcLogicException; +import org.openecomp.sdnc.sli.SvcLogicResource; +import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; +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; + } + +} + + + + + 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 new file mode 100644 index 000000000..165c39905 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockConfigureNodeExecutor.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg.mock.instance; + + +import java.util.Map; + +import org.openecomp.sdnc.sli.SvcLogicAdaptor; +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 activate(String key, SvcLogicContext ctx) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ConfigStatus deactivate(String key, SvcLogicContext ctx) { + // TODO Auto-generated method stub + 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 new file mode 100644 index 000000000..e13212600 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java @@ -0,0 +1,148 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-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========================================================= + */ + +package org.openecomp.appc.dg.mock.instance; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.openecomp.sdnc.sli.SvcLogicContext; +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"); + + } + + + } +} |