2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 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====================================================
22 package org.onap.aaf.auth.server.test;
24 import static org.junit.Assert.*;
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.mockito.Mock;
30 import org.mockito.Mockito;
31 import org.onap.aaf.auth.env.AuthzTrans;
32 import org.onap.aaf.auth.env.AuthzTransFilter;
33 import org.onap.aaf.auth.local.AbsData;
34 import org.onap.aaf.auth.local.DataFile;
35 import org.onap.aaf.auth.local.TextIndex;
36 import org.onap.aaf.auth.rserv.RServlet;
37 import org.onap.aaf.auth.server.AbsService;
38 import org.onap.aaf.auth.server.AbsServiceStarter;
39 import org.onap.aaf.auth.server.test.JU_AbsService;
40 import org.onap.aaf.cadi.Access;
41 import org.onap.aaf.cadi.CadiException;
42 import org.onap.aaf.cadi.LocatorException;
43 import org.onap.aaf.cadi.PropAccess;
44 import org.onap.aaf.cadi.Access.Level;
45 import org.onap.aaf.cadi.config.Config;
46 import org.onap.aaf.cadi.register.Registrant;
47 import org.onap.aaf.misc.env.impl.BasicEnv;
48 import org.onap.aaf.auth.local.AbsData.Iter;
49 import org.onap.aaf.auth.local.AbsData.Reuse;
51 import junit.framework.Assert;
53 import static org.junit.Assert.*;
54 import static org.mockito.Matchers.*;
55 import static org.mockito.Mockito.*;
57 import java.io.BufferedWriter;
58 import java.io.ByteArrayOutputStream;
60 import java.io.FileOutputStream;
61 import java.io.IOException;
62 import java.io.OutputStreamWriter;
63 import java.io.PrintStream;
64 import java.lang.reflect.InvocationTargetException;
65 import java.lang.reflect.Method;
66 import java.security.Principal;
68 import javax.servlet.Filter;
70 public class JU_AbsServiceStarter {
72 ByteArrayOutputStream outStream;
73 AbsServiceStub absServiceStub;
74 AbsServiceStarterStub absServiceStarterStub;
76 private class AbsServiceStarterStub extends AbsServiceStarter {
78 public AbsServiceStarterStub(AbsService service) {
80 // TODO Auto-generated constructor stub
84 public void _start(RServlet rserv) throws Exception {
85 // TODO Auto-generated method stub
90 public void _propertyAdjustment() {
91 // TODO Auto-generated method stub
96 private class AbsServiceStub extends AbsService {
98 public AbsServiceStub(Access access, BasicEnv env) throws CadiException {
100 // TODO Auto-generated constructor stub
104 public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
105 // TODO Auto-generated method stub
110 public Registrant[] registrants(int port) throws CadiException, LocatorException {
111 // TODO Auto-generated method stub
118 public void setUp() {
119 outStream = new ByteArrayOutputStream();
120 System.setOut(new PrintStream(outStream));
124 public void tearDown() {
125 System.setOut(System.out);
130 public void testStub() throws CadiException {
131 BasicEnv bEnv = new BasicEnv();
132 PropAccess prop = new PropAccess();
134 prop.setProperty(Config.AAF_LOCATOR_NAMES, "te.st");
135 prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st");
136 prop.setLogLevel(Level.DEBUG);
137 absServiceStub = new AbsServiceStub(prop, bEnv);
139 absServiceStarterStub = new AbsServiceStarterStub(absServiceStub);
143 // public void testStart() throws Exception {
144 // absServiceStarterStub.env();
145 // absServiceStarterStub.start();