aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-adaptor/provider/src/main/test/org/openecomp/appc/ccadaptor/TestConfigComponentAdaptor.java
blob: 7290dd2e2106b4606d48631665b17b3fe01f9dc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package org.openecomp.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<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", "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);
		
		
	}
	

}