Merge "Improve coverage of cadi-client"
[aaf/authz.git] / auth / auth-cmd / src / test / java / org / onap / aaf / auth / cmd / test / role / JU_List.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  * ============LICENSE_END====================================================
18  *
19  */
20
21 package org.onap.aaf.auth.cmd.test.role;
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.cmd.AAFcli;
31 import org.onap.aaf.auth.cmd.role.List;
32 import org.onap.aaf.auth.cmd.role.Role;
33 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
34 import org.onap.aaf.auth.cmd.Cmd;
35 import org.onap.aaf.auth.cmd.Param;
36 import org.onap.aaf.auth.env.AuthzTrans;
37 import org.onap.aaf.cadi.CadiException;
38 import org.onap.aaf.cadi.LocatorException;
39 import org.onap.aaf.cadi.client.Future;
40 import org.onap.aaf.cadi.client.Rcli;
41 import org.onap.aaf.misc.env.APIException;
42
43 import static org.mockito.Mockito.*;
44
45 import java.io.IOException;
46 import java.lang.reflect.InvocationTargetException;
47 import java.lang.reflect.Method;
48 import java.security.GeneralSecurityException;
49 import java.security.Principal;
50
51 import org.junit.Test;
52
53 public class JU_List {
54         
55         AAFcli cli;
56
57         private class ListRolesStub extends List {
58
59                 public ListRolesStub(Role parent) {
60                         super(parent);
61                         // TODO Auto-generated constructor stub
62                 }
63
64
65         }
66         
67         @Before
68         public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException{
69                 cli = JU_AAFCli.getAAfCli();
70         }
71         
72         @Test
73         public void testRoles() throws APIException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
74                 Role role = new Role(cli);
75                 ListRolesStub listStub = new ListRolesStub(role);
76                 Future future = mock(Future.class);
77                 Rcli rcli = mock(Rcli.class);
78                 
79                 Class c = listStub.getClass();
80                 Class[] cArg = new Class[3];
81                 cArg[0] = Future.class;
82                 cArg[1] = Rcli.class;
83                 cArg[2] = String.class;//Steps to test a protected method
84                 //Method listMethod = c.getDeclaredMethod("list", cArg);
85                 //listMethod.setAccessible(true);
86                 //listMethod.invoke(listStub, future, rcli, "test");
87                 
88         }
89
90 }