Keep only clean TestCases, remove 2 license issues
[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 package org.onap.aaf.auth.common.test;
23
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.junit.runner.RunWith;
27 import org.mockito.Mock;
28 import org.junit.Before;
29 import static org.mockito.Mockito.*;
30
31 import java.util.HashMap;
32 import java.util.HashSet;
33 import java.util.Map.Entry;
34 import java.util.Set;
35
36 import org.onap.aaf.auth.common.Define;
37 import org.onap.aaf.cadi.Access;
38 import org.onap.aaf.cadi.CadiException;
39 import org.onap.aaf.cadi.PropAccess;
40 import org.onap.aaf.cadi.config.Config;
41 import org.onap.aaf.misc.env.Env;
42 import static org.junit.Assert.*;
43
44 //import com.att.authz.common.Define;
45 import org.powermock.api.mockito.PowerMockito;
46 import org.powermock.modules.junit4.PowerMockRunner;
47
48 @RunWith(PowerMockRunner.class)
49 public class JU_Define {
50         public static String ROOT_NS="NS.Not.Set";
51         public static String ROOT_COMPANY=ROOT_NS;
52         Access acc;
53         @Mock
54         Env envMock;
55
56
57         @Before
58         public void setUp() throws CadiException{
59                 acc = mock(Access.class);
60         }
61         
62         @Test
63         public void testSet() throws CadiException {
64                 PropAccess prop = new PropAccess();
65                 prop.setProperty("AAF_NS.", "AAF_NS.");
66                 prop.setProperty(Config.AAF_ROOT_NS, ".ns_Test");
67                 prop.setProperty(Config.AAF_ROOT_COMPANY, "company_Test");
68                 Define.set(prop);
69                 Define.ROOT_NS();
70                 Define.ROOT_COMPANY();
71                 
72                 PropAccess prop1 = new PropAccess();
73                 prop1.setProperty("AAF_NS.", "AAF_NS.");
74                 prop1.setProperty(Config.AAF_ROOT_NS, ".ns_Test");
75                 Define.set(prop1);
76         }
77
78 //      @Test                                   //TODO: AAF-111 exception fix
79 //      public void testRootNS() throws RuntimeException{
80 //              Define.ROOT_NS();
81 //      }
82 //
83 //      @Test
84 //      public void testRootCompany() throws RuntimeException{
85 //              Define.ROOT_COMPANY();
86 //      }
87
88         @Test
89         public void testVarReplace() {
90                 Define.varReplace("AAF_NS.");
91                 Define.varReplace("test");
92         }
93 }