JettyStartups to improve new Filters
[aaf/authz.git] / auth / auth-core / src / test / java / org / onap / aaf / auth / server / test / JU_AbsServiceStarter.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.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;
49
50 import junit.framework.Assert;
51
52 import static org.junit.Assert.*;
53 import static org.mockito.Matchers.*;
54 import static org.mockito.Mockito.*;
55
56 import java.io.BufferedWriter;
57 import java.io.ByteArrayOutputStream;
58 import java.io.File;
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;
66
67 import javax.servlet.Filter;
68
69 public class JU_AbsServiceStarter {
70         
71         ByteArrayOutputStream outStream;
72         AbsServiceStub absServiceStub;
73         AbsServiceStarterStub absServiceStarterStub;
74         
75         private class AbsServiceStarterStub extends AbsServiceStarter {
76
77                 public AbsServiceStarterStub(AbsService service) {
78                         super(service);
79                         // TODO Auto-generated constructor stub
80                 }
81
82                 @Override
83                 public void _start(RServlet rserv) throws Exception {
84                         // TODO Auto-generated method stub
85                         
86                 }
87
88                 @Override
89                 public void _propertyAdjustment() {
90                         // TODO Auto-generated method stub
91                         
92                 }
93         }
94         
95         private class AbsServiceStub extends AbsService {
96
97                 public AbsServiceStub(Access access, BasicEnv env) throws CadiException {
98                         super(access, env);
99                         // TODO Auto-generated constructor stub
100                 }
101
102                 @Override
103                 public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
104                         // TODO Auto-generated method stub
105                         return null;
106                 }
107
108                 @Override
109                 public Registrant[] registrants(int port) throws CadiException, LocatorException {
110                         // TODO Auto-generated method stub
111                         return null;
112                 }
113         
114         }
115         
116         @Before
117         public void setUp() {
118                 outStream = new ByteArrayOutputStream();
119                 System.setOut(new PrintStream(outStream));
120         }
121         
122         @After
123         public void tearDown() {
124                 System.setOut(System.out);
125         }
126         
127         
128         @Test
129         public void testStub() throws CadiException {
130                 BasicEnv bEnv = new BasicEnv();
131                 PropAccess prop = new PropAccess();
132                 
133                 prop.setProperty(Config.AAF_COMPONENT, "te.st:te.st");
134                 prop.setLogLevel(Level.DEBUG);
135                 absServiceStub = new AbsServiceStub(prop, bEnv);
136                 
137                 absServiceStarterStub = new AbsServiceStarterStub(absServiceStub);
138         }
139         
140 //      @Test
141 //      public void testStart() throws Exception {
142 //              absServiceStarterStub.env();
143 //              absServiceStarterStub.start();
144 //      }
145         
146 }
147
148
149