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
34 import org.junit.Before;
\r
35 import org.junit.Test;
\r
36 import org.onap.aaf.cadi.Access.Level;
\r
37 import org.onap.aaf.cadi.config.Config;
\r
39 public class JU_PropAccessTest {
\r
42 public void setUp() throws Exception {
\r
46 public void testPropAccess() throws IOException {
\r
47 PropAccess p = new PropAccess(new Object());
\r
50 assertNotNull(p.getProperties());
\r
51 assertNull(p.getProperty("anything"));
\r
53 p.setProperty("prop", "value");
\r
54 assertEquals(p.getProperty("prop"), "value");
\r
56 p.setProperty(Config.CADI_KEYFILE, "value");
\r
57 assertEquals(p.getProperty("prop"), "value");
\r
59 p.setLogLevel(Level.INFO);
\r
60 assertTrue(p.willLog(Level.INFO));
\r
61 p.log(Level.DEBUG, new Object());
\r
62 String[] args = {"key=value","wow=wow"};
\r
63 p = new PropAccess(args);
\r
67 public void testPropAccessone() throws IOException {
\r
68 PropAccess p = new PropAccess(new Object());
\r
71 assertNotNull(p.getProperties());
\r
72 assertNull(p.getProperty("everything"));
\r
74 p.setProperty("prop1", "value1");
\r
75 assertEquals(p.getProperty("prop1"), "value1");
\r
77 p.setProperty(Config.CADI_KEYFILE, "value1");
\r
78 assertEquals(p.getProperty("prop1"), "value1");
\r
80 p.setLogLevel(Level.INFO);
\r
81 assertTrue(p.willLog(Level.INFO));
\r
82 p.log(Level.DEBUG, new Object());
\r
83 String[] args = {"key=value1","wow=wow1"};
\r
84 p = new PropAccess(args);
\r