aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appc-config/appc-config-adaptor/provider/pom.xml243
-rw-r--r--appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/ConfigComponentAdaptorTest.java251
-rw-r--r--appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/DebugLogTest.java38
-rw-r--r--appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/EncryptionToolTest.java46
-rw-r--r--appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/SshJcraftWrapperTest.java105
-rw-r--r--appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/XmlUtilTest.java42
-rw-r--r--appc-directed-graph/dg-loader/provider/pom.xml12
-rw-r--r--appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLActivate.java12
-rw-r--r--appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoad.java9
-rw-r--r--appc-directed-graph/dg-loader/provider/src/main/java/org/openecomp/sdnc/dg/loader/DGXMLLoadNActivate.java9
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/DGLoaderTest.java188
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLActivate.java35
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoad.java37
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockDGXMLLoadNActivate.java34
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicDblibStore.java86
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/sdnc/dg/loader/MockSvcLogicFactory.java36
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/resources/dg_activate_test3
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/resources/dummy.properties38
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/resources/json/Appc_UniTest.json1
-rw-r--r--appc-directed-graph/dg-loader/provider/src/test/resources/xml/Appc_UniTest.xml5
20 files changed, 1147 insertions, 83 deletions
diff --git a/appc-config/appc-config-adaptor/provider/pom.xml b/appc-config/appc-config-adaptor/provider/pom.xml
index 48acd8d92..f21d5516c 100644
--- a/appc-config/appc-config-adaptor/provider/pom.xml
+++ b/appc-config/appc-config-adaptor/provider/pom.xml
@@ -1,97 +1,182 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
- <modelVersion>4.0.0</modelVersion>
+ http://www.apache.org/licenses/LICENSE-2.0
- <parent>
- <groupId>org.openecomp.appc</groupId>
- <artifactId>appc-config-adaptor</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </parent>
+ 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.
- <artifactId>appc-config-adaptor-provider</artifactId>
- <packaging>bundle</packaging>
- <name>Config Component Adaptor - Provider</name>
- <url>http://maven.apache.org</url>
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ ============LICENSE_END=========================================================
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-adaptor</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <artifactId>appc-config-adaptor-provider</artifactId>
+ <packaging>bundle</packaging>
+ <name>APPC Config Component Adaptor - Provider</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <licenseDir>${project.parent.parent.parent.basedir}</licenseDir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.openecomp.sdnc.core</groupId>
- <artifactId>sli-common</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdnc.core</groupId>
- <artifactId>sli-provider</artifactId>
- <scope>compile</scope>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- </dependency>
+ <!--
+ this comes from brocade parent (app-cntrl) , not sure about opendaylight (onap)
+ value was <slf4j.version>1.7.2</slf4j.version>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.52</version>
- </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ -->
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.1</version>
- </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xerces</artifactId>
- <version>2.4.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-client</artifactId>
- <version>1.17</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jasypt</groupId>
- <artifactId>jasypt</artifactId>
- <version>1.9.2</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>com.jcraft</groupId>
+ <artifactId>jsch</artifactId>
+ <version>0.1.52</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.1</version>
+ </dependency>
- <build>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xerces</artifactId>
+ <version>2.4.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-client</artifactId>
+ <version>1.17</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jasypt</groupId>
+ <artifactId>jasypt</artifactId>
+ <version>1.9.2</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>appc.config.adaptor</Bundle-SymbolicName>
- <Bundle-Activator>org.openecomp.appc.config.adaptor.CCAActivator</Bundle-Activator>
- <Export-Package>org.openecomp.appc.config.adaptor</Export-Package>
- <Import-Package>*</Import-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
- </configuration>
- </plugin>
- </plugins>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>appc.config.adaptor</Bundle-SymbolicName>
+ <Bundle-Activator>org.openecomp.appc.ccadaptor.CCAActivator</Bundle-Activator>
+ <Export-Package>org.openecomp.appc.adaptor</Export-Package>
+ <Import-Package>*</Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+ </configuration>
+ </plugin>
- </build>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ com.brocade.developer
+ </groupId>
+ <artifactId>
+ providermodule-plugin
+ </artifactId>
+ <versionRange>
+ [1.2.0.100-SNAPSHOT,)
+ </versionRange>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
diff --git a/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/ConfigComponentAdaptorTest.java b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/ConfigComponentAdaptorTest.java
new file mode 100644
index 000000000..17331eea4
--- /dev/null
+++ b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/ConfigComponentAdaptorTest.java
@@ -0,0 +1,251 @@
+/*-
+ * ============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.appc.ccadaptor;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.powermock.reflect.Whitebox;
+
+public class ConfigComponentAdaptorTest {
+
+
+ @Test
+ public void testGetCliRunningConfig(){
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String Get_config_template = ("get_config_template");
+ String key = "GetCliRunningConfig";
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("Host_ip_address", "test");
+ parameters.put("User_name", "test");
+ parameters.put("Password", "password");
+ parameters.put("Port_number", "22");
+ parameters.put("Get_config_template", Get_config_template);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
+ cca.configure(key, parameters, ctx);
+ }
+
+ @Test
+ public void testDownloadCliConfig(){
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String Get_config_template = ("get_config_template");
+ String key = "DownloadCliConfig";
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("Host_ip_address", "test");
+ parameters.put("User_name", "test");
+ parameters.put("Password", "password");
+ parameters.put("Port_number", "22");
+ parameters.put("Get_config_template", Get_config_template);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
+ cca.configure(key, parameters, ctx);
+ }
+
+ @Test
+ public void testXmlDownload(){
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String Get_config_template = ("get_config_template");
+ String key = "xml-download";
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("Host_ip_address", "test");
+ parameters.put("User_name", "test");
+ parameters.put("Password", "password");
+ parameters.put("Port_number", "22");
+ parameters.put("Get_config_template", Get_config_template);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
+ cca.configure(key, parameters, ctx);
+ }
+
+ @Test
+ public void testXmlGetrunningconfig(){
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String Get_config_template = ("get_config_template");
+ String key = "xml-getrunningconfig";
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("Host_ip_address", "test");
+ parameters.put("User_name", "test");
+ parameters.put("Password", "password");
+ parameters.put("Port_number", "22");
+ parameters.put("Get_config_template", Get_config_template);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
+ cca.configure(key, parameters, ctx);
+ }
+
+ @Test
+ public void testEscapeSql(){
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String Get_config_template = ("get_config_template");
+ String key = "escapeSql";
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("Host_ip_address", "test");
+ parameters.put("User_name", "test");
+ parameters.put("Password", "password");
+ parameters.put("Port_number", "22");
+ parameters.put("Get_config_template", Get_config_template);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
+ cca.configure(key, parameters, ctx);
+ }
+
+ @Test
+ public void testAll(){
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String Get_config_template = ("test");
+ String Download_config_template = ("test");
+ String key = "GetCliRunningConfig";
+ Map<String, String> parameters = new HashMap<String,String>();
+ parameters.put("Host_ip_address", "test");
+ parameters.put("User_name", "test");
+ parameters.put("Password", "password");
+ parameters.put("Port_number", "22");
+ parameters.put("Protocol", "netconf");
+ parameters.put("Contents", "Contents");
+ parameters.put("Get_config_template", Get_config_template);
+ parameters.put("Download_config_template", Download_config_template);
+ parameters.put("Config_contents", "test");
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
+ cca.configure(key, parameters, ctx);
+ }
+
+ @Test(expected=Exception.class)
+ public void testAll1(){
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String key = "get";
+ Map<String, String> parameters = new HashMap<String,String>();
+ parameters.put("Host_ip_address", "test");
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
+ cca.configure(key, parameters, ctx);
+ }
+
+ @Test(expected=Exception.class)
+ public void testAll2(){
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String key = "cli";
+ Map<String, String> parameters = new HashMap<String,String>();
+ parameters.put("Host_ip_address", "test");
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
+ cca.configure(key, parameters, ctx);
+ }
+
+ @Test
+ public void testGetStringBetweenQuotes() throws Exception{
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String result =Whitebox.invokeMethod(cca, "getStringBetweenQuotes","\"testvalue\"");
+ Assert.assertEquals("testvalue", result);
+ }
+
+ @Test
+ public void testBuildXmlRequest() throws Exception{
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ Map<String, String> param = new HashMap<String,String>();
+ Whitebox.invokeMethod(cca, "buildXmlRequest",param,"template");
+ }
+
+ @Test
+ public void testTrimResponse() throws Exception{
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ String result =Whitebox.invokeMethod(cca, "trimResponse","testData");
+ Assert.assertEquals("", result);
+ }
+
+ @Test
+ public void testBuildNetworkData2() throws Exception{
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ SvcLogicContext ctx = new SvcLogicContext();
+ String result =Whitebox.invokeMethod(cca, "buildNetworkData2",ctx,"template","operation");
+ Assert.assertEquals("template", result);
+ }
+
+ //@Test
+ public void testGetLastFewLinesOfFile() throws Exception{
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ Whitebox.invokeMethod(cca, "readFile","test");
+ }
+
+ @Test
+ public void testConnect() throws Exception{
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ SvcLogicContext ctx = new SvcLogicContext();
+ cca.activate("key", ctx);
+
+ }
+
+ @Test(expected=Exception.class)
+ public void testActivate() throws Exception{
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ SvcLogicContext ctx = new SvcLogicContext();
+ String result =Whitebox.invokeMethod(cca, "activate",ctx,true);
+ Assert.assertEquals("template", result);
+ }
+
+ @Test(expected=Exception.class)
+ public void testAudit() throws Exception{
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ SvcLogicContext ctx = new SvcLogicContext();
+ String result =Whitebox.invokeMethod(cca, "audit",ctx,"test");
+ Assert.assertEquals("template", result);
+ }
+
+ @Test(expected=Exception.class)
+ public void testPrepare() throws Exception{
+ Properties props = null;
+ ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+ SvcLogicContext ctx = new SvcLogicContext();
+ String result =Whitebox.invokeMethod(cca, "prepare",ctx,"test","test");
+ Assert.assertEquals("template", result);
+ }
+}
diff --git a/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/DebugLogTest.java b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/DebugLogTest.java
new file mode 100644
index 000000000..522c00279
--- /dev/null
+++ b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/DebugLogTest.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.appc.ccadaptor;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DebugLogTest {
+
+ @Test
+ public void TestGetDateTime() {
+ String DateTime = DebugLog.getDateTime();
+ Assert.assertNotNull(DateTime);
+ }
+
+} \ No newline at end of file
diff --git a/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/EncryptionToolTest.java b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/EncryptionToolTest.java
new file mode 100644
index 000000000..e352098db
--- /dev/null
+++ b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/EncryptionToolTest.java
@@ -0,0 +1,46 @@
+/*-
+ * ============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.appc.ccadaptor;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class EncryptionToolTest {
+
+ @Test
+ public void testEncrypt() {
+ EncryptionTool tool = EncryptionTool.getInstance();
+ String value = tool.encrypt("encrypt");
+ Assert.assertEquals("enc:JjEZHlg7VQ==", value);
+ }
+
+ @Test
+ public void testDecrypt() {
+ EncryptionTool tool = EncryptionTool.getInstance();
+ String value = tool.decrypt("enc:JjEZHlg7VQ==");
+ Assert.assertEquals("encrypt", value);
+ }
+
+} \ No newline at end of file
diff --git a/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/SshJcraftWrapperTest.java b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/SshJcraftWrapperTest.java
new file mode 100644
index 000000000..64e338b58
--- /dev/null
+++ b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/SshJcraftWrapperTest.java
@@ -0,0 +1,105 @@
+/*-
+ * ============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.appc.ccadaptor;
+
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SshJcraftWrapperTest {
+
+ @Test
+ public void TestCheckIfReceivedStringMatchesDelimeter(){
+ SshJcraftWrapper wrapper = new SshJcraftWrapper();
+ wrapper.getTheDate();
+ boolean result = wrapper.checkIfReceivedStringMatchesDelimeter("#", "test#", "test#");
+ Assert.assertEquals(true, result);
+ }
+
+ @Test
+ public void testRemoveWhiteSpaceAndNewLineCharactersAroundString(){
+ SshJcraftWrapper wrapper = new SshJcraftWrapper();
+ String nameSpace = wrapper.removeWhiteSpaceAndNewLineCharactersAroundString("namespace ");
+ Assert.assertEquals("namespace", nameSpace);
+ }
+
+ @Test
+ public void testStripOffCmdFromRouterResponse(){
+ SshJcraftWrapper wrapper = new SshJcraftWrapper();
+ String result = wrapper.stripOffCmdFromRouterResponse("test\nsuccess");
+ Assert.assertEquals("success\n", result);
+ }
+
+ //@Test
+ public void testGetLastFewLinesOfFile() throws FileNotFoundException, IOException{
+ SshJcraftWrapper wrapper = new SshJcraftWrapper();
+ URL path = SshJcraftWrapperTest.class.getResource("Test");
+ File file = new File(path.getFile());
+ String value = wrapper.getLastFewLinesOfFile(file,1);
+ Assert.assertEquals("\nTest data 3", value);
+ }
+
+ @Test(expected=Exception.class)
+ public void testSetRouterCommandType() throws IOException{
+ SshJcraftWrapper wrapper = new SshJcraftWrapper();
+ wrapper.setRouterCommandType("test");
+ wrapper.receiveUntil("test", 2, "test");
+ }
+
+ @Test
+ public void testValues() throws IOException{
+ SshJcraftWrapper wrapper = new SshJcraftWrapper();
+ wrapper.setEquipNameCode("testcode");
+ wrapper.setRouterCommandType("testcommand");
+ String equipName =wrapper.getEquipNameCode();
+ wrapper.getHostName();
+ wrapper.getPassWord();
+ wrapper.getRouterName();
+ wrapper.getUserName();
+ wrapper.getTheDate();
+ Assert.assertEquals("testcode", equipName);
+ }
+
+ @Test(expected=Exception.class)
+ public void testSetRouterCommandType2() throws IOException{
+ SshJcraftWrapper wrapper = new SshJcraftWrapper();
+ wrapper.appendToRouterFile("test", 2);
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("test");
+ wrapper.appendToRouterFile("Test.txt", buffer);
+ wrapper.receiveUntilBufferFlush(3, 4, "test");
+ }
+
+ @Test(expected=Exception.class)
+ public void testSetRouterCommandType3() throws IOException{
+ SshJcraftWrapper wrapper = new SshJcraftWrapper();
+ wrapper.checkIfReceivedStringMatchesDelimeter(3, "test");
+ }
+}
diff --git a/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/XmlUtilTest.java b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/XmlUtilTest.java
new file mode 100644
index 000000000..5621a3d7d
--- /dev/null
+++ b/appc-config/appc-config-adaptor/provider/src/test/java/org/openecomp/appc/ccadaptor/XmlUtilTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============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.appc.ccadaptor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class XmlUtilTest {
+
+ @Test
+ public void testXml() {
+ Map<String, String> varmap = new HashMap<String, String>();
+ varmap.put("network.data", "test");
+ String xmlData = XmlUtil.getXml(varmap, "network");
+ Assert.assertEquals("<data>test</data>\n", xmlData);
+ }
+} \ No newline at end of file
diff --git a/appc-directed-graph/dg-loader/provider/pom.xml b/appc-directed-graph/dg-loader/provider/pom.xml
index 873613507..c074ca6d8 100644
--- a/appc-directed-graph/dg-loader/provider/pom.xml
+++ b/appc-directed-graph/dg-loader/provider/pom.xml
@@ -72,6 +72,18 @@
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>1.6.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
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
index b37400ba7..ac3f6392b 100644
--- 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
@@ -1,9 +1,11 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP : APP-C
+ * ONAP : APPC
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * 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
@@ -15,6 +17,8 @@
* 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=========================================================
*/
@@ -46,6 +50,10 @@ public class DGXMLActivate {
}
this.store = SvcLogicStoreFactory.getSvcLogicStore(propfile);
}
+
+ protected DGXMLActivate(SvcLogicStore store) {
+ this.store = store;
+ }
public void activateDg(String activateFilePath) throws Exception {
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
index b7651bbe5..13e5e293f 100644
--- 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -15,6 +17,8 @@
* 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=========================================================
*/
@@ -46,6 +50,10 @@ public class DGXMLLoad {
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);
@@ -95,7 +103,6 @@ public class DGXMLLoad {
}else{
throw new Exception("Sufficient inputs for DGXMLLoadNActivate are missing <xmlpath> <dbPropertyfile>");
}
-
DGXMLLoad dgXMLLoadDB = new DGXMLLoad(propertyPath);
dgXMLLoadDB.loadDGXMLDir(xmlPath);
} catch (Exception e) {
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
index f5eb2441f..ae7156cc2 100644
--- 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -15,6 +17,8 @@
* 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=========================================================
*/
@@ -47,6 +51,10 @@ public class DGXMLLoadNActivate {
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);
@@ -164,5 +172,4 @@ public class DGXMLLoadNActivate {
System.exit(1);
}
}
-
}
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
new file mode 100644
index 000000000..fea884ca7
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/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.openecomp.sdnc.sli.ConfigurationException;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicStore;
+import org.openecomp.sdnc.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<File> files = new ArrayList<File>();
+ files=(List<File>) 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<File> files = new ArrayList<File>();
+ files=(List<File>) 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
new file mode 100644
index 000000000..5143120cc
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/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.openecomp.sdnc.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
new file mode 100644
index 000000000..56cabbf14
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/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.openecomp.sdnc.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
new file mode 100644
index 000000000..266f1cdd6
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/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.openecomp.sdnc.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
new file mode 100644
index 000000000..ab96ef7f2
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/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.openecomp.sdnc.sli.SvcLogicDblibStore;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicGraph;
+import org.openecomp.sdnc.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
new file mode 100644
index 000000000..e38c64e41
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/openecomp/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.openecomp.sdnc.sli.SvcLogicStore;
+import org.openecomp.sdnc.sli.SvcLogicStoreFactory;
+import org.openecomp.sdnc.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/resources/dg_activate_test b/appc-directed-graph/dg-loader/provider/src/test/resources/dg_activate_test
new file mode 100644
index 000000000..895e177d5
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/resources/dg_activate_test
@@ -0,0 +1,3 @@
+# MODULE NAME:RPC NAME:VERSION:MODE
+# Example -> APPC:GetDeviceRunningConfiguration:3.0.0:sync
+Appc:UniTest:4.0.0:sync \ No newline at end of file
diff --git a/appc-directed-graph/dg-loader/provider/src/test/resources/dummy.properties b/appc-directed-graph/dg-loader/provider/src/test/resources/dummy.properties
new file mode 100644
index 000000000..4545f89af
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/resources/dummy.properties
@@ -0,0 +1,38 @@
+###
+# ============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=========================================================
+###
+
+org.openecomp.sdnc.sli.dbtype=jdbc
+
+org.openecomp.sdnc.sli.jdbc.hosts=
+org.openecomp.sdnc.sli.jdbc.url=
+org.openecomp.sdnc.sli.jdbc.database=
+org.openecomp.sdnc.sli.jdbc.user=
+org.openecomp.sdnc.sli.jdbc.password=
+org.openecomp.sdnc.sli.jdbc.connection.name=
+
+org.openecomp.sdnc.sli.jdbc.connection.timeout=50
+org.openecomp.sdnc.sli.jdbc.request.timeout=100
+org.openecomp.sdnc.sli.jdbc.limit.init=10
+org.openecomp.sdnc.sli.jdbc.limit.min=10
+org.openecomp.sdnc.sli.jdbc.limit.max=20
diff --git a/appc-directed-graph/dg-loader/provider/src/test/resources/json/Appc_UniTest.json b/appc-directed-graph/dg-loader/provider/src/test/resources/json/Appc_UniTest.json
new file mode 100644
index 000000000..2a6e49b1b
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/resources/json/Appc_UniTest.json
@@ -0,0 +1 @@
+[{"id":"1606180e.6254c","type":"dgstart","name":"DGSTART","outputs":1,"x":494.75,"y":149.75,"z":"7174441c.9fb7f4","wires":[["f650067e.2ad7e"]]},{"id":"f650067e.2ad7e","type":"service-logic","name":"Appc 4.0.0","module":"Appc","version":"4.0.0","comments":"","xml":"<service-logic xmlns='http://www.openecomp.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd' module='Appc' version='4.0.0'>","outputs":1,"x":642.75,"y":151.75,"z":"7174441c.9fb7f4","wires":[["10b2117c.ee118f"]]},{"id":"e928ee64.3762c","type":"block","name":"block","xml":"<block>\n","atomic":"false","comments":"","outputs":1,"x":952.75,"y":145.75,"z":"7174441c.9fb7f4","wires":[["342ce050.4a2fe8"]]},{"id":"342ce050.4a2fe8","type":"returnSuccess","name":"return success","xml":"<return status='success'>\n\n","comments":"","x":1115.75,"y":146.75,"z":"7174441c.9fb7f4","wires":[]},{"id":"10b2117c.ee118f","type":"method","name":"unitTest","xml":"<method rpc='unitTestDG' mode='sync'>\n","comments":"","outputs":1,"x":815.75,"y":147.75,"z":"7174441c.9fb7f4","wires":[["e928ee64.3762c"]]}]
diff --git a/appc-directed-graph/dg-loader/provider/src/test/resources/xml/Appc_UniTest.xml b/appc-directed-graph/dg-loader/provider/src/test/resources/xml/Appc_UniTest.xml
new file mode 100644
index 000000000..6eca1043d
--- /dev/null
+++ b/appc-directed-graph/dg-loader/provider/src/test/resources/xml/Appc_UniTest.xml
@@ -0,0 +1,5 @@
+<service-logic xmlns='http://www.openecomp.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd' module='Appc' version='4.0.0'><method rpc='unitTestDG' mode='sync'>
+<block>
+<return status='success'>
+
+</return></block></method></service-logic> \ No newline at end of file