b261b9f7d7c0f799b0f5115a220f2285efe94062
[ccsdk/sli.git] /
1 package org.onap.ccsdk.sli.adaptors.resource.sql;
2
3 import static org.junit.Assert.assertNotNull;
4 import java.lang.reflect.Field;
5 import java.util.Map;
6 import java.util.Properties;
7
8 import org.junit.Test;
9
10 public class SqlResourceProviderTest {
11
12     private static SqlResourcePropertiesProvider provider;
13     private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
14
15     @Test
16     public void testSqlResourceProvider() {
17         try{
18             Map<String, String> env = System.getenv();
19             Class<?> cl = env.getClass();
20             Field field = cl.getDeclaredField("m");
21             field.setAccessible(true);
22             Map<String, String> writableEnv = (Map<String, String>) field.get(env);
23             writableEnv.put(SDNC_CONFIG_DIR, "./src/test/resources");
24         } catch (Exception e) {
25             throw new IllegalStateException("Failed to set environment variable", e);
26         }
27
28         provider = new SqlResourcePropertiesProviderImpl();
29         assertNotNull(provider);
30     }
31
32     @Test
33     public void testGetProperties() {
34         Properties properties = provider.getProperties();
35         assertNotNull(properties);
36     }
37
38 }