Keep only clean TestCases, remove 2 license issues
[aaf/authz.git] / auth / auth-core / src / test / java / org / onap / aaf / auth / org / test / JU_OrganizationFactory.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.org.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 static org.mockito.Mockito.mock;
29 import org.onap.aaf.auth.env.AuthzEnv;
30 import org.onap.aaf.auth.env.AuthzTrans;
31 import org.onap.aaf.auth.org.OrganizationException;
32 import org.onap.aaf.auth.org.OrganizationFactory;
33 import org.onap.aaf.misc.env.APIException;
34 import org.onap.aaf.misc.env.impl.BasicEnv;
35 import org.powermock.api.mockito.PowerMockito;
36 import org.powermock.modules.junit4.PowerMockRunner;
37
38 @RunWith(PowerMockRunner.class)
39 public class JU_OrganizationFactory {
40         private static final String ORG_SLOT = null;
41         OrganizationFactory organizationFactory;
42         BasicEnv bEnv;
43         @Mock
44         AuthzEnv authzEnvMock;
45         String orgClass="orgclass";
46         String orgNS="orgns";
47         @Before
48         public void setUp(){
49                 organizationFactory = new OrganizationFactory();
50                 bEnv = new BasicEnv();
51         }
52
53         @SuppressWarnings("static-access")
54         @Test
55         public void testInit() throws OrganizationException {
56                 organizationFactory.init(bEnv);
57         }
58
59         @SuppressWarnings("static-access")                              //TODO:Fix this once real input is available AAF-111
60         @Test
61         public void testObtain() throws OrganizationException{
62                 PowerMockito.when(authzEnvMock.getProperty("Organization."+orgNS)).thenReturn("notnull");
63                 //organizationFactory.obtain(authzEnvMock, orgNS);
64         }
65
66         @Test
67         public void testGet() throws OrganizationException {  //TODO: Fix with when then return on fail
68                 AuthzTrans trans = mock(AuthzTrans.class);
69                 //organizationFactory.get(trans);
70         }
71 }