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;
24 import static org.junit.Assert.assertEquals;
25 import static org.junit.Assert.assertTrue;
26 import static org.junit.Assert.fail;
28 import java.io.IOException;
29 import java.security.GeneralSecurityException;
30 import java.util.Date;
31 import java.util.GregorianCalendar;
33 import javax.xml.datatype.DatatypeConfigurationException;
34 import javax.xml.datatype.DatatypeFactory;
35 import javax.xml.datatype.XMLGregorianCalendar;
37 import org.junit.BeforeClass;
38 import org.junit.Test;
39 import org.junit.runner.RunWith;
40 import org.mockito.runners.MockitoJUnitRunner;
41 import org.onap.aaf.auth.cmd.AAFcli;
42 import org.onap.aaf.auth.cmd.BaseCmd;
43 import org.onap.aaf.cadi.CadiException;
44 import org.onap.aaf.cadi.LocatorException;
45 import org.onap.aaf.cadi.client.Future;
46 import org.onap.aaf.misc.env.APIException;
48 import aaf.v2_0.History;
50 @RunWith(MockitoJUnitRunner.class)
51 public class JU_BaseCmd {
53 private static AAFcli cli;
54 private static BaseCmd bCmd;
57 // public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
58 // cli = JU_AAFCli.getAAfCli();
59 // bCmd = new BaseCmd<>(cli, "testString");
63 // public void exec() throws CadiException, APIException, LocatorException {
64 // assertEquals(bCmd._exec(4, "add", "del", "reset", "extend"), 0);
69 // public void exec1() throws CadiException, APIException, LocatorException {
70 // assertEquals(bCmd._exec(0, "add", "del", "reset", "extend"), 0);
75 // public void error() throws CadiException, APIException, LocatorException {
76 // boolean noError = true;
77 // Future<String> future = new Future<String>() {
80 // public boolean get(int timeout) throws CadiException {
81 // // TODO Auto-generated method stub
86 // public int code() {
87 // // TODO Auto-generated method stub
92 // public String body() {
93 // // TODO Auto-generated method stub
98 // public String header(String tag) {
99 // // TODO Auto-generated method stub
104 // //TODO: Gabe [JUnit] Not visible for junit
105 // bCmd.error(future);
106 // } catch (Exception e) {
109 // assertEquals(noError, true);
116 // public void activity() throws DatatypeConfigurationException {
117 // boolean noError = true;
118 // History history = new History();
119 // History.Item item = new History.Item();
120 // item.setTarget("target");
121 // item.setUser("user");
122 // item.setMemo("memo");
124 // GregorianCalendar c = new GregorianCalendar();
125 // c.setTime(new Date());
126 // XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
127 // item.setTimestamp(date);
128 // history.getItem().add(item);
130 // bCmd.activity(history, "history");
131 // } catch (Exception e) {
134 // assertEquals(noError, true);
139 // public void activity1() throws DatatypeConfigurationException {
140 // boolean noError = true;
141 // History history = new History();
142 // History.Item item = new History.Item();
143 // item.setTarget("target");
144 // item.setUser("user");
145 // item.setMemo("memo");
147 // GregorianCalendar c = new GregorianCalendar();
148 // c.setTime(new Date());
149 // XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
150 // item.setTimestamp(date);
151 // history.getItem().add(item);
153 // bCmd.activity(history, "1[]");
154 // } catch (Exception e) {
157 // assertEquals(noError, true);
164 // public void error1() {
165 // boolean noError = true;
166 // Future<String> future = new Future<String>() {
169 // public boolean get(int timeout) throws CadiException {
170 // // TODO Auto-generated method stub
175 // public int code() {
176 // // TODO Auto-generated method stub
181 // public String body() {
182 // // TODO Auto-generated method stub
183 // return "{<html><code>1</code></html>";
187 // public String header(String tag) {
188 // // TODO Auto-generated method stub
193 // bCmd.error(future);
194 // } catch (Exception e) {
197 // assertEquals(noError, true);
202 // public void error2() {
203 // boolean noError = true;
204 // Future<String> future = new Future<String>() {
207 // public boolean get(int timeout) throws CadiException {
208 // // TODO Auto-generated method stub
213 // public int code() {
214 // // TODO Auto-generated method stub
219 // public String body() {
220 // // TODO Auto-generated method stub
225 // public String header(String tag) {
226 // // TODO Auto-generated method stub
231 // bCmd.error(future);
232 // } catch (Exception e) {
235 // assertEquals(noError, true);
239 @Test //TODO: Temporary fix AAF-111
240 public void netYetTested() {