1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * Copyright © 2017 Amdocs
\r
7 * * ===========================================================================
\r
8 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * * you may not use this file except in compliance with the License.
\r
10 * * You may obtain a copy of the License at
\r
12 * * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * * Unless required by applicable law or agreed to in writing, software
\r
15 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * * See the License for the specific language governing permissions and
\r
18 * * limitations under the License.
\r
19 * * ============LICENSE_END====================================================
\r
21 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
23 ******************************************************************************/
\r
27 package com.osaaf.defOrd.test;
\r
29 import java.io.File;
\r
30 import java.io.IOException;
\r
32 import org.junit.After;
\r
33 import org.junit.AfterClass;
\r
34 import org.junit.Assert;
\r
35 import org.junit.Before;
\r
36 import org.junit.BeforeClass;
\r
37 import org.junit.Test;
\r
39 import com.att.authz.env.AuthzEnv;
\r
40 import com.att.authz.env.AuthzTrans;
\r
41 import com.att.authz.local.AbsData.Reuse;
\r
42 import com.osaaf.defOrg.Identities;
\r
43 import com.osaaf.defOrg.Identities.Data;
\r
48 public class JU_Identities {
\r
50 private static final String DATA_IDENTITIES = "../opt/app/aaf/data/identities.dat";
\r
51 private static File fids;
\r
52 private static Identities ids;
\r
53 private static AuthzEnv env;
\r
56 * @throws java.lang.Exception
\r
59 public static void setUpBeforeClass() throws Exception {
\r
60 env = new AuthzEnv();
\r
61 AuthzTrans trans = env.newTransNoAvg();
\r
62 // Note: utilize TimeTaken, from trans.start if you want to time.
\r
63 fids = new File(DATA_IDENTITIES);
\r
65 ids = new Identities(fids);
\r
66 ids.open(trans, 5000);
\r
69 throw new Exception("Data File for Tests, \"" + DATA_IDENTITIES
\r
70 + "\" must exist before test can run. (Current dir is " + System.getProperty("user.dir") + ")");
\r
75 * @throws java.lang.Exception
\r
78 public static void tearDownAfterClass() throws Exception {
\r
79 AuthzTrans trans = env.newTransNoAvg();
\r
86 * @throws java.lang.Exception
\r
89 public void setUp() throws Exception {
\r
93 * @throws java.lang.Exception
\r
96 public void tearDown() throws Exception {
\r
100 public void test() throws IOException {
\r
101 Reuse reuse = ids.reuse(); // this object can be reused within the same thread.
\r
102 Data id = ids.find("osaaf",reuse);
\r
103 Assert.assertNotNull(id);
\r
104 System.out.println(id);
\r
106 id = ids.find("mmanager",reuse);
\r
107 Assert.assertNotNull(id);
\r
108 System.out.println(id);
\r
110 //TODO Fill out JUnit with Tests of all Methods in "Data id"
\r