SDN Controller Blueprints Data Adaptor
[ccsdk/features.git] / blueprints-processor / adaptors / data-adaptor-provider / src / test / java / org / onap / ccsdk / config / data / adaptor / dao / ConfigPropertyMapDaoTest.java
1 /*\r
2  * Copyright © 2017-2018 AT&T Intellectual Property.\r
3  * \r
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
5  * in compliance with the License. You may obtain a copy of the License at\r
6  * \r
7  * http://www.apache.org/licenses/LICENSE-2.0\r
8  * \r
9  * Unless required by applicable law or agreed to in writing, software distributed under the License\r
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
11  * or implied. See the License for the specific language governing permissions and limitations under\r
12  * the License.\r
13  */\r
14 \r
15 package org.onap.ccsdk.config.data.adaptor.dao;\r
16 \r
17 import org.junit.Assert;\r
18 import org.junit.FixMethodOrder;\r
19 import org.junit.Test;\r
20 import org.junit.runner.RunWith;\r
21 import org.junit.runners.MethodSorters;\r
22 import org.springframework.beans.factory.annotation.Autowired;\r
23 import org.springframework.test.context.ContextConfiguration;\r
24 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\r
25 \r
26 @RunWith(SpringJUnit4ClassRunner.class)\r
27 @ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})\r
28 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
29 public class ConfigPropertyMapDaoTest {\r
30     \r
31     @Autowired\r
32     private ConfigPropertyMapDao configPropertyMapDao;\r
33     \r
34     @Autowired\r
35     private QueryExecutorDao queryExecutorDao;\r
36     \r
37     @Test\r
38     public void testConfigResourcesData() throws Exception {\r
39         String sql = "INSERT INTO CONFIG_PROPERTY_MAP (reference_key, reference_value) VALUES ( ?, ?)";\r
40         Object[] data = new Object[] {"dummy123", "username123"};\r
41         int result = queryExecutorDao.update(sql, data);\r
42         Assert.assertNotNull("Failed to get Query Result", result);\r
43         \r
44         String propKeyValye = configPropertyMapDao.getConfigPropertyByKey("org.onap.ccsdk.config.rest.adaptors.test");\r
45         Assert.assertNull("propKeyValue is null", propKeyValye);\r
46     }\r
47     \r
48 }\r