1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * ===========================================================================
\r
7 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * * you may not use this file except in compliance with the License.
\r
9 * * You may obtain a copy of the License at
\r
11 * * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * * Unless required by applicable law or agreed to in writing, software
\r
14 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * * See the License for the specific language governing permissions and
\r
17 * * limitations under the License.
\r
18 * * ============LICENSE_END====================================================
\r
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package org.onap.aaf.cadi;
\r
26 import static org.junit.Assert.assertEquals;
\r
27 import static org.junit.Assert.assertFalse;
\r
28 import static org.junit.Assert.assertNotNull;
\r
29 import static org.junit.Assert.assertNull;
\r
30 import static org.junit.Assert.assertTrue;
\r
32 import java.io.IOException;
\r
33 import java.util.Properties;
\r
35 import org.junit.Before;
\r
36 import org.junit.Test;
\r
37 import org.onap.aaf.cadi.Access.Level;
\r
38 import org.onap.aaf.cadi.config.Config;
\r
40 import java.util.Properties;
\r
42 import org.junit.Test;
\r
43 import org.onap.aaf.cadi.Access.Level;
\r
45 public class JU_PropAccessTest {
\r
48 public void test() {
\r
49 PropAccess prop = new PropAccess(new Object());
\r
51 prop = new PropAccess("cadi_name=user","cadi_loglevel=DEBUG","cadi_prop_files=test/cadi.properties");
\r
53 assertTrue(prop.getProperties().keySet().contains("cadi_name"));
\r
54 assertTrue(prop.getProperty("cadi_name").equals("user"));
\r
56 prop.setProperty("cadi_keyfile", "file");
\r
57 prop.setLogLevel(Level.DEBUG);
\r
58 assertEquals(prop.getProperty("cadi_keyfile"),"file");
\r
59 // assertEquals(prop.getDME2Properties().size(),3);
\r
60 prop.log(Level.DEBUG);
\r
64 public void testWithProperties() {
\r
65 Properties p = new Properties();
\r
66 p.put("cadi_name", "user");
\r
67 p.put("cadi_loglevel", "DEBUG");
\r
69 PropAccess prop = new PropAccess(p);
\r
71 assertTrue(prop.getProperties().keySet().contains("cadi_name"));
\r
72 assertTrue(prop.getProperty("cadi_name").equals("user"));
\r
74 prop.setProperty("cadi_keyfile", "file");
\r
75 prop.setLogLevel(Level.DEBUG);
\r
76 assertEquals(prop.getProperty("cadi_keyfile"),"file");
\r
77 // assertEquals(prop.getDME2Properties().size(),3);
\r
78 prop.log(Level.DEBUG);
\r