Public and Private Locate entries
[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
22 package org.onap.aaf.auth.server.test;
23
24 import static org.junit.Assert.*;
25
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.rserv.RServlet;
37 import org.onap.aaf.auth.server.AbsService;
38 import org.onap.aaf.auth.server.AbsServiceStarter;
39 import org.onap.aaf.auth.server.test.JU_AbsService;
40 import org.onap.aaf.cadi.Access;
41 import org.onap.aaf.cadi.CadiException;
42 import org.onap.aaf.cadi.LocatorException;
43 import org.onap.aaf.cadi.PropAccess;
44 import org.onap.aaf.cadi.Access.Level;
45 import org.onap.aaf.cadi.config.Config;
46 import org.onap.aaf.cadi.register.Registrant;
47 import org.onap.aaf.misc.env.impl.BasicEnv;
48 import org.onap.aaf.auth.local.AbsData.Iter;
49 import org.onap.aaf.auth.local.AbsData.Reuse;
50
51 import junit.framework.Assert;
52
53 import static org.junit.Assert.*;
54 import static org.mockito.Matchers.*;
55 import static org.mockito.Mockito.*;
56
57 import java.io.BufferedWriter;
58 import java.io.ByteArrayOutputStream;
59 import java.io.File;
60 import java.io.FileOutputStream;
61 import java.io.IOException;
62 import java.io.OutputStreamWriter;
63 import java.io.PrintStream;
64 import java.lang.reflect.InvocationTargetException;
65 import java.lang.reflect.Method;
66 import java.security.Principal;
67
68 import javax.servlet.Filter;
69
70 public class JU_AbsServiceStarter {
71     
72     ByteArrayOutputStream outStream;
73     AbsServiceStub absServiceStub;
74     AbsServiceStarterStub absServiceStarterStub;
75     
76     private class AbsServiceStarterStub extends AbsServiceStarter {
77
78         public AbsServiceStarterStub(AbsService service) {
79             super(service);
80             // TODO Auto-generated constructor stub
81         }
82
83         @Override
84         public void _start(RServlet rserv) throws Exception {
85             // TODO Auto-generated method stub
86             
87         }
88
89         @Override
90         public void _propertyAdjustment() {
91             // TODO Auto-generated method stub
92             
93         }
94     }
95     
96     private class AbsServiceStub extends AbsService {
97
98         public AbsServiceStub(Access access, BasicEnv env) throws CadiException {
99             super(access, env);
100             // TODO Auto-generated constructor stub
101         }
102
103         @Override
104         public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
105             // TODO Auto-generated method stub
106             return null;
107         }
108
109         @Override
110         public Registrant[] registrants(int port) throws CadiException, LocatorException {
111             // TODO Auto-generated method stub
112             return null;
113         }
114     
115     }
116     
117     @Before
118     public void setUp() {
119         outStream = new ByteArrayOutputStream();
120         System.setOut(new PrintStream(outStream));
121     }
122     
123     @After
124     public void tearDown() {
125         System.setOut(System.out);
126     }
127     
128     
129     @Test
130     public void testStub() throws CadiException {
131         BasicEnv bEnv = new BasicEnv();
132         PropAccess prop = new PropAccess();
133         
134         prop.setProperty(Config.AAF_LOCATOR_NAMES, "te.st");
135         prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st");
136         prop.setLogLevel(Level.DEBUG);
137         absServiceStub = new AbsServiceStub(prop, bEnv);
138         
139         absServiceStarterStub = new AbsServiceStarterStub(absServiceStub);
140     }
141     
142 //    @Test
143 //    public void testStart() throws Exception {
144 //        absServiceStarterStub.env();
145 //        absServiceStarterStub.start();
146 //    }
147     
148 }
149
150
151