1 /*******************************************************************************
2 * ============LICENSE_START====================================================
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
11 * * http://www.apache.org/licenses/LICENSE-2.0
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====================================================
21 ******************************************************************************/
25 package org.onap.aaf.org.test;
28 import java.io.IOException;
30 import org.junit.After;
31 import org.junit.AfterClass;
32 import org.junit.Assert;
33 import org.junit.Before;
34 import org.junit.BeforeClass;
35 import org.junit.Test;
36 import org.onap.aaf.auth.env.AuthzEnv;
37 import org.onap.aaf.auth.env.AuthzTrans;
38 import org.onap.aaf.auth.local.AbsData.Reuse;
39 import org.onap.aaf.org.Identities;
40 import org.onap.aaf.org.Identities.Data;
45 public class JU_Identities {
47 private static final String DATA_IDENTITIES = "/opt/app/onap/data/identities.dat";
48 private static File fids;
49 private static Identities ids;
50 private static AuthzEnv env;
53 * @throws java.lang.Exception
56 public static void setUpBeforeClass() throws Exception {
58 AuthzTrans trans = env.newTransNoAvg();
59 // Note: utilize TimeTaken, from trans.start if you want to time.
60 fids = new File(DATA_IDENTITIES);
62 ids = new Identities(fids);
63 ids.open(trans, 5000);
66 throw new Exception("Data File for Tests, \"" + DATA_IDENTITIES
67 + "\" must exist before test can run. (Current dir is " + System.getProperty("user.dir") + ")");
72 * @throws java.lang.Exception
75 public static void tearDownAfterClass() throws Exception {
76 AuthzTrans trans = env.newTransNoAvg();
83 * @throws java.lang.Exception
86 public void setUp() throws Exception {
90 * @throws java.lang.Exception
93 public void tearDown() throws Exception {
97 public void test() throws IOException {
98 Reuse reuse = ids.reuse(); // this object can be reused within the same thread.
99 Data id = ids.find("osaaf",reuse);
100 Assert.assertNotNull(id);
101 System.out.println(id);
103 id = ids.find("mmanager",reuse);
104 Assert.assertNotNull(id);
105 System.out.println(id);
107 //TODO Fill out JUnit with Tests of all Methods in "Data id"