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 * ============LICENSE_END====================================================
21 package org.onap.aaf.auth.cmd.test.role;
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.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;
43 import static org.mockito.Mockito.*;
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;
51 import org.junit.Test;
53 public class JU_List {
57 private class ListRolesStub extends List {
59 public ListRolesStub(Role parent) {
61 // TODO Auto-generated constructor stub
68 public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException{
69 cli = JU_AAFCli.getAAfCli();
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);
79 Class c = listStub.getClass();
80 Class[] cArg = new Class[3];
81 cArg[0] = Future.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");