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.server.AbsService;
37 import org.onap.aaf.cadi.Access;
38 import org.onap.aaf.cadi.CadiException;
39 import org.onap.aaf.cadi.LocatorException;
40 import org.onap.aaf.cadi.PropAccess;
41 import org.onap.aaf.cadi.Access.Level;
42 import org.onap.aaf.cadi.config.Config;
43 import org.onap.aaf.cadi.register.Registrant;
44 import org.onap.aaf.misc.env.impl.BasicEnv;
46 import junit.framework.Assert;
48 import static org.junit.Assert.*;
49 import static org.mockito.Matchers.*;
50 import static org.mockito.Mockito.*;
52 import java.io.BufferedWriter;
53 import java.io.ByteArrayOutputStream;
55 import java.io.FileOutputStream;
56 import java.io.IOException;
57 import java.io.OutputStreamWriter;
58 import java.io.PrintStream;
59 import java.lang.reflect.InvocationTargetException;
60 import java.lang.reflect.Method;
61 import java.security.Principal;
63 import javax.servlet.Filter;
65 public class JU_AbsService {
67 ByteArrayOutputStream outStream;
69 private class AbsServiceStub extends AbsService {
71 public AbsServiceStub(Access access, BasicEnv env) throws CadiException {
73 // TODO Auto-generated constructor stub
77 public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
78 // TODO Auto-generated method stub
83 public Registrant[] registrants(int port) throws CadiException, LocatorException {
84 // TODO Auto-generated method stub
92 outStream = new ByteArrayOutputStream();
93 System.setOut(new PrintStream(outStream));
97 public void tearDown() {
98 System.setOut(System.out);
102 public void testStub() throws CadiException {
103 BasicEnv bEnv = new BasicEnv();
104 PropAccess prop = new PropAccess();
106 prop.setProperty(Config.AAF_LOCATOR_ENTRIES, "te.st");
107 prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st");
108 prop.setLogLevel(Level.DEBUG);
109 AbsServiceStub absServiceStub = new AbsServiceStub(prop, bEnv); //Testing other branches requires "fails" due to exception handling, will leave that off for now.