1 /*******************************************************************************
2 * ============LICENSE_START====================================================
4 * * ===========================================================================
5 * * Copyright © 2017 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 * * limitations under the License.
18 * * ============LICENSE_END====================================================
21 ******************************************************************************/
22 package org.onap.aaf.auth.cmd.test.mgmt;
24 import org.junit.Assert;
25 import org.junit.Before;
27 import static org.mockito.Mockito.mock;
29 import java.io.Writer;
30 import java.net.HttpURLConnection;
33 import static org.junit.Assert.assertEquals;
35 import org.junit.BeforeClass;
36 import org.junit.Test;
37 import org.junit.runner.RunWith;
38 import org.mockito.runners.MockitoJUnitRunner;
39 import org.onap.aaf.auth.cmd.AAFcli;
40 import org.onap.aaf.auth.cmd.mgmt.Mgmt;
41 import org.onap.aaf.auth.cmd.mgmt.SessClear;
42 import org.onap.aaf.auth.cmd.mgmt.Session;
43 import org.onap.aaf.auth.env.AuthzEnv;
44 import org.onap.aaf.cadi.CadiException;
45 import org.onap.aaf.cadi.Locator;
46 import org.onap.aaf.cadi.LocatorException;
47 import org.onap.aaf.cadi.PropAccess;
48 import org.onap.aaf.cadi.SecuritySetter;
49 import org.onap.aaf.cadi.http.HMangr;
50 import org.onap.aaf.misc.env.APIException;
52 @RunWith(MockitoJUnitRunner.class)
53 public class JU_SessClear {
55 private static SessClear sessclr;
64 public void setUp() throws LocatorException, APIException {
65 prop = new PropAccess();
66 aEnv = new AuthzEnv();
67 wtr = mock(Writer.class);
68 loc = mock(Locator.class);
69 SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
70 hman = new HMangr(aEnv, loc);
71 aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
72 Mgmt mgmt = new Mgmt(aafcli);
73 Session sess = new Session(mgmt);
74 sessclr = new SessClear(sess);
78 // public void exec() {
80 // assertEquals(sessclr._exec(0, "session clear"), 0);
81 // } catch (CadiException e) {
82 // // TODO Auto-generated catch block
83 // e.printStackTrace();
84 // } catch (APIException e) {
85 // // TODO Auto-generated catch block
86 // e.printStackTrace();
87 // } catch (LocatorException e) {
88 // // TODO Auto-generated catch block
89 // e.printStackTrace();
94 public void testDetailedHelp() {
95 StringBuilder sb = new StringBuilder();
96 //sessclr.detailedHelp(0, sb);