Junit Cases for APPC dataServices
[appc.git] / appc-config / appc-encryption-tool / provider / src / test / java / org / openecomp / appc / encryptiontool / TestEncryptionTool.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APP-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property.  All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.appc.encryptiontool;
22
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.Map;
26 import org.junit.Test;
27 import org.openecomp.appc.encryptiontool.wrapper.DbServiceUtil;
28 import org.openecomp.appc.encryptiontool.wrapper.EncryptionToolDGWrapper;
29 import org.openecomp.appc.encryptiontool.wrapper.WrapperEncryptionTool;
30 import org.openecomp.sdnc.sli.SvcLogicContext;
31
32 public class TestEncryptionTool {
33
34         @Test
35         public void testEncryptionTool() throws Exception{
36                 String [] input = new String[] {"testVnf_Type","testUser","testPassword11", "testAction1", "8080", "http://localhost:8080/restconf/healthcheck"};
37                 WrapperEncryptionTool.main(input);
38
39         }
40         @Test(expected=Exception.class)
41         public void testgetPropertyDG() throws Exception{
42                 EncryptionToolDGWrapper et = new EncryptionToolDGWrapper();             
43                 SvcLogicContext ctx = new SvcLogicContext();            
44                 Map<String, String> inParams = new HashMap<String, String>();
45                 inParams.put("prefix", "test");
46                 inParams.put("propertyName", "testVnf_Type.testAction1.url");
47                 et.getProperty(inParams, ctx);
48         }
49         @Test(expected=Exception.class)
50         public void testgetData() throws Exception
51         {
52                 DbServiceUtil d = new DbServiceUtil();
53                 ArrayList argList = null;
54                 String schema ="sdnctl";
55                 String tableName ="dual";
56                 String getselectData ="123";
57                 String getDataClasue="123='123'";
58                 d.getData(tableName, argList, schema, getselectData, getDataClasue);
59         }
60         @Test(expected=Exception.class)
61         public void testupdateDB() throws Exception
62         {
63                 DbServiceUtil d = new DbServiceUtil();
64                 String setCluase = null;
65                 String schema ="sdnctl";
66                 String tableName ="dual";
67                 ArrayList inputArgs = null;
68                 String whereClause="123='123'";
69                 d.updateDB(tableName, inputArgs, schema, whereClause, setCluase);
70         }
71 }