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====================================================
21 package org.onap.aaf.auth.server.test;
23 import static org.junit.Assert.*;
25 import org.junit.After;
26 import org.junit.Before;
27 import org.junit.Test;
28 import org.mockito.Mock;
29 import org.mockito.Mockito;
30 import org.onap.aaf.auth.env.AuthzTrans;
31 import org.onap.aaf.auth.env.AuthzTransFilter;
32 import org.onap.aaf.auth.local.AbsData;
33 import org.onap.aaf.auth.local.DataFile;
34 import org.onap.aaf.auth.local.TextIndex;
35 import org.onap.aaf.auth.rserv.RServlet;
36 import org.onap.aaf.auth.server.AbsService;
37 import org.onap.aaf.auth.server.AbsServiceStarter;
38 import org.onap.aaf.auth.server.test.JU_AbsService;
39 import org.onap.aaf.cadi.Access;
40 import org.onap.aaf.cadi.CadiException;
41 import org.onap.aaf.cadi.LocatorException;
42 import org.onap.aaf.cadi.PropAccess;
43 import org.onap.aaf.cadi.Access.Level;
44 import org.onap.aaf.cadi.config.Config;
45 import org.onap.aaf.cadi.register.Registrant;
46 import org.onap.aaf.misc.env.impl.BasicEnv;
47 import org.onap.aaf.auth.local.AbsData.Iter;
48 import org.onap.aaf.auth.local.AbsData.Reuse;
50 import junit.framework.Assert;
52 import static org.junit.Assert.*;
53 import static org.mockito.Matchers.*;
54 import static org.mockito.Mockito.*;
56 import java.io.BufferedWriter;
57 import java.io.ByteArrayOutputStream;
59 import java.io.FileOutputStream;
60 import java.io.IOException;
61 import java.io.OutputStreamWriter;
62 import java.io.PrintStream;
63 import java.lang.reflect.InvocationTargetException;
64 import java.lang.reflect.Method;
65 import java.security.Principal;
67 import javax.servlet.Filter;
69 public class JU_AbsServiceStarter {
71 ByteArrayOutputStream outStream;
72 AbsServiceStub absServiceStub;
73 AbsServiceStarterStub absServiceStarterStub;
75 private class AbsServiceStarterStub extends AbsServiceStarter {
77 public AbsServiceStarterStub(AbsService service) {
79 // TODO Auto-generated constructor stub
83 public void _start(RServlet rserv) throws Exception {
84 // TODO Auto-generated method stub
89 public void _propertyAdjustment() {
90 // TODO Auto-generated method stub
95 private class AbsServiceStub extends AbsService {
97 public AbsServiceStub(Access access, BasicEnv env) throws CadiException {
99 // TODO Auto-generated constructor stub
103 public Filter[] filters() throws CadiException, LocatorException {
104 // TODO Auto-generated method stub
109 public Registrant[] registrants(int port) throws CadiException, LocatorException {
110 // TODO Auto-generated method stub
117 public void setUp() {
118 outStream = new ByteArrayOutputStream();
119 System.setOut(new PrintStream(outStream));
123 public void tearDown() {
124 System.setOut(System.out);
129 public void testStub() throws CadiException {
130 BasicEnv bEnv = new BasicEnv();
131 PropAccess prop = new PropAccess();
133 prop.setProperty(Config.AAF_COMPONENT, "te.st:te.st");
134 prop.setLogLevel(Level.DEBUG);
135 absServiceStub = new AbsServiceStub(prop, bEnv);
137 absServiceStarterStub = new AbsServiceStarterStub(absServiceStub);
141 // public void testStart() throws Exception {
142 // absServiceStarterStub.env();
143 // absServiceStarterStub.start();