JettyStartups to improve new Filters
[aaf/authz.git] / auth / auth-core / src / test / java / org / onap / aaf / auth / server / test / JU_AbsService.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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====================================================
19  *
20  */
21 package org.onap.aaf.auth.server.test;
22
23 import static org.junit.Assert.*;
24
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;
44
45 import junit.framework.Assert;
46
47 import static org.junit.Assert.*;
48 import static org.mockito.Matchers.*;
49 import static org.mockito.Mockito.*;
50
51 import java.io.BufferedWriter;
52 import java.io.ByteArrayOutputStream;
53 import java.io.File;
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;
61
62 import javax.servlet.Filter;
63
64 public class JU_AbsService {
65         
66         ByteArrayOutputStream outStream;
67         
68         private class AbsServiceStub extends AbsService {
69
70                 public AbsServiceStub(Access access, BasicEnv env) throws CadiException {
71                         super(access, env);
72                         // TODO Auto-generated constructor stub
73                 }
74
75                 @Override
76                 public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
77                         // TODO Auto-generated method stub
78                         return null;
79                 }
80
81                 @Override
82                 public Registrant[] registrants(int port) throws CadiException, LocatorException {
83                         // TODO Auto-generated method stub
84                         return null;
85                 }
86         
87         }
88         
89         @Before
90         public void setUp() {
91                 outStream = new ByteArrayOutputStream();
92                 System.setOut(new PrintStream(outStream));
93         }
94         
95         @After
96         public void tearDown() {
97                 System.setOut(System.out);
98         }
99         
100         @Test
101         public void testStub() throws CadiException {
102                 BasicEnv bEnv = new BasicEnv();
103                 PropAccess prop = new PropAccess();
104                 
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.
108         }
109         
110 }
111
112
113
114