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.fail;
27 import java.io.IOException;
28 import java.security.GeneralSecurityException;
29 import java.util.Date;
30 import java.util.GregorianCalendar;
32 import javax.xml.datatype.DatatypeConfigurationException;
33 import javax.xml.datatype.DatatypeFactory;
34 import javax.xml.datatype.XMLGregorianCalendar;
36 import org.junit.BeforeClass;
37 import org.junit.Test;
38 import org.junit.runner.RunWith;
39 import org.mockito.runners.MockitoJUnitRunner;
40 import org.onap.aaf.auth.cmd.AAFcli;
41 import org.onap.aaf.auth.cmd.BaseCmd;
42 import org.onap.aaf.cadi.CadiException;
43 import org.onap.aaf.cadi.LocatorException;
44 import org.onap.aaf.cadi.client.Future;
45 import org.onap.aaf.misc.env.APIException;
47 import aaf.v2_0.History;
49 @RunWith(MockitoJUnitRunner.class)
50 public class JU_BaseCmd {
52 private static AAFcli cli;
53 private static BaseCmd bCmd;
56 // public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
57 // cli = JU_AAFCli.getAAfCli();
58 // bCmd = new BaseCmd<>(cli, "testString");
62 // public void exec() throws CadiException, APIException, LocatorException {
63 // assertEquals(bCmd._exec(4, "add", "del", "reset", "extend"), 0);
68 // public void exec1() throws CadiException, APIException, LocatorException {
69 // assertEquals(bCmd._exec(0, "add", "del", "reset", "extend"), 0);
74 // public void error() throws CadiException, APIException, LocatorException {
75 // boolean noError = true;
76 // Future<String> future = new Future<String>() {
79 // public boolean get(int timeout) throws CadiException {
80 // // TODO Auto-generated method stub
85 // public int code() {
86 // // TODO Auto-generated method stub
91 // public String body() {
92 // // TODO Auto-generated method stub
97 // public String header(String tag) {
98 // // TODO Auto-generated method stub
103 // //TODO: Gabe [JUnit] Not visible for junit
104 // bCmd.error(future);
105 // } catch (Exception e) {
108 // assertEquals(noError, true);
115 // public void activity() throws DatatypeConfigurationException {
116 // boolean noError = true;
117 // History history = new History();
118 // History.Item item = new History.Item();
119 // item.setTarget("target");
120 // item.setUser("user");
121 // item.setMemo("memo");
123 // GregorianCalendar c = new GregorianCalendar();
124 // c.setTime(new Date());
125 // XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
126 // item.setTimestamp(date);
127 // history.getItem().add(item);
129 // bCmd.activity(history, "history");
130 // } catch (Exception e) {
133 // assertEquals(noError, true);
138 // public void activity1() throws DatatypeConfigurationException {
139 // boolean noError = true;
140 // History history = new History();
141 // History.Item item = new History.Item();
142 // item.setTarget("target");
143 // item.setUser("user");
144 // item.setMemo("memo");
146 // GregorianCalendar c = new GregorianCalendar();
147 // c.setTime(new Date());
148 // XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
149 // item.setTimestamp(date);
150 // history.getItem().add(item);
152 // bCmd.activity(history, "1[]");
153 // } catch (Exception e) {
156 // assertEquals(noError, true);
163 // public void error1() {
164 // boolean noError = true;
165 // Future<String> future = new Future<String>() {
168 // public boolean get(int timeout) throws CadiException {
169 // // TODO Auto-generated method stub
174 // public int code() {
175 // // TODO Auto-generated method stub
180 // public String body() {
181 // // TODO Auto-generated method stub
182 // return "{<html><code>1</code></html>";
186 // public String header(String tag) {
187 // // TODO Auto-generated method stub
192 // bCmd.error(future);
193 // } catch (Exception e) {
196 // assertEquals(noError, true);
201 // public void error2() {
202 // boolean noError = true;
203 // Future<String> future = new Future<String>() {
206 // public boolean get(int timeout) throws CadiException {
207 // // TODO Auto-generated method stub
212 // public int code() {
213 // // TODO Auto-generated method stub
218 // public String body() {
219 // // TODO Auto-generated method stub
224 // public String header(String tag) {
225 // // TODO Auto-generated method stub
230 // bCmd.error(future);
231 // } catch (Exception e) {
234 // assertEquals(noError, true);
238 @Test //TODO: Temporary fix AAF-111
239 public void netYetTested() {
240 fail("Tests not yet implemented");