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