a94d82dadffb94a893b5203f9ff37a93db3af97c
[aaf/authz.git] / auth / auth-core / src / test / java / org / onap / aaf / auth / common / test / JU_Define.java
1 /*******************************************************************************
2  * ============LICENSE_START====================================================
3  * * org.onap.aaf
4  * * ===========================================================================
5  * * Copyright © 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  ******************************************************************************/
22
23 package org.onap.aaf.auth.common.test;
24
25 import static org.mockito.Mockito.mock;
26
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.junit.runner.RunWith;
30 import org.mockito.Mock;
31 import org.onap.aaf.auth.common.Define;
32 import org.onap.aaf.cadi.Access;
33 import org.onap.aaf.cadi.CadiException;
34 import org.onap.aaf.cadi.PropAccess;
35 import org.onap.aaf.cadi.config.Config;
36 import org.onap.aaf.misc.env.Env;
37 import org.powermock.modules.junit4.PowerMockRunner;
38
39 @RunWith(PowerMockRunner.class)
40 public class JU_Define {
41     private static final String AAF_NS_DOT = "AAF_NS.";
42     public static String ROOT_NS="NS.Not.Set";
43     public static String ROOT_COMPANY=ROOT_NS;
44     Access acc;
45     @Mock
46     Env envMock;
47
48
49     @Before
50     public void setUp() throws CadiException{
51         acc = mock(Access.class);
52     }
53     
54     @Test
55     public void testSet() throws CadiException {
56         PropAccess prop = new PropAccess();
57         prop.setProperty(AAF_NS_DOT, AAF_NS_DOT);
58         prop.setProperty(Config.AAF_ROOT_NS, ".ns_Test");
59         prop.setProperty(Config.AAF_ROOT_COMPANY, "company_Test");
60         Define.set(prop);
61         Define.ROOT_NS();
62         Define.ROOT_COMPANY();
63         
64         PropAccess prop1 = new PropAccess();
65         prop1.setProperty(AAF_NS_DOT, AAF_NS_DOT);
66         prop1.setProperty(Config.AAF_ROOT_NS, ".ns_Test");
67         Define.set(prop1);
68     }
69
70 //    @Test                    //TODO: AAF-111 exception fix
71 //    public void testRootNS() throws RuntimeException{
72 //        Define.ROOT_NS();
73 //    }
74 //
75 //    @Test
76 //    public void testRootCompany() throws RuntimeException{
77 //        Define.ROOT_COMPANY();
78 //    }
79
80     @Test
81     public void testVarReplace() {
82         Define.varReplace(AAF_NS_DOT);
83         Define.varReplace("test");
84     }
85 }