X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-cmd%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fcmd%2Ftest%2FJU_BaseCmd.java;h=c071d95a6954340847c503d4a0f6a6b98a781bce;hb=795b295fca004dae777f4d05b46c5861ac38379b;hp=784634f9dfbaa6876b96ba7352cfee676c49ba67;hpb=1efda07f5d8e14d028fddf62dec62c95af9c7342;p=aaf%2Fauthz.git diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java index 784634f9..c071d95a 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java @@ -53,192 +53,68 @@ public class JU_BaseCmd { private static AAFcli cli; private static BaseCmd bCmd; -// @BeforeClass -// public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException { -// cli = JU_AAFCli.getAAfCli(); -// bCmd = new BaseCmd<>(cli, "testString"); -// } - -// @Test -// public void exec() throws CadiException, APIException, LocatorException { -// assertEquals(bCmd._exec(4, "add", "del", "reset", "extend"), 0); -// -// } -// -// @Test -// public void exec1() throws CadiException, APIException, LocatorException { -// assertEquals(bCmd._exec(0, "add", "del", "reset", "extend"), 0); -// -// } - -// @Test -// public void error() throws CadiException, APIException, LocatorException { -// boolean noError = true; -// Future future = new Future() { -// -// @Override -// public boolean get(int timeout) throws CadiException { -// // TODO Auto-generated method stub -// return false; -// } -// -// @Override -// public int code() { -// // TODO Auto-generated method stub -// return 0; -// } -// -// @Override -// public String body() { -// // TODO Auto-generated method stub -// return "{%}"; -// } -// -// @Override -// public String header(String tag) { -// // TODO Auto-generated method stub -// return null; -// } -// }; -// try { -// //TODO: Gabe [JUnit] Not visible for junit -// bCmd.error(future); -// } catch (Exception e) { -// noError = false; -// } -// assertEquals(noError, true); -// -// } -// -// -// -// @Test -// public void activity() throws DatatypeConfigurationException { -// boolean noError = true; -// History history = new History(); -// History.Item item = new History.Item(); -// item.setTarget("target"); -// item.setUser("user"); -// item.setMemo("memo"); -// -// GregorianCalendar c = new GregorianCalendar(); -// c.setTime(new Date()); -// XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); -// item.setTimestamp(date); -// history.getItem().add(item); -// try { -// bCmd.activity(history, "history"); -// } catch (Exception e) { -// noError = false; -// } -// assertEquals(noError, true); -// -// } -// -// @Test -// public void activity1() throws DatatypeConfigurationException { -// boolean noError = true; -// History history = new History(); -// History.Item item = new History.Item(); -// item.setTarget("target"); -// item.setUser("user"); -// item.setMemo("memo"); -// -// GregorianCalendar c = new GregorianCalendar(); -// c.setTime(new Date()); -// XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); -// item.setTimestamp(date); -// history.getItem().add(item); -// try { -// bCmd.activity(history, "1[]"); -// } catch (Exception e) { -// noError = false; -// } -// assertEquals(noError, true); -// -// } -// -// -// -// @Test -// public void error1() { -// boolean noError = true; -// Future future = new Future() { -// -// @Override -// public boolean get(int timeout) throws CadiException { -// // TODO Auto-generated method stub -// return false; -// } -// -// @Override -// public int code() { -// // TODO Auto-generated method stub -// return 0; -// } -// -// @Override -// public String body() { -// // TODO Auto-generated method stub -// return "{1"; -// } -// -// @Override -// public String header(String tag) { -// // TODO Auto-generated method stub -// return null; -// } -// }; -// try { -// bCmd.error(future); -// } catch (Exception e) { -// noError = false; -// } -// assertEquals(noError, true); -// -// } - -// @Test -// public void error2() { -// boolean noError = true; -// Future future = new Future() { -// -// @Override -// public boolean get(int timeout) throws CadiException { -// // TODO Auto-generated method stub -// return false; -// } -// -// @Override -// public int code() { -// // TODO Auto-generated method stub -// return 0; -// } -// -// @Override -// public String body() { -// // TODO Auto-generated method stub -// return "other"; -// } -// -// @Override -// public String header(String tag) { -// // TODO Auto-generated method stub -// return null; -// } -// }; -// try { -// bCmd.error(future); -// } catch (Exception e) { -// noError = false; -// } -// assertEquals(noError, true); -// -// } + @BeforeClass + public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException { + cli = JU_AAFCli.getAAfCli(); + bCmd = new BaseCmd<>(cli, "testString"); + } + + @Test + public void exec() throws CadiException, APIException, LocatorException { + assertEquals(bCmd._exec(4, "add", "del", "reset", "extend"), 0); + + } - @Test //TODO: Temporary fix AAF-111 - public void netYetTested() { - assertTrue(true); + @Test + public void exec1() throws CadiException, APIException, LocatorException { + assertEquals(bCmd._exec(0, "add", "del", "reset", "extend"), 0); + + } + + @Test + public void activity() throws DatatypeConfigurationException { + boolean noError = true; + History history = new History(); + History.Item item = new History.Item(); + item.setTarget("target"); + item.setUser("user"); + item.setMemo("memo"); + + GregorianCalendar c = new GregorianCalendar(); + c.setTime(new Date()); + XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); + item.setTimestamp(date); + history.getItem().add(item); + try { + bCmd.activity(history, "history"); + } catch (Exception e) { + noError = false; + } + assertEquals(noError, true); + + } + + @Test + public void activity1() throws DatatypeConfigurationException { + boolean noError = true; + History history = new History(); + History.Item item = new History.Item(); + item.setTarget("target"); + item.setUser("user"); + item.setMemo("memo"); + + GregorianCalendar c = new GregorianCalendar(); + c.setTime(new Date()); + XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); + item.setTimestamp(date); + history.getItem().add(item); + try { + bCmd.activity(history, "1[]"); + } catch (Exception e) { + noError = false; + } + assertEquals(noError, true); + } }