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.server.AbsService;
36 import org.onap.aaf.cadi.Access;
37 import org.onap.aaf.cadi.CadiException;
38 import org.onap.aaf.cadi.LocatorException;
39 import org.onap.aaf.cadi.PropAccess;
40 import org.onap.aaf.cadi.Access.Level;
41 import org.onap.aaf.cadi.config.Config;
42 import org.onap.aaf.cadi.register.Registrant;
43 import org.onap.aaf.misc.env.impl.BasicEnv;
45 import junit.framework.Assert;
47 import static org.junit.Assert.*;
48 import static org.mockito.Matchers.*;
49 import static org.mockito.Mockito.*;
51 import java.io.BufferedWriter;
52 import java.io.ByteArrayOutputStream;
54 import java.io.FileOutputStream;
55 import java.io.IOException;
56 import java.io.OutputStreamWriter;
57 import java.io.PrintStream;
58 import java.lang.reflect.InvocationTargetException;
59 import java.lang.reflect.Method;
60 import java.security.Principal;
62 import javax.servlet.Filter;
64 public class JU_AbsService {
66 ByteArrayOutputStream outStream;
68 private class AbsServiceStub extends AbsService {
70 public AbsServiceStub(Access access, BasicEnv env) throws CadiException {
72 // TODO Auto-generated constructor stub
76 public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
77 // TODO Auto-generated method stub
82 public Registrant[] registrants(int port) throws CadiException, LocatorException {
83 // TODO Auto-generated method stub
91 outStream = new ByteArrayOutputStream();
92 System.setOut(new PrintStream(outStream));
96 public void tearDown() {
97 System.setOut(System.out);
101 public void testStub() throws CadiException {
102 BasicEnv bEnv = new BasicEnv();
103 PropAccess prop = new PropAccess();
105 prop.setProperty(Config.AAF_COMPONENT, "te.st:te.st");
106 prop.setLogLevel(Level.DEBUG);
107 AbsServiceStub absServiceStub = new AbsServiceStub(prop, bEnv); //Testing other branches requires "fails" due to exception handling, will leave that off for now.