From 781b1a6df324419c846c84ea983c18fc8362bfd3 Mon Sep 17 00:00:00 2001 From: Patrick Brady Date: Wed, 13 Dec 2017 11:19:06 -0800 Subject: Third part of onap rename This part of the commit changes the folder structure on all other folders of appc. Change-Id: I8acfa11cdfcdcd36be0e137245d1dd7324f1abd3 Signed-off-by: Patrick Brady Issue-ID: APPC-13 --- .../org/onap/appc/dg/TestCheckConfigStatus.java | 217 ++++++++++++++++ .../java/org/onap/appc/dg/TestCommonConfig.java | 230 +++++++++++++++++ .../appc/dg/TestConfigurationDocumentRequest.java | 69 +++++ .../test/java/org/onap/appc/dg/TestConfigure.java | 285 +++++++++++++++++++++ .../org/onap/appc/dg/TestDownloadCliConfig.java | 133 ++++++++++ .../org/onap/appc/dg/TestDownloadIsbcConfig.java | 152 +++++++++++ .../java/org/onap/appc/dg/TestGenerateConfig.java | 133 ++++++++++ .../onap/appc/dg/TestGenerateTemplateConfig.java | 112 ++++++++ .../test/java/org/onap/appc/dg/TestGetAaiInfo.java | 146 +++++++++++ .../java/org/onap/appc/dg/TestGetConfigParams.java | 277 ++++++++++++++++++++ .../onap/appc/dg/TestGetDeviceRunningConfig.java | 131 ++++++++++ .../java/org/onap/appc/dg/TestGetVfModuleInfo.java | 123 +++++++++ .../appc/dg/TestProcessParameterDefinition.java | 254 ++++++++++++++++++ .../org/onap/appc/dg/TestPublishConfiguration.java | 51 ++++ .../org/onap/appc/dg/TestSaveRunningConfig.java | 152 +++++++++++ .../test/java/org/onap/appc/dg/TestSetStatus.java | 154 +++++++++++ .../java/org/onap/appc/dg/TestUpdateAaiInfo.java | 166 ++++++++++++ .../appc/dg/mock/instance/MockAaiResource.java | 188 ++++++++++++++ .../mock/instance/MockConfigureNodeExecutor.java | 71 +++++ .../dg/mock/instance/MockSvcLogicJavaPlugin.java | 106 ++++++++ .../openecomp/appc/dg/TestCheckConfigStatus.java | 217 ---------------- .../org/openecomp/appc/dg/TestCommonConfig.java | 230 ----------------- .../appc/dg/TestConfigurationDocumentRequest.java | 69 ----- .../java/org/openecomp/appc/dg/TestConfigure.java | 285 --------------------- .../openecomp/appc/dg/TestDownloadCliConfig.java | 133 ---------- .../openecomp/appc/dg/TestDownloadIsbcConfig.java | 152 ----------- .../org/openecomp/appc/dg/TestGenerateConfig.java | 133 ---------- .../appc/dg/TestGenerateTemplateConfig.java | 112 -------- .../java/org/openecomp/appc/dg/TestGetAaiInfo.java | 146 ----------- .../org/openecomp/appc/dg/TestGetConfigParams.java | 277 -------------------- .../appc/dg/TestGetDeviceRunningConfig.java | 131 ---------- .../org/openecomp/appc/dg/TestGetVfModuleInfo.java | 123 --------- .../appc/dg/TestProcessParameterDefinition.java | 254 ------------------ .../appc/dg/TestPublishConfiguration.java | 51 ---- .../openecomp/appc/dg/TestSaveRunningConfig.java | 152 ----------- .../java/org/openecomp/appc/dg/TestSetStatus.java | 154 ----------- .../org/openecomp/appc/dg/TestUpdateAaiInfo.java | 166 ------------ .../appc/dg/mock/instance/MockAaiResource.java | 188 -------------- .../mock/instance/MockConfigureNodeExecutor.java | 71 ----- .../dg/mock/instance/MockSvcLogicJavaPlugin.java | 106 -------- .../org/onap/sdnc/dg/loader/DGLoaderActivator.java | 58 +++++ .../org/onap/sdnc/dg/loader/DGXMLActivate.java | 133 ++++++++++ .../org/onap/sdnc/dg/loader/DGXMLGenerator.java | 128 +++++++++ .../java/org/onap/sdnc/dg/loader/DGXMLLoad.java | 115 +++++++++ .../onap/sdnc/dg/loader/DGXMLLoadNActivate.java | 175 +++++++++++++ .../sdnc/dg/loader/DGLoaderActivator.java | 58 ----- .../openecomp/sdnc/dg/loader/DGXMLActivate.java | 133 ---------- .../openecomp/sdnc/dg/loader/DGXMLGenerator.java | 128 --------- .../org/openecomp/sdnc/dg/loader/DGXMLLoad.java | 115 --------- .../sdnc/dg/loader/DGXMLLoadNActivate.java | 175 ------------- .../java/org/onap/sdnc/dg/loader/DGLoaderTest.java | 188 ++++++++++++++ .../org/onap/sdnc/dg/loader/MockDGXMLActivate.java | 35 +++ .../org/onap/sdnc/dg/loader/MockDGXMLLoad.java | 37 +++ .../sdnc/dg/loader/MockDGXMLLoadNActivate.java | 34 +++ .../sdnc/dg/loader/MockSvcLogicDblibStore.java | 86 +++++++ .../onap/sdnc/dg/loader/MockSvcLogicFactory.java | 36 +++ .../org/openecomp/sdnc/dg/loader/DGLoaderTest.java | 188 -------------- .../sdnc/dg/loader/MockDGXMLActivate.java | 35 --- .../openecomp/sdnc/dg/loader/MockDGXMLLoad.java | 37 --- .../sdnc/dg/loader/MockDGXMLLoadNActivate.java | 34 --- .../sdnc/dg/loader/MockSvcLogicDblibStore.java | 86 ------- .../sdnc/dg/loader/MockSvcLogicFactory.java | 36 --- 62 files changed, 4175 insertions(+), 4175 deletions(-) create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestCheckConfigStatus.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestCommonConfig.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestConfigurationDocumentRequest.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestConfigure.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestDownloadCliConfig.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestDownloadIsbcConfig.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGenerateConfig.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGenerateTemplateConfig.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGetAaiInfo.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGetConfigParams.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGetDeviceRunningConfig.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGetVfModuleInfo.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestProcessParameterDefinition.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestPublishConfiguration.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestSaveRunningConfig.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestSetStatus.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestUpdateAaiInfo.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockAaiResource.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockConfigureNodeExecutor.java create mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCheckConfigStatus.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCommonConfig.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigurationDocumentRequest.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigure.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadCliConfig.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadIsbcConfig.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateConfig.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateTemplateConfig.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetAaiInfo.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetConfigParams.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetDeviceRunningConfig.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetVfModuleInfo.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestProcessParameterDefinition.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestPublishConfiguration.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSaveRunningConfig.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSetStatus.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestUpdateAaiInfo.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockAaiResource.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockConfigureNodeExecutor.java delete mode 100644 appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java create mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGLoaderActivator.java create mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLActivate.java create mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLGenerator.java create mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLLoad.java create mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLLoadNActivate.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGLoaderActivator.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLActivate.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLGenerator.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoad.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoadNActivate.java create mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/DGLoaderTest.java create mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivate.java create mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoad.java create mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoadNActivate.java create mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockSvcLogicDblibStore.java create mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockSvcLogicFactory.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/DGLoaderTest.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLActivate.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoad.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoadNActivate.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicDblibStore.java delete mode 100644 appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicFactory.java (limited to 'appc-directed-graph') diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestCheckConfigStatus.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestCheckConfigStatus.java new file mode 100644 index 000000000..a64d0eb36 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + 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 serviceReferences = new HashMap(); + + + 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 serviceReferences = new HashMap(); + serviceReferences.put("org.onap.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 serviceReferences = new HashMap(); + serviceReferences.put("org.onap.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 serviceReferences = new HashMap(); + serviceReferences.put("org.onap.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/onap/appc/dg/TestCommonConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestCommonConfig.java new file mode 100644 index 000000000..cd2b9d223 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.appc.dg; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + 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.onap.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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + 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 resourceReferences = new HashMap(); + 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/onap/appc/dg/TestConfigurationDocumentRequest.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestConfigurationDocumentRequest.java new file mode 100644 index 000000000..a4592e72e --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; + +public class TestConfigurationDocumentRequest /* extends AbstractDGTestCase */ { + +/* + @Test + public void testSDCMessage() { + try { + String propertyfileName = "SDC-MESSAGE_method_configuration-document-request_TC1.properties"; + + String configurationDocumentRequestXML = "src/main/resources/xml/SDC-MESSAGE_method_configuration-document-request_3.0.0.xml"; + + + // Register Call graphs + String injectGraphXmls[] = new String[] { configurationDocumentRequestXML}; + + Map serviceReferences = new HashMap(); + 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("SDC-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/onap/appc/dg/TestConfigure.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestConfigure.java new file mode 100644 index 000000000..052ad7848 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + 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 serviceReferences = new HashMap(); + + + 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 serviceReferences = new HashMap(); + + + 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 serviceReferences = new HashMap(); + + + + 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/onap/appc/dg/TestDownloadCliConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestDownloadCliConfig.java new file mode 100644 index 000000000..782493c2d --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + GraphKey graphKey = new GraphKey("APPC", null, "DownloadCliConfig", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + + Map resourceReferences = new HashMap(); + 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 serviceReferences = new HashMap(); + + GraphKey graphKey = new GraphKey("APPC", null, "DownloadCliConfig", null); + DGTestCase tc = new DGTestCase(graphKey); + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + + Map resourceReferences = new HashMap(); + 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 serviceReferences = new HashMap(); + + GraphKey graphKey = new GraphKey("APPC", null, "DownloadCliConfig", null); + DGTestCase tc = new DGTestCase(graphKey); + + tc.setInjectGraphXmls(injectGraphXmls); + tc.setServiceReferences(serviceReferences); + tc.setPropertyfileName(propertyfileName); + + Map resourceReferences = new HashMap(); + 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/onap/appc/dg/TestDownloadIsbcConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestDownloadIsbcConfig.java new file mode 100644 index 000000000..92e39e862 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + + + + 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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + + + 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/onap/appc/dg/TestGenerateConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGenerateConfig.java new file mode 100644 index 000000000..f329d6b6c --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + 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.onap.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 serviceReferences = new HashMap(); + + 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.onap.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/onap/appc/dg/TestGenerateTemplateConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGenerateTemplateConfig.java new file mode 100644 index 000000000..250e4ac30 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.appc.dg; + + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + + serviceReferences.put("org.onap.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 serviceReferences = new HashMap(); + + + serviceReferences.put("org.onap.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/onap/appc/dg/TestGetAaiInfo.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGetAaiInfo.java new file mode 100644 index 000000000..6674054cb --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + + + + // 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 serviceReferences = new HashMap(); + + + + + // 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 serviceReferences = new HashMap(); + + + + + // 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/onap/appc/dg/TestGetConfigParams.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGetConfigParams.java new file mode 100644 index 000000000..fd219b013 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + + 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 serviceReferences = new HashMap(); + + 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 serviceReferences = new HashMap(); + 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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + 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 serviceReferences = new HashMap(); + + + + + + // 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/onap/appc/dg/TestGetDeviceRunningConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGetDeviceRunningConfig.java new file mode 100644 index 000000000..48fb106db --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.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.onap.ccsdk.sli.core.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/onap/appc/dg/TestGetVfModuleInfo.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestGetVfModuleInfo.java new file mode 100644 index 000000000..6bc64f233 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + // 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 serviceReferences = new HashMap(); + + // 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/onap/appc/dg/TestProcessParameterDefinition.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestProcessParameterDefinition.java new file mode 100644 index 000000000..f638c00c9 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.appc.dg; + + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + + 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 serviceReferences = new HashMap(); + + + + + + // 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 serviceReferences = new HashMap(); + + + + + + // 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 serviceReferences = new HashMap(); + + + + 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/onap/appc/dg/TestPublishConfiguration.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestPublishConfiguration.java new file mode 100644 index 000000000..b00194d7a --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestPublishConfiguration.java @@ -0,0 +1,51 @@ +/*- + * ============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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicAdaptorFactory; + + +public class TestPublishConfiguration { + private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestPublishConfiguration.class); + public static String PublishConfigurationXML = "src/main/resources/xml/APPC_PublishConfiguration.xml"; + +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestSaveRunningConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestSaveRunningConfig.java new file mode 100644 index 000000000..c85bfb3f7 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + + + // 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 serviceReferences = new HashMap(); + + + // 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 serviceReferences = new HashMap(); + + + // 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/onap/appc/dg/TestSetStatus.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestSetStatus.java new file mode 100644 index 000000000..4f7dc5cf1 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + + + // 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 serviceReferences = new HashMap(); + + + + // 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 serviceReferences = new HashMap(); + + + + // 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/onap/appc/dg/TestUpdateAaiInfo.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/TestUpdateAaiInfo.java new file mode 100644 index 000000000..05e7fa5cd --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/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.onap.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.onap.appc.dg.mock.instance.MockAaiResource; +import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; +import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); + + // Register Call graphs + String injectGraphXmls[] = new String[] { UpdateAaiInfoXML }; + + + Map resourceReferences = new HashMap(); + + + 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 serviceReferences = new HashMap(); + + + + // 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 resourceReferences = new HashMap(); + 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 serviceReferences = new HashMap(); + + + + // 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 resourceReferences = new HashMap(); + 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/onap/appc/dg/mock/instance/MockAaiResource.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockAaiResource.java new file mode 100644 index 000000000..9f93b51a9 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockAaiResource.java @@ -0,0 +1,188 @@ +/*- + * ============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.onap.appc.dg.mock.instance; + + +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource; +import org.onap.ccsdk.sli.core.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 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 parms, String prefix, SvcLogicContext ctx) + throws SvcLogicException { + return QueryStatus.SUCCESS; + } + +} + + + + + diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockConfigureNodeExecutor.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockConfigureNodeExecutor.java new file mode 100644 index 000000000..4d2e4c9b4 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockConfigureNodeExecutor.java @@ -0,0 +1,71 @@ +/*- + * ============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.onap.appc.dg.mock.instance; + + +import java.util.Map; + +import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; + +public class MockConfigureNodeExecutor implements SvcLogicAdaptor{ + + @Override + public ConfigStatus configure(String key, Map 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) { + return null; + } + + @Override + public ConfigStatus deactivate(String key, SvcLogicContext ctx) { + return null; + } +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java new file mode 100644 index 000000000..aeea98a97 --- /dev/null +++ b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/onap/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java @@ -0,0 +1,106 @@ +/*- + * ============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.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.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 inParams, SvcLogicContext ctx) throws SvcLogicException{ + logger.info("Executed MountDevice Plugin"); + } + + public void downloadDeviceConfiguration(Map 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 inParams, SvcLogicContext ctx) throws SvcLogicException, FileNotFoundException, IOException { + logger.info("Mock getCommonConfigInfo Called...."); + } + + public void getConfigFileReference(Map inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock getConfigFileReference Called...."); + } + + public void getTemplate(Map inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock getTemplate Called...."); + } + + public void saveConfigFiles(Map inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock saveConfigFiles called..."); + } + + public void updateUploadConfig(Map inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock updateUploadConfig called..."); + } + + public void savePrepareRelationship(Map inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock savePrepareRelationship called..."); + } + + public void saveConfigBlock(Map 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 inParams, SvcLogicContext ctx) throws SvcLogicException { + logger.info("Mock saveTemplateConfig called..."); + + if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) { + logger.info("No params..."); + ctx.setAttribute("file-category", "device_configuration"); + ctx.setAttribute("deviceconfig-file-content", "deviceConfig"); + + } else { + logger.info("Config params exist..."); + ctx.setAttribute("file-category", "device_configuration"); + ctx.setAttribute("file-category1", "config_data"); + } + } +} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCheckConfigStatus.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCheckConfigStatus.java deleted file mode 100644 index a64d0eb36..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCheckConfigStatus.java +++ /dev/null @@ -1,217 +0,0 @@ -/*- - * ============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.onap.appc.dg; - - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - 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 serviceReferences = new HashMap(); - - - 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 serviceReferences = new HashMap(); - serviceReferences.put("org.onap.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 serviceReferences = new HashMap(); - serviceReferences.put("org.onap.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 serviceReferences = new HashMap(); - serviceReferences.put("org.onap.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 deleted file mode 100644 index cd2b9d223..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestCommonConfig.java +++ /dev/null @@ -1,230 +0,0 @@ -/*- - * ============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.onap.appc.dg; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - 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.onap.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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - 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 resourceReferences = new HashMap(); - 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 deleted file mode 100644 index a4592e72e..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigurationDocumentRequest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============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.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; - -public class TestConfigurationDocumentRequest /* extends AbstractDGTestCase */ { - -/* - @Test - public void testSDCMessage() { - try { - String propertyfileName = "SDC-MESSAGE_method_configuration-document-request_TC1.properties"; - - String configurationDocumentRequestXML = "src/main/resources/xml/SDC-MESSAGE_method_configuration-document-request_3.0.0.xml"; - - - // Register Call graphs - String injectGraphXmls[] = new String[] { configurationDocumentRequestXML}; - - Map serviceReferences = new HashMap(); - 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("SDC-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 deleted file mode 100644 index 052ad7848..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestConfigure.java +++ /dev/null @@ -1,285 +0,0 @@ -/*- - * ============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.onap.appc.dg; - - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - 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 serviceReferences = new HashMap(); - - - 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 serviceReferences = new HashMap(); - - - 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 serviceReferences = new HashMap(); - - - - 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 deleted file mode 100644 index 782493c2d..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadCliConfig.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============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.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - GraphKey graphKey = new GraphKey("APPC", null, "DownloadCliConfig", null); - DGTestCase tc = new DGTestCase(graphKey); - tc.setInjectGraphXmls(injectGraphXmls); - tc.setServiceReferences(serviceReferences); - tc.setPropertyfileName(propertyfileName); - - Map resourceReferences = new HashMap(); - 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 serviceReferences = new HashMap(); - - GraphKey graphKey = new GraphKey("APPC", null, "DownloadCliConfig", null); - DGTestCase tc = new DGTestCase(graphKey); - tc.setInjectGraphXmls(injectGraphXmls); - tc.setServiceReferences(serviceReferences); - tc.setPropertyfileName(propertyfileName); - - Map resourceReferences = new HashMap(); - 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 serviceReferences = new HashMap(); - - GraphKey graphKey = new GraphKey("APPC", null, "DownloadCliConfig", null); - DGTestCase tc = new DGTestCase(graphKey); - - tc.setInjectGraphXmls(injectGraphXmls); - tc.setServiceReferences(serviceReferences); - tc.setPropertyfileName(propertyfileName); - - Map resourceReferences = new HashMap(); - 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 deleted file mode 100644 index 92e39e862..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestDownloadIsbcConfig.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * ============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.onap.appc.dg; - - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - - - - 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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - - - 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 deleted file mode 100644 index f329d6b6c..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateConfig.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; -import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - 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.onap.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 serviceReferences = new HashMap(); - - 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.onap.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 deleted file mode 100644 index 250e4ac30..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGenerateTemplateConfig.java +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * ============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.onap.appc.dg; - - -import static org.junit.Assert.*; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - - serviceReferences.put("org.onap.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 serviceReferences = new HashMap(); - - - serviceReferences.put("org.onap.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 deleted file mode 100644 index 6674054cb..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetAaiInfo.java +++ /dev/null @@ -1,146 +0,0 @@ -/*- - * ============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.onap.appc.dg; - - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - - - - // 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 serviceReferences = new HashMap(); - - - - - // 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 serviceReferences = new HashMap(); - - - - - // 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 deleted file mode 100644 index fd219b013..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetConfigParams.java +++ /dev/null @@ -1,277 +0,0 @@ -/*- - * ============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.onap.appc.dg; - - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - - 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 serviceReferences = new HashMap(); - - 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 serviceReferences = new HashMap(); - 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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - 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 serviceReferences = new HashMap(); - - - - - - // 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 deleted file mode 100644 index 48fb106db..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetDeviceRunningConfig.java +++ /dev/null @@ -1,131 +0,0 @@ -/*- - * ============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.onap.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.onap.ccsdk.sli.core.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 deleted file mode 100644 index 6bc64f233..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestGetVfModuleInfo.java +++ /dev/null @@ -1,123 +0,0 @@ -/*- - * ============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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; -import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - // 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 serviceReferences = new HashMap(); - - // 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 deleted file mode 100644 index f638c00c9..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestProcessParameterDefinition.java +++ /dev/null @@ -1,254 +0,0 @@ -/*- - * ============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.onap.appc.dg; - - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - - 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 serviceReferences = new HashMap(); - - - - - - // 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 serviceReferences = new HashMap(); - - - - - - // 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 serviceReferences = new HashMap(); - - - - 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 deleted file mode 100644 index b00194d7a..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestPublishConfiguration.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.SvcLogicAdaptorFactory; - - -public class TestPublishConfiguration { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestPublishConfiguration.class); - public static String PublishConfigurationXML = "src/main/resources/xml/APPC_PublishConfiguration.xml"; - -} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSaveRunningConfig.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSaveRunningConfig.java deleted file mode 100644 index c85bfb3f7..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSaveRunningConfig.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * ============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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; -import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - - - // 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 serviceReferences = new HashMap(); - - - // 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 serviceReferences = new HashMap(); - - - // 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 deleted file mode 100644 index 4f7dc5cf1..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestSetStatus.java +++ /dev/null @@ -1,154 +0,0 @@ -/*- - * ============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.onap.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.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; -import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - - - // 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 serviceReferences = new HashMap(); - - - - // 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 serviceReferences = new HashMap(); - - - - // 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 deleted file mode 100644 index 05e7fa5cd..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/TestUpdateAaiInfo.java +++ /dev/null @@ -1,166 +0,0 @@ -/*- - * ============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.onap.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.onap.appc.dg.mock.instance.MockAaiResource; -import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor; -import org.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; -import org.onap.ccsdk.sli.core.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 serviceReferences = new HashMap(); - - // Register Call graphs - String injectGraphXmls[] = new String[] { UpdateAaiInfoXML }; - - - Map resourceReferences = new HashMap(); - - - 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 serviceReferences = new HashMap(); - - - - // 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 resourceReferences = new HashMap(); - 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 serviceReferences = new HashMap(); - - - - // 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 resourceReferences = new HashMap(); - 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 deleted file mode 100644 index 9f93b51a9..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockAaiResource.java +++ /dev/null @@ -1,188 +0,0 @@ -/*- - * ============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.onap.appc.dg.mock.instance; - - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource; -import org.onap.ccsdk.sli.core.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 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 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 deleted file mode 100644 index 4d2e4c9b4..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockConfigureNodeExecutor.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============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.onap.appc.dg.mock.instance; - - -import java.util.Map; - -import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; - -public class MockConfigureNodeExecutor implements SvcLogicAdaptor{ - - @Override - public ConfigStatus configure(String key, Map 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) { - return null; - } - - @Override - public ConfigStatus deactivate(String key, SvcLogicContext ctx) { - return null; - } -} diff --git a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java b/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java deleted file mode 100644 index aeea98a97..000000000 --- a/appc-directed-graph/appc-dgraph/provider/src/test/java/org/openecomp/appc/dg/mock/instance/MockSvcLogicJavaPlugin.java +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * ============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.onap.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.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 inParams, SvcLogicContext ctx) throws SvcLogicException{ - logger.info("Executed MountDevice Plugin"); - } - - public void downloadDeviceConfiguration(Map 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 inParams, SvcLogicContext ctx) throws SvcLogicException, FileNotFoundException, IOException { - logger.info("Mock getCommonConfigInfo Called...."); - } - - public void getConfigFileReference(Map inParams, SvcLogicContext ctx) throws SvcLogicException { - logger.info("Mock getConfigFileReference Called...."); - } - - public void getTemplate(Map inParams, SvcLogicContext ctx) throws SvcLogicException { - logger.info("Mock getTemplate Called...."); - } - - public void saveConfigFiles(Map inParams, SvcLogicContext ctx) throws SvcLogicException { - logger.info("Mock saveConfigFiles called..."); - } - - public void updateUploadConfig(Map inParams, SvcLogicContext ctx) throws SvcLogicException { - logger.info("Mock updateUploadConfig called..."); - } - - public void savePrepareRelationship(Map inParams, SvcLogicContext ctx) throws SvcLogicException { - logger.info("Mock savePrepareRelationship called..."); - } - - public void saveConfigBlock(Map 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 inParams, SvcLogicContext ctx) throws SvcLogicException { - logger.info("Mock saveTemplateConfig called..."); - - if (StringUtils.isBlank(ctx.getAttribute("configuration-params"))) { - logger.info("No params..."); - ctx.setAttribute("file-category", "device_configuration"); - ctx.setAttribute("deviceconfig-file-content", "deviceConfig"); - - } else { - logger.info("Config params exist..."); - ctx.setAttribute("file-category", "device_configuration"); - ctx.setAttribute("file-category1", "config_data"); - } - } -} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGLoaderActivator.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGLoaderActivator.java new file mode 100644 index 000000000..99f7f8b6c --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGLoaderActivator.java @@ -0,0 +1,58 @@ +/*- + * ============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.sdnc.dg.loader; + +import java.util.LinkedList; +import java.util.List; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class DGLoaderActivator implements BundleActivator{ + + private List registrations = new LinkedList(); + + + private static final EELFLogger log = EELFManager.getInstance().getLogger(DGLoaderActivator.class); + + @Override + public void start(BundleContext ctx) throws Exception + { + + + + } + @Override + public void stop(BundleContext arg0) throws Exception + { + for (ServiceRegistration registration: registrations) + { + registration.unregister(); + registration = null; + } + + } + +} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLActivate.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLActivate.java new file mode 100644 index 000000000..6af447742 --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLActivate.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdnc.dg.loader; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; +import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + + +public class DGXMLActivate { + + private final static Logger logger = LoggerFactory.getLogger(DGXMLLoadNActivate.class); + private final SvcLogicStore store; + public static String STRING_ENCODING = "utf-8"; + + public DGXMLActivate(String propfile) throws Exception{ + if(StringUtils.isBlank(propfile)){ + throw new Exception(propfile + " Profile file is not defined"); + } + this.store = SvcLogicStoreFactory.getSvcLogicStore(propfile); + } + + protected DGXMLActivate(SvcLogicStore store) { + this.store = store; + } + + + public void activateDg(String activateFilePath) throws Exception { + logger.info("******************** Activating DG into Database *****************************"); + try { + List errors = new ArrayList(); + if(this.store != null){ + File activateFile = new File(activateFilePath); + if(activateFile != null && activateFile.isFile()){ + List fileLines = FileUtils.readLines(activateFile,STRING_ENCODING); + if(fileLines != null ){ + for (String line : fileLines) { + if(line != null && ! line.trim().startsWith("#")){ + String lineArray[] = line.trim().split(":"); + try { + if(lineArray != null && lineArray.length >= 4){ + String module = lineArray[0]; + String rpc = lineArray[1]; + String version = lineArray[2]; + String mode = lineArray[3]; + if(StringUtils.isNotBlank(module) && StringUtils.isNotBlank(rpc) + && StringUtils.isNotBlank(version) && StringUtils.isNotBlank(mode)){ + logger.info("Activating DG :" + line); + SvcLogicGraph graph = this.store.fetch(module, rpc, version, mode); + if(graph != null){ + logger.info("Found Graph :" + line + " Activating ..."); + this.store.activate(graph); + }else{ + throw new Exception("Failed to fetch from Database"); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + errors.add("Failed to Activate "+line + ", "+e.getMessage()); + } + } + } + } + }else{ + throw new Exception(activateFile + " is not a valid Activate file Path"); + } + }else{ + throw new Exception("Failed to initialise SvcLogicStore"); + } + + if(errors.size() > 0){ + throw new Exception(errors.toString()); + } + } catch (Exception e) { + logger.error(e.getMessage()); + } + } + + + public static void main(String[] args) { + try { + String activateFile = null; + String propertyPath = null; + + if(args != null && args.length >= 2){ + activateFile = args[0]; + propertyPath = args[1]; + }else{ + throw new Exception("Sufficient inputs for DGXMLActivate are missing "); + } + + DGXMLActivate dgXmlActivate = new DGXMLActivate(propertyPath); + dgXmlActivate.activateDg(activateFile); + } catch (Exception e) { + e.printStackTrace(); + }finally { + System.exit(1); + } + } + +} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLGenerator.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLGenerator.java new file mode 100644 index 000000000..60fcd5ba8 --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLGenerator.java @@ -0,0 +1,128 @@ +/*- + * ============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.sdnc.dg.loader; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.script.Invocable; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class DGXMLGenerator { + private final static Logger logger = LoggerFactory.getLogger(DGXMLGenerator.class); + + public static String STRING_ENCODING = "utf-8"; + public static String JS_INTERFACE_DG_CONVERTOR = "dgconverter"; + public static String JS_METHOD_GET_NODE_TO_XML = "getNodeToXml"; + public static String GENERATOR_TEMPLATE_FILE = "js/dg_xml2json.js"; + + public void generateXMLFromJSON(String jsonPath, String xmlpath, String propertyPath) throws Exception { + try{ + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine engine = manager.getEngineByName("JavaScript"); + if (!(engine instanceof Invocable)) { + logger.error("Invoking methods is not supported."); + return; + } + Invocable inv = (Invocable) engine; + // engine.eval(new FileReader(DGXMLGenerator.class.getClassLoader().getResource(GENERATOR_TEMPLATE_FILE).getPath())); + String js = IOUtils.toString(DGXMLGenerator.class.getClassLoader().getResourceAsStream(GENERATOR_TEMPLATE_FILE),STRING_ENCODING); + engine.eval(js); + + Object dgconverter = engine.get(JS_INTERFACE_DG_CONVERTOR); + + List files = new ArrayList(); + if(dgconverter != null){ + File jsonPathFile = new File(jsonPath); + if(jsonPathFile.isDirectory()){ + String[] extensions = new String[] { "json", "JSON" }; + files = (List) FileUtils.listFiles(jsonPathFile, extensions, true); + }else if(jsonPathFile.isFile()){ + files.add(jsonPathFile); + }else{ + throw new Exception("Failed to get the nature of the JSON path :"+ jsonPath); + } + + logger.info("JSON Files identified "+ files.size()); + + if(files.size() > 0){ + boolean isXmlPathDeleted = FileUtils.deleteQuietly(new File(xmlpath)); + logger.info("Cleaning old DG XML under : " + xmlpath + ", delete status :" + isXmlPathDeleted); + + for (File file : files) { + String dgJson = FileUtils.readFileToString(file,STRING_ENCODING); + logger.info("Generating XML from :" + file.getName()); + String xmlFileName = xmlpath +"/"+file.getName().replace(".json", ".xml"); + + Object dgXMl = inv.invokeMethod(dgconverter, JS_METHOD_GET_NODE_TO_XML, dgJson); + // Write the XML File + if(dgXMl != null){ + File xmlFile = new File(xmlFileName); + FileUtils.writeStringToFile(xmlFile, dgXMl.toString(), STRING_ENCODING); + logger.info("Generated XML File under :" + xmlFile.getCanonicalPath()); + } + } + + }else{ + logger.info("No JSON Files to generate XML"); + } + }else{ + logger.error("Couldn't get Java Script Engine.."); + } + }catch (Exception e) { + logger.error("Failed to generate generateXMLFromJSON :"+e.getMessage()); + } + } + + + public static void main(String[] args) { + try { + DGXMLGenerator application = new DGXMLGenerator(); + String jsonPath = null; + String xmlPath = null; + String propertyPath = null; + // Generate, GenerateLoad, GenerateLoadActivate + //args = new String[]{"src/main/resources/json","src/test/resources/xml"}; + logger.info("DGXML Conversion Started with arguments :"+ args[0] +":"+ args[1]); + if(args != null && args.length >= 2){ + jsonPath = args[0]; + xmlPath = args[1]; + }else{ + throw new Exception("Sufficient inputs are missing "); + } + + application.generateXMLFromJSON(jsonPath, xmlPath, propertyPath); + logger.info("DGXML Conversion Completed..."); + } catch (Exception e) { + logger.error("Failed in DG XML Generation :"+e.getMessage()); + e.printStackTrace(); + } + + } + +} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLLoad.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLLoad.java new file mode 100644 index 000000000..1b6116cc3 --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLLoad.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdnc.dg.loader; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicParser; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; + +public class DGXMLLoad { + private final static Logger logger = LoggerFactory.getLogger(DGXMLLoad.class); + private final SvcLogicStore store; + public static String STRING_ENCODING = "utf-8"; + + public DGXMLLoad(String propfile) throws Exception{ + if(StringUtils.isBlank(propfile)){ + throw new Exception(propfile + " Profile file is not defined"); + } + this.store = SvcLogicStoreFactory.getSvcLogicStore(propfile); + } + + protected DGXMLLoad(SvcLogicStore store) throws Exception { + this.store=store; + } + + public void loadDGXMLFile(String dgXMLpath) throws SvcLogicException{ + if(dgXMLpath != null ){ + SvcLogicParser.load(dgXMLpath, this.store); + } + } + + private void loadDGXMLDir(String xmlPath) throws Exception { + try { + logger.info("******************** Loading DG into Database *****************************"); + List errors = new ArrayList(); + if(this.store != null){ + File xmlDir = new File(xmlPath); + if(xmlDir != null && xmlDir.isDirectory()){ + String[] extensions = new String[] { "xml", "XML" }; + List files = (List) FileUtils.listFiles(xmlDir, extensions, true); + for (File file : files) { + logger.info("Loading DG XML file :" + file.getCanonicalPath()); + try{ + SvcLogicParser.load(file.getCanonicalPath(), this.store); + }catch (Exception e) { + errors.add("Failed to load XML "+file.getCanonicalPath() + ", Exception : "+e.getMessage()); + } + } + }else{ + throw new Exception(xmlPath + " is not a valid XML Directory"); + } + }else{ + throw new Exception("Failed to initialise SvcLogicStore"); + } + + if(errors.size() > 0){ + throw new Exception(errors.toString()); + } + } catch (Exception e) { + logger.error(e.getMessage()); + } + } + + public static void main(String[] args) { + try { + String xmlPath = null; + String propertyPath = null; + + if(args != null && args.length >= 2){ + xmlPath = args[0]; + propertyPath = args[1]; + }else{ + throw new Exception("Sufficient inputs for DGXMLLoadNActivate are missing "); + } + DGXMLLoad dgXMLLoadDB = new DGXMLLoad(propertyPath); + dgXMLLoadDB.loadDGXMLDir(xmlPath); + } catch (Exception e) { + e.printStackTrace(); + }finally { + System.exit(1); + } + } + +} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLLoadNActivate.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLLoadNActivate.java new file mode 100644 index 000000000..54f109177 --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/main/java/org/onap/sdnc/dg/loader/DGXMLLoadNActivate.java @@ -0,0 +1,175 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdnc.dg.loader; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; +import org.onap.ccsdk.sli.core.sli.SvcLogicParser; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; + +public class DGXMLLoadNActivate { + private final static Logger logger = LoggerFactory.getLogger(DGXMLLoadNActivate.class); + private final SvcLogicStore store; + public static String STRING_ENCODING = "utf-8"; + + public DGXMLLoadNActivate(String propfile) throws Exception{ + if(StringUtils.isBlank(propfile)){ + throw new Exception(propfile + " Profile file is not defined"); + } + this.store = SvcLogicStoreFactory.getSvcLogicStore(propfile); + } + + protected DGXMLLoadNActivate(SvcLogicStore store) { + this.store=store; + } + + public void loadDGXMLFile(String dgXMLpath) throws SvcLogicException{ + if(dgXMLpath != null ){ + SvcLogicParser.load(dgXMLpath, this.store); + } + } + + private void loadDGXMLDir(String xmlPath) throws Exception { + try { + logger.info("******************** Loading DG into Database *****************************"); + List errors = new ArrayList(); + if(this.store != null){ + File xmlDir = new File(xmlPath); + if(xmlDir.isDirectory()){ + String[] extensions = new String[] { "xml", "XML" }; + List files = (List) FileUtils.listFiles(xmlDir, extensions, true); + for (File file : files) { + logger.info("Loading DG XML file :" + file.getCanonicalPath()); + try{ + SvcLogicParser.load(file.getCanonicalPath(), this.store); + }catch (Exception e) { + errors.add("Failed to load XML "+file.getCanonicalPath() + ", Exception : "+e.getMessage()); + } + } + }else{ + throw new Exception(xmlPath + " is not a valid XML Directory"); + } + }else{ + throw new Exception("Failed to initialise SvcLogicStore"); + } + + if(errors.size() > 0){ + throw new Exception(errors.toString()); + } + } catch (Exception e) { + logger.error(e.getMessage()); + } + } + + public void activateDg(String activateFilePath) throws Exception { + logger.info("******************** Activating DG into Database *****************************"); + try { + List errors = new ArrayList(); + if(this.store != null){ + File activateFile = new File(activateFilePath); + if(activateFile.isFile()){ + List fileLines = FileUtils.readLines(activateFile,STRING_ENCODING); + if(fileLines != null ){ + for (String line : fileLines) { + if(line != null && ! line.trim().startsWith("#")){ + String lineArray[] = line.trim().split(":"); + try { + if(lineArray != null && lineArray.length >= 4){ + String module = lineArray[0]; + String rpc = lineArray[1]; + String version = lineArray[2]; + String mode = lineArray[3]; + if(StringUtils.isNotBlank(module) && StringUtils.isNotBlank(rpc) + && StringUtils.isNotBlank(version) && StringUtils.isNotBlank(mode)){ + logger.info("Activating DG :" + line); + SvcLogicGraph graph = this.store.fetch(module, rpc, version, mode); + if(graph != null){ + logger.info("Found Graph :" + line + " Activating ..."); + this.store.activate(graph); + }else{ + throw new Exception("Failed to fetch from Database"); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + errors.add("Failed to Activate "+line + ", "+e.getMessage()); + } + } + } + } + }else{ + throw new Exception(activateFile + " is not a valid Activate file Path"); + } + }else{ + throw new Exception("Failed to initialise SvcLogicStore"); + } + + if(errors.size() > 0){ + throw new Exception(errors.toString()); + } + } catch (Exception e) { + logger.error(e.getMessage()); + } + } + + + public static void main(String[] args) { + try { + String xmlPath = null; + String propertyPath = null; + String activateFile = null; + + if(args != null && args.length >= 3){ + xmlPath = args[0]; + activateFile = args[1]; + propertyPath = args[2]; + }else{ + throw new Exception("Sufficient inputs for DGXMLLoadNActivate are missing "); + } + + //propertyPath = "/Users/bs2796/0Source/ecomp/bvc-3.2.2/others/properties/dblib.properties"; + //xmlPath = DGXMLLoadNActivate.class.getClassLoader().getResource(".").getPath() +"/xml" ; + + DGXMLLoadNActivate dgXMLLoadDB = new DGXMLLoadNActivate(propertyPath); + dgXMLLoadDB.loadDGXMLDir(xmlPath); + dgXMLLoadDB.activateDg(activateFile); + } catch (Exception e) { + e.printStackTrace(); + }finally { + System.exit(1); + } + } +} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGLoaderActivator.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGLoaderActivator.java deleted file mode 100644 index 99f7f8b6c..000000000 --- a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGLoaderActivator.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============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.sdnc.dg.loader; - -import java.util.LinkedList; -import java.util.List; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -public class DGLoaderActivator implements BundleActivator{ - - private List registrations = new LinkedList(); - - - private static final EELFLogger log = EELFManager.getInstance().getLogger(DGLoaderActivator.class); - - @Override - public void start(BundleContext ctx) throws Exception - { - - - - } - @Override - public void stop(BundleContext arg0) throws Exception - { - for (ServiceRegistration registration: registrations) - { - registration.unregister(); - registration = null; - } - - } - -} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLActivate.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLActivate.java deleted file mode 100644 index 6af447742..000000000 --- a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLActivate.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdnc.dg.loader; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; -import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; -import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - - -public class DGXMLActivate { - - private final static Logger logger = LoggerFactory.getLogger(DGXMLLoadNActivate.class); - private final SvcLogicStore store; - public static String STRING_ENCODING = "utf-8"; - - public DGXMLActivate(String propfile) throws Exception{ - if(StringUtils.isBlank(propfile)){ - throw new Exception(propfile + " Profile file is not defined"); - } - this.store = SvcLogicStoreFactory.getSvcLogicStore(propfile); - } - - protected DGXMLActivate(SvcLogicStore store) { - this.store = store; - } - - - public void activateDg(String activateFilePath) throws Exception { - logger.info("******************** Activating DG into Database *****************************"); - try { - List errors = new ArrayList(); - if(this.store != null){ - File activateFile = new File(activateFilePath); - if(activateFile != null && activateFile.isFile()){ - List fileLines = FileUtils.readLines(activateFile,STRING_ENCODING); - if(fileLines != null ){ - for (String line : fileLines) { - if(line != null && ! line.trim().startsWith("#")){ - String lineArray[] = line.trim().split(":"); - try { - if(lineArray != null && lineArray.length >= 4){ - String module = lineArray[0]; - String rpc = lineArray[1]; - String version = lineArray[2]; - String mode = lineArray[3]; - if(StringUtils.isNotBlank(module) && StringUtils.isNotBlank(rpc) - && StringUtils.isNotBlank(version) && StringUtils.isNotBlank(mode)){ - logger.info("Activating DG :" + line); - SvcLogicGraph graph = this.store.fetch(module, rpc, version, mode); - if(graph != null){ - logger.info("Found Graph :" + line + " Activating ..."); - this.store.activate(graph); - }else{ - throw new Exception("Failed to fetch from Database"); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - errors.add("Failed to Activate "+line + ", "+e.getMessage()); - } - } - } - } - }else{ - throw new Exception(activateFile + " is not a valid Activate file Path"); - } - }else{ - throw new Exception("Failed to initialise SvcLogicStore"); - } - - if(errors.size() > 0){ - throw new Exception(errors.toString()); - } - } catch (Exception e) { - logger.error(e.getMessage()); - } - } - - - public static void main(String[] args) { - try { - String activateFile = null; - String propertyPath = null; - - if(args != null && args.length >= 2){ - activateFile = args[0]; - propertyPath = args[1]; - }else{ - throw new Exception("Sufficient inputs for DGXMLActivate are missing "); - } - - DGXMLActivate dgXmlActivate = new DGXMLActivate(propertyPath); - dgXmlActivate.activateDg(activateFile); - } catch (Exception e) { - e.printStackTrace(); - }finally { - System.exit(1); - } - } - -} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLGenerator.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLGenerator.java deleted file mode 100644 index 60fcd5ba8..000000000 --- a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLGenerator.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============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.sdnc.dg.loader; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import javax.script.Invocable; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class DGXMLGenerator { - private final static Logger logger = LoggerFactory.getLogger(DGXMLGenerator.class); - - public static String STRING_ENCODING = "utf-8"; - public static String JS_INTERFACE_DG_CONVERTOR = "dgconverter"; - public static String JS_METHOD_GET_NODE_TO_XML = "getNodeToXml"; - public static String GENERATOR_TEMPLATE_FILE = "js/dg_xml2json.js"; - - public void generateXMLFromJSON(String jsonPath, String xmlpath, String propertyPath) throws Exception { - try{ - ScriptEngineManager manager = new ScriptEngineManager(); - ScriptEngine engine = manager.getEngineByName("JavaScript"); - if (!(engine instanceof Invocable)) { - logger.error("Invoking methods is not supported."); - return; - } - Invocable inv = (Invocable) engine; - // engine.eval(new FileReader(DGXMLGenerator.class.getClassLoader().getResource(GENERATOR_TEMPLATE_FILE).getPath())); - String js = IOUtils.toString(DGXMLGenerator.class.getClassLoader().getResourceAsStream(GENERATOR_TEMPLATE_FILE),STRING_ENCODING); - engine.eval(js); - - Object dgconverter = engine.get(JS_INTERFACE_DG_CONVERTOR); - - List files = new ArrayList(); - if(dgconverter != null){ - File jsonPathFile = new File(jsonPath); - if(jsonPathFile.isDirectory()){ - String[] extensions = new String[] { "json", "JSON" }; - files = (List) FileUtils.listFiles(jsonPathFile, extensions, true); - }else if(jsonPathFile.isFile()){ - files.add(jsonPathFile); - }else{ - throw new Exception("Failed to get the nature of the JSON path :"+ jsonPath); - } - - logger.info("JSON Files identified "+ files.size()); - - if(files.size() > 0){ - boolean isXmlPathDeleted = FileUtils.deleteQuietly(new File(xmlpath)); - logger.info("Cleaning old DG XML under : " + xmlpath + ", delete status :" + isXmlPathDeleted); - - for (File file : files) { - String dgJson = FileUtils.readFileToString(file,STRING_ENCODING); - logger.info("Generating XML from :" + file.getName()); - String xmlFileName = xmlpath +"/"+file.getName().replace(".json", ".xml"); - - Object dgXMl = inv.invokeMethod(dgconverter, JS_METHOD_GET_NODE_TO_XML, dgJson); - // Write the XML File - if(dgXMl != null){ - File xmlFile = new File(xmlFileName); - FileUtils.writeStringToFile(xmlFile, dgXMl.toString(), STRING_ENCODING); - logger.info("Generated XML File under :" + xmlFile.getCanonicalPath()); - } - } - - }else{ - logger.info("No JSON Files to generate XML"); - } - }else{ - logger.error("Couldn't get Java Script Engine.."); - } - }catch (Exception e) { - logger.error("Failed to generate generateXMLFromJSON :"+e.getMessage()); - } - } - - - public static void main(String[] args) { - try { - DGXMLGenerator application = new DGXMLGenerator(); - String jsonPath = null; - String xmlPath = null; - String propertyPath = null; - // Generate, GenerateLoad, GenerateLoadActivate - //args = new String[]{"src/main/resources/json","src/test/resources/xml"}; - logger.info("DGXML Conversion Started with arguments :"+ args[0] +":"+ args[1]); - if(args != null && args.length >= 2){ - jsonPath = args[0]; - xmlPath = args[1]; - }else{ - throw new Exception("Sufficient inputs are missing "); - } - - application.generateXMLFromJSON(jsonPath, xmlPath, propertyPath); - logger.info("DGXML Conversion Completed..."); - } catch (Exception e) { - logger.error("Failed in DG XML Generation :"+e.getMessage()); - e.printStackTrace(); - } - - } - -} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoad.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoad.java deleted file mode 100644 index 1b6116cc3..000000000 --- a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoad.java +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APP-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdnc.dg.loader; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicParser; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; -import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; - -public class DGXMLLoad { - private final static Logger logger = LoggerFactory.getLogger(DGXMLLoad.class); - private final SvcLogicStore store; - public static String STRING_ENCODING = "utf-8"; - - public DGXMLLoad(String propfile) throws Exception{ - if(StringUtils.isBlank(propfile)){ - throw new Exception(propfile + " Profile file is not defined"); - } - this.store = SvcLogicStoreFactory.getSvcLogicStore(propfile); - } - - protected DGXMLLoad(SvcLogicStore store) throws Exception { - this.store=store; - } - - public void loadDGXMLFile(String dgXMLpath) throws SvcLogicException{ - if(dgXMLpath != null ){ - SvcLogicParser.load(dgXMLpath, this.store); - } - } - - private void loadDGXMLDir(String xmlPath) throws Exception { - try { - logger.info("******************** Loading DG into Database *****************************"); - List errors = new ArrayList(); - if(this.store != null){ - File xmlDir = new File(xmlPath); - if(xmlDir != null && xmlDir.isDirectory()){ - String[] extensions = new String[] { "xml", "XML" }; - List files = (List) FileUtils.listFiles(xmlDir, extensions, true); - for (File file : files) { - logger.info("Loading DG XML file :" + file.getCanonicalPath()); - try{ - SvcLogicParser.load(file.getCanonicalPath(), this.store); - }catch (Exception e) { - errors.add("Failed to load XML "+file.getCanonicalPath() + ", Exception : "+e.getMessage()); - } - } - }else{ - throw new Exception(xmlPath + " is not a valid XML Directory"); - } - }else{ - throw new Exception("Failed to initialise SvcLogicStore"); - } - - if(errors.size() > 0){ - throw new Exception(errors.toString()); - } - } catch (Exception e) { - logger.error(e.getMessage()); - } - } - - public static void main(String[] args) { - try { - String xmlPath = null; - String propertyPath = null; - - if(args != null && args.length >= 2){ - xmlPath = args[0]; - propertyPath = args[1]; - }else{ - throw new Exception("Sufficient inputs for DGXMLLoadNActivate are missing "); - } - DGXMLLoad dgXMLLoadDB = new DGXMLLoad(propertyPath); - dgXMLLoadDB.loadDGXMLDir(xmlPath); - } catch (Exception e) { - e.printStackTrace(); - }finally { - System.exit(1); - } - } - -} diff --git a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoadNActivate.java b/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoadNActivate.java deleted file mode 100644 index 54f109177..000000000 --- a/appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoadNActivate.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APP-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdnc.dg.loader; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; -import org.onap.ccsdk.sli.core.sli.SvcLogicParser; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; -import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; - -public class DGXMLLoadNActivate { - private final static Logger logger = LoggerFactory.getLogger(DGXMLLoadNActivate.class); - private final SvcLogicStore store; - public static String STRING_ENCODING = "utf-8"; - - public DGXMLLoadNActivate(String propfile) throws Exception{ - if(StringUtils.isBlank(propfile)){ - throw new Exception(propfile + " Profile file is not defined"); - } - this.store = SvcLogicStoreFactory.getSvcLogicStore(propfile); - } - - protected DGXMLLoadNActivate(SvcLogicStore store) { - this.store=store; - } - - public void loadDGXMLFile(String dgXMLpath) throws SvcLogicException{ - if(dgXMLpath != null ){ - SvcLogicParser.load(dgXMLpath, this.store); - } - } - - private void loadDGXMLDir(String xmlPath) throws Exception { - try { - logger.info("******************** Loading DG into Database *****************************"); - List errors = new ArrayList(); - if(this.store != null){ - File xmlDir = new File(xmlPath); - if(xmlDir.isDirectory()){ - String[] extensions = new String[] { "xml", "XML" }; - List files = (List) FileUtils.listFiles(xmlDir, extensions, true); - for (File file : files) { - logger.info("Loading DG XML file :" + file.getCanonicalPath()); - try{ - SvcLogicParser.load(file.getCanonicalPath(), this.store); - }catch (Exception e) { - errors.add("Failed to load XML "+file.getCanonicalPath() + ", Exception : "+e.getMessage()); - } - } - }else{ - throw new Exception(xmlPath + " is not a valid XML Directory"); - } - }else{ - throw new Exception("Failed to initialise SvcLogicStore"); - } - - if(errors.size() > 0){ - throw new Exception(errors.toString()); - } - } catch (Exception e) { - logger.error(e.getMessage()); - } - } - - public void activateDg(String activateFilePath) throws Exception { - logger.info("******************** Activating DG into Database *****************************"); - try { - List errors = new ArrayList(); - if(this.store != null){ - File activateFile = new File(activateFilePath); - if(activateFile.isFile()){ - List fileLines = FileUtils.readLines(activateFile,STRING_ENCODING); - if(fileLines != null ){ - for (String line : fileLines) { - if(line != null && ! line.trim().startsWith("#")){ - String lineArray[] = line.trim().split(":"); - try { - if(lineArray != null && lineArray.length >= 4){ - String module = lineArray[0]; - String rpc = lineArray[1]; - String version = lineArray[2]; - String mode = lineArray[3]; - if(StringUtils.isNotBlank(module) && StringUtils.isNotBlank(rpc) - && StringUtils.isNotBlank(version) && StringUtils.isNotBlank(mode)){ - logger.info("Activating DG :" + line); - SvcLogicGraph graph = this.store.fetch(module, rpc, version, mode); - if(graph != null){ - logger.info("Found Graph :" + line + " Activating ..."); - this.store.activate(graph); - }else{ - throw new Exception("Failed to fetch from Database"); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - errors.add("Failed to Activate "+line + ", "+e.getMessage()); - } - } - } - } - }else{ - throw new Exception(activateFile + " is not a valid Activate file Path"); - } - }else{ - throw new Exception("Failed to initialise SvcLogicStore"); - } - - if(errors.size() > 0){ - throw new Exception(errors.toString()); - } - } catch (Exception e) { - logger.error(e.getMessage()); - } - } - - - public static void main(String[] args) { - try { - String xmlPath = null; - String propertyPath = null; - String activateFile = null; - - if(args != null && args.length >= 3){ - xmlPath = args[0]; - activateFile = args[1]; - propertyPath = args[2]; - }else{ - throw new Exception("Sufficient inputs for DGXMLLoadNActivate are missing "); - } - - //propertyPath = "/Users/bs2796/0Source/ecomp/bvc-3.2.2/others/properties/dblib.properties"; - //xmlPath = DGXMLLoadNActivate.class.getClassLoader().getResource(".").getPath() +"/xml" ; - - DGXMLLoadNActivate dgXMLLoadDB = new DGXMLLoadNActivate(propertyPath); - dgXMLLoadDB.loadDGXMLDir(xmlPath); - dgXMLLoadDB.activateDg(activateFile); - } catch (Exception e) { - e.printStackTrace(); - }finally { - System.exit(1); - } - } -} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/DGLoaderTest.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/DGLoaderTest.java new file mode 100644 index 000000000..084929bc7 --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/DGLoaderTest.java @@ -0,0 +1,188 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdnc.dg.loader; + +import static org.junit.Assert.*; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; +import org.eclipse.osgi.framework.internal.core.BundleContextImpl; +import org.eclipse.osgi.framework.internal.core.BundleHost; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.ccsdk.sli.core.sli.ConfigurationException; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; +import org.osgi.framework.BundleContext; +import org.powermock.reflect.Whitebox; +import org.powermock.*; + +public class DGLoaderTest { + + @Test + public void testXMLGenerator() throws Exception { + DGXMLGenerator application = new DGXMLGenerator(); + String jsonPath = null; + String xmlPath = null; + String propertyPath = "somePath"; + // Generate, GenerateLoad, GenerateLoadActivate + String []args = new String[]{"src/test/resources/json","src/test/resources/xml"}; + //logger.info("DGXML Conversion Started with arguments :"+ args[0] +":"+ args[1]); + if(args != null && args.length >= 2){ + jsonPath = args[0]; + xmlPath = args[1]; + } + + application.generateXMLFromJSON(jsonPath, xmlPath, propertyPath); + File dir=new File("src/test/resources/xml"); + String extensions[]=new String[] {"xml","XML"}; + List files = new ArrayList(); + files=(List) FileUtils.listFiles(dir, extensions, true); + assertNotNull(files.get(0)); + assertNotNull(files.get(0).getName()); + } + + @Test + public void testXMLGeneratorMain() throws Exception { + String []args = new String[]{"src/test/resources/json","src/test/resources/xml"}; + DGXMLGenerator.main(args); + File dir=new File("src/test/resources/xml"); + String extensions[]=new String[] {"xml","XML"}; + List files = new ArrayList(); + files=(List) FileUtils.listFiles(dir, extensions, true); + assertNotNull(files.get(0)); + assertNotNull(files.get(0).getName()); + } + + @Test + public void testDGLoader() throws Exception { + String propertyPath = "src/test/resources/dummy.properties"; + String xmlPath = "src/test/resources/xml/Appc_UniTest.xml"; + DGXMLLoad dgXMLLoad = new MockDGXMLLoad(); + dgXMLLoad.loadDGXMLFile(xmlPath); + } + + @Test + public void testDGLoaderWithDir() throws Exception { + String propertyPath = "src/test/resources/dummy.properties"; + String xmlPath = "src/test/resources/xml"; + DGXMLLoad dgXMLLoad = new MockDGXMLLoad(); + Whitebox.invokeMethod(dgXMLLoad, "loadDGXMLDir",xmlPath); + } + + @Test + public void testDGLoaderWithDirThrowsException() throws Exception { + String propertyPath = "src/test/resources/dummy.properties"; + String xmlPath = "src/test/resources/xml/xml"; + DGXMLLoad dgXMLLoad = new MockDGXMLLoad(); + Whitebox.invokeMethod(dgXMLLoad, "loadDGXMLDir",xmlPath); + } + + @Test + public void testDGActivate() throws Exception { + String propertyPath = "src/test/resources/dummy.properties"; + String activateFilePath = "src/test/resources/dg_activate_test"; + DGXMLActivate dgXMLActivate = new MockDGXMLActivate(); + dgXMLActivate.activateDg(activateFilePath); + + } + + @Test + public void testDGActivateThrowsException() throws Exception { + String propertyPath = "src/test/resources/dummy.properties"; + String activateFilePath = "src/test/resources/someFile"; + DGXMLActivate dgXMLActivate = new MockDGXMLActivate(); + dgXMLActivate.activateDg(activateFilePath); + + } + + @Test + public void testDGLoadNActivate() throws Exception { + String propertyPath = "src/test/resources/dummy.properties"; + String activateFilePath = "src/test/resources/dg_activate_test"; + String xmlPath = "src/test/resources/xml/Appc_UniTest.xml"; + DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); + dgXMLLoadNActivate.loadDGXMLFile(xmlPath); + dgXMLLoadNActivate.activateDg(activateFilePath); + } + + @Test + public void testDGLoadNActivateThrowsException() throws Exception { + String propertyPath = "src/test/resources/dummy.properties"; + String activateFilePath = "src/test/resources/someFile"; + String xmlPath = "src/test/resources/xml/Appc_UniTest.xml"; + DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); + dgXMLLoadNActivate.loadDGXMLFile(xmlPath); + dgXMLLoadNActivate.activateDg(activateFilePath); + } + + @Test + public void testDGLoadNActivateloadDGXMLDir() throws Exception { + String xmlPath = "src/test/resources/xml"; + DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); + Whitebox.invokeMethod(dgXMLLoadNActivate,"loadDGXMLDir",xmlPath); + } + + + public void testDGLoadNActivateloadDGXMLDirThrowsException() throws Exception { + String xmlPath = "src/test/resources/someDir"; + DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); + Whitebox.invokeMethod(dgXMLLoadNActivate,"loadDGXMLDir",xmlPath); + } + + @Test + public void testDGLoaderActivator() throws Exception { + String xmlPath = "src/test/resources/xml"; + DGLoaderActivator dgLoaderActivator = new DGLoaderActivator(); + dgLoaderActivator.start(null); + dgLoaderActivator.stop(null); + assertTrue(true); + } + + @Test (expected=Exception.class) + public void testDGActivateConstructorThrowsException() throws Exception { + String somePath=""; + DGXMLActivate dgXMLActivate = new DGXMLActivate(somePath); + } + + @Test (expected=Exception.class) + public void testDGXMLLoadConstructorThrowsException() throws Exception { + String somePath=""; + DGXMLLoad dgXMLLoad = new DGXMLLoad(somePath); + } + + @Test (expected=Exception.class) + public void testDGLoadNActivateConstructorThrowsException() throws Exception { + String somePath=""; + DGXMLLoadNActivate dgXMLLoadNActivate = new DGXMLLoadNActivate(somePath); + } + +} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivate.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivate.java new file mode 100644 index 000000000..41f1d09f8 --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivate.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdnc.dg.loader; + +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; + +public class MockDGXMLActivate extends DGXMLActivate { + private final static SvcLogicStore storeChild=MockSvcLogicFactory.getMockSvcLogicStore();; + MockDGXMLActivate() throws Exception { + super(storeChild); + } + +} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoad.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoad.java new file mode 100644 index 000000000..27336d38d --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoad.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdnc.dg.loader; + +import org.mockito.internal.util.reflection.Whitebox; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; + +public class MockDGXMLLoad extends DGXMLLoad{ + + private final static SvcLogicStore storeChild=MockSvcLogicFactory.getMockSvcLogicStore();; + MockDGXMLLoad() throws Exception { + super(storeChild); + } + +} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoadNActivate.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoadNActivate.java new file mode 100644 index 000000000..f60e6ab12 --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoadNActivate.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdnc.dg.loader; + +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; + +public class MockDGXMLLoadNActivate extends DGXMLLoadNActivate { + private final static SvcLogicStore storeChild=MockSvcLogicFactory.getMockSvcLogicStore();; + MockDGXMLLoadNActivate() throws Exception { + super(storeChild); + } +} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockSvcLogicDblibStore.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockSvcLogicDblibStore.java new file mode 100644 index 000000000..fdfe0ab1b --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockSvcLogicDblibStore.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdnc.dg.loader; + +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.SvcLogicDblibStore; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; + +public class MockSvcLogicDblibStore implements SvcLogicStore { + + @Override + public boolean hasGraph(String module, String rpc, String version, + String mode) { + return true; + } + @Override + public SvcLogicGraph fetch(String module, String rpc, String version, + String mode) throws SvcLogicException { + SvcLogicGraph retVal=new SvcLogicGraph(); + retVal.setMode("sync"); + retVal.setModule("Appc"); + retVal.setRpc("unitTestDG"); + retVal.setVersion("4.0.0"); + return retVal; + + } + @Override + public void store(SvcLogicGraph graph) throws SvcLogicException { + + } + @Override + public void init(Properties props) throws SvcLogicException { + // TODO Auto-generated method stub + + } + @Override + public void registerNodeType(String nodeType) throws SvcLogicException { + // TODO Auto-generated method stub + + } + @Override + public void unregisterNodeType(String nodeType) throws SvcLogicException { + // TODO Auto-generated method stub + + } + @Override + public boolean isValidNodeType(String nodeType) throws SvcLogicException { + // TODO Auto-generated method stub + return true; + } + @Override + public void delete(String module, String rpc, String version, String mode) throws SvcLogicException { + // TODO Auto-generated method stub + + } + @Override + public void activate(SvcLogicGraph graph) throws SvcLogicException { + // TODO Auto-generated method stub + + } +} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockSvcLogicFactory.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockSvcLogicFactory.java new file mode 100644 index 000000000..82f75a0f8 --- /dev/null +++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockSvcLogicFactory.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdnc.dg.loader; + +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; +import org.onap.ccsdk.sli.core.sli.SvcLogicDblibStore; + +public class MockSvcLogicFactory extends SvcLogicStoreFactory { + static SvcLogicStore getMockSvcLogicStore() { + SvcLogicStore store=new MockSvcLogicDblibStore(); + return store; + } +} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/DGLoaderTest.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/DGLoaderTest.java deleted file mode 100644 index 084929bc7..000000000 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/DGLoaderTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdnc.dg.loader; - -import static org.junit.Assert.*; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.apache.commons.io.FileUtils; -import org.eclipse.osgi.framework.internal.core.BundleContextImpl; -import org.eclipse.osgi.framework.internal.core.BundleHost; -import org.junit.Rule; -import org.junit.Test; -import org.mockito.Mockito; -import org.onap.ccsdk.sli.core.sli.ConfigurationException; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; -import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; -import org.osgi.framework.BundleContext; -import org.powermock.reflect.Whitebox; -import org.powermock.*; - -public class DGLoaderTest { - - @Test - public void testXMLGenerator() throws Exception { - DGXMLGenerator application = new DGXMLGenerator(); - String jsonPath = null; - String xmlPath = null; - String propertyPath = "somePath"; - // Generate, GenerateLoad, GenerateLoadActivate - String []args = new String[]{"src/test/resources/json","src/test/resources/xml"}; - //logger.info("DGXML Conversion Started with arguments :"+ args[0] +":"+ args[1]); - if(args != null && args.length >= 2){ - jsonPath = args[0]; - xmlPath = args[1]; - } - - application.generateXMLFromJSON(jsonPath, xmlPath, propertyPath); - File dir=new File("src/test/resources/xml"); - String extensions[]=new String[] {"xml","XML"}; - List files = new ArrayList(); - files=(List) FileUtils.listFiles(dir, extensions, true); - assertNotNull(files.get(0)); - assertNotNull(files.get(0).getName()); - } - - @Test - public void testXMLGeneratorMain() throws Exception { - String []args = new String[]{"src/test/resources/json","src/test/resources/xml"}; - DGXMLGenerator.main(args); - File dir=new File("src/test/resources/xml"); - String extensions[]=new String[] {"xml","XML"}; - List files = new ArrayList(); - files=(List) FileUtils.listFiles(dir, extensions, true); - assertNotNull(files.get(0)); - assertNotNull(files.get(0).getName()); - } - - @Test - public void testDGLoader() throws Exception { - String propertyPath = "src/test/resources/dummy.properties"; - String xmlPath = "src/test/resources/xml/Appc_UniTest.xml"; - DGXMLLoad dgXMLLoad = new MockDGXMLLoad(); - dgXMLLoad.loadDGXMLFile(xmlPath); - } - - @Test - public void testDGLoaderWithDir() throws Exception { - String propertyPath = "src/test/resources/dummy.properties"; - String xmlPath = "src/test/resources/xml"; - DGXMLLoad dgXMLLoad = new MockDGXMLLoad(); - Whitebox.invokeMethod(dgXMLLoad, "loadDGXMLDir",xmlPath); - } - - @Test - public void testDGLoaderWithDirThrowsException() throws Exception { - String propertyPath = "src/test/resources/dummy.properties"; - String xmlPath = "src/test/resources/xml/xml"; - DGXMLLoad dgXMLLoad = new MockDGXMLLoad(); - Whitebox.invokeMethod(dgXMLLoad, "loadDGXMLDir",xmlPath); - } - - @Test - public void testDGActivate() throws Exception { - String propertyPath = "src/test/resources/dummy.properties"; - String activateFilePath = "src/test/resources/dg_activate_test"; - DGXMLActivate dgXMLActivate = new MockDGXMLActivate(); - dgXMLActivate.activateDg(activateFilePath); - - } - - @Test - public void testDGActivateThrowsException() throws Exception { - String propertyPath = "src/test/resources/dummy.properties"; - String activateFilePath = "src/test/resources/someFile"; - DGXMLActivate dgXMLActivate = new MockDGXMLActivate(); - dgXMLActivate.activateDg(activateFilePath); - - } - - @Test - public void testDGLoadNActivate() throws Exception { - String propertyPath = "src/test/resources/dummy.properties"; - String activateFilePath = "src/test/resources/dg_activate_test"; - String xmlPath = "src/test/resources/xml/Appc_UniTest.xml"; - DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); - dgXMLLoadNActivate.loadDGXMLFile(xmlPath); - dgXMLLoadNActivate.activateDg(activateFilePath); - } - - @Test - public void testDGLoadNActivateThrowsException() throws Exception { - String propertyPath = "src/test/resources/dummy.properties"; - String activateFilePath = "src/test/resources/someFile"; - String xmlPath = "src/test/resources/xml/Appc_UniTest.xml"; - DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); - dgXMLLoadNActivate.loadDGXMLFile(xmlPath); - dgXMLLoadNActivate.activateDg(activateFilePath); - } - - @Test - public void testDGLoadNActivateloadDGXMLDir() throws Exception { - String xmlPath = "src/test/resources/xml"; - DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); - Whitebox.invokeMethod(dgXMLLoadNActivate,"loadDGXMLDir",xmlPath); - } - - - public void testDGLoadNActivateloadDGXMLDirThrowsException() throws Exception { - String xmlPath = "src/test/resources/someDir"; - DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); - Whitebox.invokeMethod(dgXMLLoadNActivate,"loadDGXMLDir",xmlPath); - } - - @Test - public void testDGLoaderActivator() throws Exception { - String xmlPath = "src/test/resources/xml"; - DGLoaderActivator dgLoaderActivator = new DGLoaderActivator(); - dgLoaderActivator.start(null); - dgLoaderActivator.stop(null); - assertTrue(true); - } - - @Test (expected=Exception.class) - public void testDGActivateConstructorThrowsException() throws Exception { - String somePath=""; - DGXMLActivate dgXMLActivate = new DGXMLActivate(somePath); - } - - @Test (expected=Exception.class) - public void testDGXMLLoadConstructorThrowsException() throws Exception { - String somePath=""; - DGXMLLoad dgXMLLoad = new DGXMLLoad(somePath); - } - - @Test (expected=Exception.class) - public void testDGLoadNActivateConstructorThrowsException() throws Exception { - String somePath=""; - DGXMLLoadNActivate dgXMLLoadNActivate = new DGXMLLoadNActivate(somePath); - } - -} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLActivate.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLActivate.java deleted file mode 100644 index 41f1d09f8..000000000 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLActivate.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdnc.dg.loader; - -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; - -public class MockDGXMLActivate extends DGXMLActivate { - private final static SvcLogicStore storeChild=MockSvcLogicFactory.getMockSvcLogicStore();; - MockDGXMLActivate() throws Exception { - super(storeChild); - } - -} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoad.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoad.java deleted file mode 100644 index 27336d38d..000000000 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoad.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdnc.dg.loader; - -import org.mockito.internal.util.reflection.Whitebox; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; - -public class MockDGXMLLoad extends DGXMLLoad{ - - private final static SvcLogicStore storeChild=MockSvcLogicFactory.getMockSvcLogicStore();; - MockDGXMLLoad() throws Exception { - super(storeChild); - } - -} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoadNActivate.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoadNActivate.java deleted file mode 100644 index f60e6ab12..000000000 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoadNActivate.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdnc.dg.loader; - -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; - -public class MockDGXMLLoadNActivate extends DGXMLLoadNActivate { - private final static SvcLogicStore storeChild=MockSvcLogicFactory.getMockSvcLogicStore();; - MockDGXMLLoadNActivate() throws Exception { - super(storeChild); - } -} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicDblibStore.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicDblibStore.java deleted file mode 100644 index fdfe0ab1b..000000000 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicDblibStore.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdnc.dg.loader; - -import java.util.Properties; - -import org.onap.ccsdk.sli.core.sli.SvcLogicDblibStore; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; - -public class MockSvcLogicDblibStore implements SvcLogicStore { - - @Override - public boolean hasGraph(String module, String rpc, String version, - String mode) { - return true; - } - @Override - public SvcLogicGraph fetch(String module, String rpc, String version, - String mode) throws SvcLogicException { - SvcLogicGraph retVal=new SvcLogicGraph(); - retVal.setMode("sync"); - retVal.setModule("Appc"); - retVal.setRpc("unitTestDG"); - retVal.setVersion("4.0.0"); - return retVal; - - } - @Override - public void store(SvcLogicGraph graph) throws SvcLogicException { - - } - @Override - public void init(Properties props) throws SvcLogicException { - // TODO Auto-generated method stub - - } - @Override - public void registerNodeType(String nodeType) throws SvcLogicException { - // TODO Auto-generated method stub - - } - @Override - public void unregisterNodeType(String nodeType) throws SvcLogicException { - // TODO Auto-generated method stub - - } - @Override - public boolean isValidNodeType(String nodeType) throws SvcLogicException { - // TODO Auto-generated method stub - return true; - } - @Override - public void delete(String module, String rpc, String version, String mode) throws SvcLogicException { - // TODO Auto-generated method stub - - } - @Override - public void activate(SvcLogicGraph graph) throws SvcLogicException { - // TODO Auto-generated method stub - - } -} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicFactory.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicFactory.java deleted file mode 100644 index 82f75a0f8..000000000 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdnc.dg.loader; - -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; -import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; -import org.onap.ccsdk.sli.core.sli.SvcLogicDblibStore; - -public class MockSvcLogicFactory extends SvcLogicStoreFactory { - static SvcLogicStore getMockSvcLogicStore() { - SvcLogicStore store=new MockSvcLogicDblibStore(); - return store; - } -} -- cgit 1.2.3-korg