From 161df8a94bb3b0c34ed16fd4fdba078bd1eeef9a Mon Sep 17 00:00:00 2001 From: Patrick Brady Date: Wed, 13 Dec 2017 11:14:21 -0800 Subject: Second part of onap rename This is the second commit of the rename. The folder structure is renamed for appc-adapters and appc-config in this commit. Change-Id: Iaa2b8c937ff1ca1b5d1178128961fb115ee65d9b Signed-off-by: Patrick Brady Issue-ID: APPC-13 --- .../appc/ccadaptor/TestConfigComponentAdaptor.java | 132 +++++++++++++++++++++ .../test/org/onap/appc/ccadaptor/TestDebugLog.java | 19 +++ .../onap/appc/ccadaptor/TestEncryptionTool.java | 24 ++++ .../onap/appc/ccadaptor/TestSshJcraftWrapper.java | 23 ++++ .../test/org/onap/appc/ccadaptor/TestXmlUtil.java | 19 +++ .../appc/ccadaptor/TestConfigComponentAdaptor.java | 132 --------------------- .../org/openecomp/appc/ccadaptor/TestDebugLog.java | 19 --- .../appc/ccadaptor/TestEncryptionTool.java | 24 ---- .../appc/ccadaptor/TestSshJcraftWrapper.java | 23 ---- .../org/openecomp/appc/ccadaptor/TestXmlUtil.java | 19 --- 10 files changed, 217 insertions(+), 217 deletions(-) create mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestConfigComponentAdaptor.java create mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestDebugLog.java create mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestEncryptionTool.java create mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestSshJcraftWrapper.java create mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestXmlUtil.java delete mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestConfigComponentAdaptor.java delete mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestDebugLog.java delete mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestEncryptionTool.java delete mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestSshJcraftWrapper.java delete mode 100644 appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestXmlUtil.java (limited to 'appc-config/appc-config-adaptor/provider/src/main/test') diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestConfigComponentAdaptor.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestConfigComponentAdaptor.java new file mode 100644 index 000000000..2a258f187 --- /dev/null +++ b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestConfigComponentAdaptor.java @@ -0,0 +1,132 @@ +package org.onap.appc.ccadaptor; + +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.junit.Test; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; + +public class TestConfigComponentAdaptor { + + + @Test + public void testGetCliRunningConfig(){ + Properties props = null; + ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props); + String Get_config_template = ("get_config_template"); + String key = "GetCliRunningConfig"; + Map parameters = new HashMap(); + 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 parameters = new HashMap(); + 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 parameters = new HashMap(); + 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 parameters = new HashMap(); + 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 parameters = new HashMap(); + 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 parameters = new HashMap(); + 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", "config\nsystem\nservice-interface serv1\nipv4\ngateway-ip-address 192.168.30.44"); + + 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); + + + } + + +} diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestDebugLog.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestDebugLog.java new file mode 100644 index 000000000..c7a7953bd --- /dev/null +++ b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestDebugLog.java @@ -0,0 +1,19 @@ +package org.onap.appc.ccadaptor; + +import org.junit.Test; + +public class TestDebugLog { + + @Test + public void testAppendToFile() { + DebugLog.appendToFile("appendData"); + } + + @Test + public void TestGetDateTime() { + String DateTime = DebugLog.getDateTime(); + System.out.println(DateTime); + + } + +} diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestEncryptionTool.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestEncryptionTool.java new file mode 100644 index 000000000..a4a092e23 --- /dev/null +++ b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestEncryptionTool.java @@ -0,0 +1,24 @@ +package org.onap.appc.ccadaptor; + +import org.junit.Assert; +import org.junit.Test; + +public class TestEncryptionTool { + + @Test + public void testEncrypt() { + EncryptionTool tool = EncryptionTool.getInstance(); + String value = tool.encrypt("encrypt"); + Assert.assertEquals("enc:JjEZHlg7VQ==", value); + System.out.println(value); + } + + @Test + public void testDecrypt() { + EncryptionTool tool = EncryptionTool.getInstance(); + String value = tool.decrypt("enc:JjEZHlg7VQ=="); + Assert.assertEquals("encrypt", value); + System.out.println(value); + } + +} diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestSshJcraftWrapper.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestSshJcraftWrapper.java new file mode 100644 index 000000000..2a2adb75e --- /dev/null +++ b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestSshJcraftWrapper.java @@ -0,0 +1,23 @@ +package org.onap.appc.ccadaptor; + +import org.junit.Assert; +import org.junit.Test; + +public class TestSshJcraftWrapper { + + @Test + public void TestCheckIfReceivedStringMatchesDelimeter(){ + SshJcraftWrapper wrapper = new SshJcraftWrapper(); + wrapper.getTheDate(); + boolean result = wrapper.checkIfReceivedStringMatchesDelimeter("#", "config#", "config#"); + System.out.println(result); + } + + @Test + public void testRemoveWhiteSpaceAndNewLineCharactersAroundString(){ + SshJcraftWrapper wrapper = new SshJcraftWrapper(); + String nameSpace = wrapper.removeWhiteSpaceAndNewLineCharactersAroundString("namespace"); + Assert.assertEquals("namespace", nameSpace); + } + +} diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestXmlUtil.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestXmlUtil.java new file mode 100644 index 000000000..f3e7a1004 --- /dev/null +++ b/appc-config/appc-config-adaptor/provider/src/main/test/org/onap/appc/ccadaptor/TestXmlUtil.java @@ -0,0 +1,19 @@ +package org.onap.appc.ccadaptor; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; + +public class TestXmlUtil { + + @Test + public void testXml() { + Map varmap = new HashMap(); + varmap.put("network.data", "ipv4"); + String xmlData = XmlUtil.getXml(varmap, "network"); + Assert.assertEquals("ipv4\n", xmlData); + System.out.println(xmlData); + } +} diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestConfigComponentAdaptor.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestConfigComponentAdaptor.java deleted file mode 100644 index 2a258f187..000000000 --- a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestConfigComponentAdaptor.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.onap.appc.ccadaptor; - -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import org.junit.Test; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; - -public class TestConfigComponentAdaptor { - - - @Test - public void testGetCliRunningConfig(){ - Properties props = null; - ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props); - String Get_config_template = ("get_config_template"); - String key = "GetCliRunningConfig"; - Map parameters = new HashMap(); - 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 parameters = new HashMap(); - 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 parameters = new HashMap(); - 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 parameters = new HashMap(); - 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 parameters = new HashMap(); - 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 parameters = new HashMap(); - 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", "config\nsystem\nservice-interface serv1\nipv4\ngateway-ip-address 192.168.30.44"); - - 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); - - - } - - -} diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestDebugLog.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestDebugLog.java deleted file mode 100644 index c7a7953bd..000000000 --- a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestDebugLog.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.onap.appc.ccadaptor; - -import org.junit.Test; - -public class TestDebugLog { - - @Test - public void testAppendToFile() { - DebugLog.appendToFile("appendData"); - } - - @Test - public void TestGetDateTime() { - String DateTime = DebugLog.getDateTime(); - System.out.println(DateTime); - - } - -} diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestEncryptionTool.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestEncryptionTool.java deleted file mode 100644 index a4a092e23..000000000 --- a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestEncryptionTool.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.onap.appc.ccadaptor; - -import org.junit.Assert; -import org.junit.Test; - -public class TestEncryptionTool { - - @Test - public void testEncrypt() { - EncryptionTool tool = EncryptionTool.getInstance(); - String value = tool.encrypt("encrypt"); - Assert.assertEquals("enc:JjEZHlg7VQ==", value); - System.out.println(value); - } - - @Test - public void testDecrypt() { - EncryptionTool tool = EncryptionTool.getInstance(); - String value = tool.decrypt("enc:JjEZHlg7VQ=="); - Assert.assertEquals("encrypt", value); - System.out.println(value); - } - -} diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestSshJcraftWrapper.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestSshJcraftWrapper.java deleted file mode 100644 index 2a2adb75e..000000000 --- a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestSshJcraftWrapper.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.onap.appc.ccadaptor; - -import org.junit.Assert; -import org.junit.Test; - -public class TestSshJcraftWrapper { - - @Test - public void TestCheckIfReceivedStringMatchesDelimeter(){ - SshJcraftWrapper wrapper = new SshJcraftWrapper(); - wrapper.getTheDate(); - boolean result = wrapper.checkIfReceivedStringMatchesDelimeter("#", "config#", "config#"); - System.out.println(result); - } - - @Test - public void testRemoveWhiteSpaceAndNewLineCharactersAroundString(){ - SshJcraftWrapper wrapper = new SshJcraftWrapper(); - String nameSpace = wrapper.removeWhiteSpaceAndNewLineCharactersAroundString("namespace"); - Assert.assertEquals("namespace", nameSpace); - } - -} diff --git a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestXmlUtil.java b/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestXmlUtil.java deleted file mode 100644 index f3e7a1004..000000000 --- a/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestXmlUtil.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.onap.appc.ccadaptor; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Assert; -import org.junit.Test; - -public class TestXmlUtil { - - @Test - public void testXml() { - Map varmap = new HashMap(); - varmap.put("network.data", "ipv4"); - String xmlData = XmlUtil.getXml(varmap, "network"); - Assert.assertEquals("ipv4\n", xmlData); - System.out.println(xmlData); - } -} -- cgit 1.2.3-korg