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