summaryrefslogtreecommitdiffstats
path: root/auth/auth-cmd
diff options
context:
space:
mode:
authorgabe.maurer <gabe.maurer@att.com>2018-04-25 15:00:43 -0500
committergabe.maurer <gabe.maurer@att.com>2018-04-25 15:20:20 -0500
commit795b295fca004dae777f4d05b46c5861ac38379b (patch)
tree1cf0f7c6b7f5e131c84a3e1ba0631c3008c442f0 /auth/auth-cmd
parent1efda07f5d8e14d028fddf62dec62c95af9c7342 (diff)
Increased auth cmd to 53 percent
Issue-ID: AAF-237 Change-Id: I0519923bfd0b60e8bbd43d00b5815d262a9148c3 Signed-off-by: gabe.maurer <gabe.maurer@att.com> Increased auth cmd to 50 percent Issue-ID: AAF-237 Change-Id: I96d336c4097be1f028670c6d450af2240044554e Signed-off-by: gabe.maurer <gabe.maurer@att.com> merge Change-Id: I0ea51c2efaeb1d79b51967ee37e19e81561dbad7 Signed-off-by: gabe.maurer <gabe.maurer@att.com>
Diffstat (limited to 'auth/auth-cmd')
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java22
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java246
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java19
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java78
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java39
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java41
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java3
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java6
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java19
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java65
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java65
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java43
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java125
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java88
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java27
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java89
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java29
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java89
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java31
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java29
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java94
21 files changed, 718 insertions, 529 deletions
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java
index 36c5676d..4acd5a85 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java
@@ -146,6 +146,16 @@ public class JU_AAFCli {
public void eval10() throws Exception {
assertTrue(cli.eval("set @[ 123"));
}
+
+ @Test
+ public void eval11() throws Exception {
+ assertTrue(cli.eval("DETAILS @[ 123"));
+ }
+
+ @Test
+ public void eval12() throws Exception {
+ assertTrue(cli.eval(". |/, .\"0 \" "));
+ }
@Test
public void keyboardHelp() throws Exception {
@@ -210,12 +220,6 @@ public class JU_AAFCli {
}
@Test
- public void testMain() {
- String[] str = {"test"};
- //cli.main(str);
- }
-
- @Test
public void testTest() {
Assert.assertNotNull(cli.isTest());
}
@@ -247,4 +251,10 @@ public class JU_AAFCli {
cli.gui(false);
}
+ @Test
+ public void testMain() {
+ String[] strArr = {"\\*","test1"};
+ //cli.main(strArr);
+ }
+
}
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<String> future = new Future<String>() {
-//
-// @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<String> future = new Future<String>() {
-//
-// @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 "{<html><code>1</code></html>";
-// }
-//
-// @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<String> future = new Future<String>() {
-//
-// @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);
+
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java
index 9ba75600..884f5405 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.security.GeneralSecurityException;
+import org.eclipse.jetty.http.HttpStatus;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,15 +46,15 @@ import junit.framework.Assert;
@RunWith(MockitoJUnitRunner.class)
public class JU_Version {
-// private static AAFcli cli;
-// private static Version version;
-//
-// @BeforeClass
-// public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
-// cli = JU_AAFCli.getAAfCli();
-// version = new Version(cli);
-// }
-//
+ private static AAFcli cli;
+ private static Version version;
+
+ @BeforeClass
+ public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
+ cli = JU_AAFCli.getAAfCli();
+ version = new Version(cli);
+ }
+
// @Test
// public void exec_HTTP_200() throws CadiException, APIException, LocatorException {
// assertEquals(version._exec(0, "Version"), HttpStatus.OK_200);
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java
index 743c8073..70a620fb 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java
@@ -22,41 +22,87 @@
package org.onap.aaf.auth.cmd.test.mgmt;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+
import static org.junit.Assert.assertEquals;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.mgmt.Cache;
import org.onap.aaf.auth.cmd.mgmt.Clear;
+import org.onap.aaf.auth.cmd.mgmt.Mgmt;
+import org.onap.aaf.auth.cmd.perm.Create;
+import org.onap.aaf.auth.cmd.perm.Perm;
+import org.onap.aaf.auth.cmd.role.Role;
+import org.onap.aaf.auth.common.Define;
+import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Clear {
private static Clear clr;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+ Cache cache;
+ Mgmt mgmt;
+
+ @Before
+ public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ mgmt = new Mgmt(aafcli);
+ cache = new Cache(mgmt);
+ clr = new Clear(cache);
+
+ }
- @BeforeClass
- public static void setUp() {
- clr = mock(Clear.class);
+ @Test
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ Item value = mock(Item.class);
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ when(loc.first()).thenReturn(value);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, value, secSet);
+ String[] strArr = {"grant","ungrant","setTo","grant","ungrant","setTo"};
+ //clr._exec(0, strArr);
+
}
@Test
- public void exec() {
- try {
- assertEquals(clr._exec(0, "clear"), 0);
- } catch (CadiException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (APIException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (LocatorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testDetailedHelp() throws CadiException {
+ Define define = new Define();
+ define.set(prop);
+ StringBuilder sb = new StringBuilder();
+ clr.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java
index 2441fba2..7ef9c9a5 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java
@@ -41,6 +41,7 @@ import org.mockito.runners.MockitoJUnitRunner;
import org.onap.aaf.auth.cmd.AAFcli;
import org.onap.aaf.auth.cmd.mgmt.Log;
import org.onap.aaf.auth.cmd.mgmt.Mgmt;
+import org.onap.aaf.auth.common.Define;
import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.Locator;
@@ -74,27 +75,33 @@ public class JU_Log {
hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Mgmt mgmt = new Mgmt(aafcli);
- log = mock(Log.class);
log1 = new Log(mgmt);
}
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
-// Item value = mock(Item.class);
-// Locator.Item item = new Locator.Item() {
-// };
-// when(loc.best()).thenReturn(value);
-// URI uri = new URI("http://java.sun.com/j2se/1.3/");
-// when(loc.get(value)).thenReturn(uri);
-// SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
-// HRcli hcli = new HRcli(hman, uri, item, secSet);
+ Item value = mock(Item.class);
+ Locator.Item item = new Locator.Item() {
+ };
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, item, secSet);
+ when(loc.first()).thenReturn(value);
String[] strArr = {"add","upd","del","add","upd","del"};
- log._exec(0, strArr);
-
-// String[] strArr1 = {"del","add","upd","del"};
-// log1._exec(0, strArr1);
-//
-// String[] strArr2 = {"add","upd","del","add","upd","del"};
-// log1._exec(0, strArr2);
+ log1._exec(0, strArr);
+
+ String[] strArr1 = {"del","add","upd","del"};
+ log1._exec(0, strArr1);
+
+ }
+
+ @Test
+ public void testDetailedHelp() throws CadiException {
+ Define define = new Define();
+ define.set(prop);
+ StringBuilder sb = new StringBuilder();
+ log1.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java
index 61057560..1618e787 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java
@@ -25,10 +25,12 @@ import org.junit.Assert;
import org.junit.Before;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.URI;
+import java.net.URISyntaxException;
import static org.junit.Assert.assertEquals;
@@ -40,13 +42,16 @@ import org.onap.aaf.auth.cmd.AAFcli;
import org.onap.aaf.auth.cmd.mgmt.Mgmt;
import org.onap.aaf.auth.cmd.mgmt.SessClear;
import org.onap.aaf.auth.cmd.mgmt.Session;
+import org.onap.aaf.auth.common.Define;
import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
@@ -74,25 +79,27 @@ public class JU_SessClear {
sessclr = new SessClear(sess);
}
-// @Test
-// public void exec() {
-// try {
-// assertEquals(sessclr._exec(0, "session clear"), 0);
-// } catch (CadiException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// } catch (APIException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// } catch (LocatorException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// }
+ @Test
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ Item value = mock(Item.class);
+ Locator.Item item = new Locator.Item() {
+ };
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, item, secSet);
+ when(loc.first()).thenReturn(value);
+ String[] strArr = {"add","upd","del","add","upd","del"};
+ //sessclr._exec(0, strArr);
+
+ }
@Test
- public void testDetailedHelp() {
+ public void testDetailedHelp() throws CadiException {
+ Define define = new Define();
+ define.set(prop);
StringBuilder sb = new StringBuilder();
- //sessclr.detailedHelp(0, sb);
+ sessclr.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
index 6e344d50..575a0e34 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
@@ -93,6 +93,9 @@ public class JU_Admin {
String[] strArr = {"add", "del","add","add"};
admin._exec(0, strArr);
+ String[] strArr1 = {"del","add","add"};
+ admin._exec(0, strArr1);
+
}
@Test
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
index ac53c4b7..2a8200df 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
@@ -95,6 +95,12 @@ public class JU_Attrib {
String[] strArr = {"add","upd","del","add","upd","del"};
attrib._exec(0, strArr);
+ String[] strArr1 = {"upd","del","add","upd","del","add"};
+ attrib._exec(0, strArr1);
+
+ String[] strArr2 = {"del","add","upd","del","add","upd"};
+ attrib._exec(0, strArr2);
+
}
@Test
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java
index 39698c39..a03cb3ad 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java
@@ -34,8 +34,20 @@ import org.onap.aaf.auth.cmd.ns.Create;
import org.onap.aaf.auth.cmd.ns.NS;
import org.onap.aaf.auth.cmd.ns.Owner;
import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HRcli;
+import org.onap.aaf.misc.env.APIException;
import static org.mockito.Mockito.*;
+
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+
import org.junit.Test;
public class JU_Owner {
@@ -50,6 +62,13 @@ public class JU_Owner {
}
@Test
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ String[] strArr = {"add","del","add","del"};
+ //owner._exec(0, strArr);
+
+ }
+
+ @Test
public void detailedHelp() {
boolean hasNoError = true;
try {
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java
index 03945aa4..b5b2e9eb 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java
@@ -22,8 +22,17 @@
package org.onap.aaf.auth.cmd.test.perm;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -35,39 +44,57 @@ import org.onap.aaf.auth.cmd.perm.ListActivity;
import org.onap.aaf.auth.cmd.perm.Perm;
import org.onap.aaf.auth.cmd.role.Role;
import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListActivity {
private static ListActivity lsActivity;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
- @BeforeClass
- public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
- AAFcli cli = JU_AAFCli.getAAfCli();
- Role role = new Role(cli);
+ @Before
+ public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ Role role = new Role(aafcli);
Perm perm = new Perm(role);
List ls = new List(perm);
lsActivity = new ListActivity(ls);
}
-// @Test
-// public void exec() {
-// try {
-// assertEquals(lsActivity._exec(0, "add","del","reset","extend"),500);
-// } catch (CadiException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// } catch (APIException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// } catch (LocatorException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// }
+ @Test
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ Item value = mock(Item.class);
+ Locator.Item item = new Locator.Item() {
+ };
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, item, secSet);
+ String[] strArr = {"grant","ungrant","setTo","grant","ungrant","setTo"};
+ //lsActivity._exec(0, strArr);
+
+ }
@Test
public void testDetailedHelp() {
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java
index ad9f76ac..f3e54716 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java
@@ -22,8 +22,17 @@
package org.onap.aaf.auth.cmd.test.perm;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -35,39 +44,57 @@ import org.onap.aaf.auth.cmd.perm.ListByName;
import org.onap.aaf.auth.cmd.perm.Perm;
import org.onap.aaf.auth.cmd.role.Role;
import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByName {
private static ListByName lsByName;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
- @BeforeClass
- public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
- AAFcli cli = JU_AAFCli.getAAfCli();
- Role role = new Role(cli);
+ @Before
+ public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ Role role = new Role(aafcli);
Perm perm = new Perm(role);
List ls = new List(perm);
lsByName = new ListByName(ls);
}
-// @Test
-// public void exec() {
-// try {
-// assertEquals(lsByName._exec(0, "add","del","reset","extend"),500);
-// } catch (CadiException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// } catch (APIException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// } catch (LocatorException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// }
+ @Test
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ Item value = mock(Item.class);
+ Locator.Item item = new Locator.Item() {
+ };
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, item, secSet);
+ String[] strArr = {"List Child Permissions"};
+ //lsByName._exec(0, strArr);
+
+ }
@Test
public void testDetailedHelp() {
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java
index 2334e1b8..7767e054 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java
@@ -33,18 +33,30 @@ import org.onap.aaf.auth.cmd.role.Role;
import org.onap.aaf.auth.cmd.test.JU_AAFCli;
import org.onap.aaf.auth.cmd.Cmd;
import org.onap.aaf.auth.cmd.Param;
+import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
import org.onap.aaf.cadi.client.Future;
import org.onap.aaf.cadi.client.Rcli;
+import org.onap.aaf.cadi.http.HMangr;
import org.onap.aaf.misc.env.APIException;
+import aaf.v2_0.Perms;
+import aaf.v2_0.Roles;
+import aaf.v2_0.UserRoles;
+
import static org.mockito.Mockito.*;
import java.io.IOException;
+import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.net.HttpURLConnection;
+import java.net.URI;
import java.security.GeneralSecurityException;
import java.security.Principal;
@@ -53,6 +65,14 @@ import org.junit.Test;
public class JU_List {
AAFcli cli;
+ Role role;
+ List list;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
private class ListRolesStub extends List {
@@ -66,12 +86,20 @@ public class JU_List {
@Before
public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException{
- cli = JU_AAFCli.getAAfCli();
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ role = new Role(aafcli);
+ list = new List(role);
}
@Test
public void testRoles() throws APIException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- Role role = new Role(cli);
+ Role role = new Role(aafcli);
ListRolesStub listStub = new ListRolesStub(role);
Future future = mock(Future.class);
Rcli rcli = mock(Rcli.class);
@@ -86,5 +114,16 @@ public class JU_List {
//listMethod.invoke(listStub, future, rcli, "test");
}
+
+ @Test
+ public void testReport() throws Exception {
+ UserRoles urs = new UserRoles();
+ Perms perms = new Perms();
+ Roles roles = mock(Roles.class);
+ list.report(roles, perms , urs , "test");
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ cli.eval("DETAILS @[ 123");
+ list.report(roles, perms , urs , "test");
+ }
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java
index f32ce0e3..9432cbca 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java
@@ -22,6 +22,8 @@
package org.onap.aaf.auth.cmd.test.user;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
@@ -29,6 +31,10 @@ import static org.mockito.Mockito.when;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -41,85 +47,68 @@ import org.onap.aaf.auth.cmd.user.Cred;
import org.onap.aaf.auth.cmd.user.User;
import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Cred {
- private static Cred testCred;
- private static User testUser;
- private static AuthzEnv env;
-
-
- @BeforeClass
- public static void setUp() throws FileNotFoundException, APIException {
-
- testCred = mock(Cred.class);
- testUser = mock(User.class);
- env = mock(AuthzEnv.class);
- Mockito.when(env.getProperty(Cmd.STARTDATE,null)).thenReturn(null);
- Mockito.when(env.getProperty(Cmd.ENDDATE,null)).thenReturn(null);
-
- }
-
- @Test
- public void exec() throws CadiException, APIException, LocatorException, FileNotFoundException {
- boolean isNullpointer=false;
- AAFcli aaFcli= new AAFcli(env, new PrintWriter("temp"), null, null, null);
- User user= new User(aaFcli);
- Cred testCred= new Cred(user);
- try {
- testCred._exec(0, "add", "del", "reset", "extend");
- } catch (Exception e) {
- isNullpointer=true;
- }
- assertEquals(isNullpointer, true);
+ User user;
+ Cred cred;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+
+ @Before
+ public void setUp() throws FileNotFoundException, APIException, LocatorException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ user = new User(aafcli);
+ cred = new Cred(user);
}
-
-
+
@Test
- public void exec_add() {
- try {
- assertNotNull(testCred._exec(0, "zeroed","add","del","reset","extend"));
- } catch (CadiException | APIException | LocatorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- @Test
- public void exec_del() {
- try {
- assertNotNull(testCred._exec(1, "zeroed","add","del","reset","extend"));
- } catch (CadiException | APIException | LocatorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- @Test
- public void exec_reset() {
- try {
- assertNotNull(testCred._exec(2, "zeroed","add","del","reset","extend"));
- } catch (CadiException | APIException | LocatorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ Item value = mock(Item.class);
+ Locator.Item item = new Locator.Item() {
+ };
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, item, secSet);
+ String[] strArr = {"add","del","reset","extend"};
+ cred._exec(0, strArr);
+
+ String[] strArr1 = {"del","reset","extend","add"};
+ cred._exec(0, strArr1);
+
+ String[] strArr2 = {"reset","extend", "add","del"};
+ cred._exec(0, strArr2);
+
+ String[] strArr3 = {"extend","add","del","reset"};
+ cred._exec(0, strArr3);
}
-
+
@Test
- public void exec_extend() {
- try {
- assertNotNull(testCred._exec(3, "zeroed","add","del","reset","extend"));
- } catch (CadiException | APIException | LocatorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ cred.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java
index c7deef51..3c78841b 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java
@@ -22,17 +22,36 @@
package org.onap.aaf.auth.cmd.test.user;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.FileNotFoundException;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+
import static org.junit.Assert.*;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.user.Cred;
import org.onap.aaf.auth.cmd.user.Delg;
import org.onap.aaf.auth.cmd.user.User;
+import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
@@ -40,41 +59,52 @@ public class JU_Delg {
private static User testUser;
private static Delg delg;
-
- @BeforeClass
- public static void setUp() throws APIException {
- testUser = mock(User.class);
- delg = mock(Delg.class);
- }
-
- @Test
- public void exec_add() {
- try {
- assertEquals(delg._exec(0, "zero","add","upd","del"), 0);
- } catch (CadiException | APIException | LocatorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ User user;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+
+ @Before
+ public void setUp() throws FileNotFoundException, APIException, LocatorException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ user = new User(aafcli);
+ delg = new Delg(user);
}
@Test
- public void exec_upd() {
- try {
- assertEquals(delg._exec(1, "zero","add","upd","del"), 0);
- } catch (CadiException | APIException | LocatorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ Item value = mock(Item.class);
+ Locator.Item item = new Locator.Item() {
+ };
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, item, secSet);
+ String[] strArr = {"add","upd","del"};
+ delg._exec(0, strArr);
+
+ String[] strArr1 = {"upd","del","add"};
+ delg._exec(0, strArr1);
+
+ String[] strArr2 = {"del","add"};
+ delg._exec(0, strArr2);
+
}
@Test
- public void exec_del() {
- try {
- assertEquals(delg._exec(2, "zero","add","upd","del"), 0);
- } catch (CadiException | APIException | LocatorException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ delg.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java
index 58942413..11517248 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListActivity {
-// private static ListActivity lsActivity;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// User usr = new User(cli);
-// List parent = new List(usr);
-// lsActivity = new ListActivity(parent);
-//
-// }
+ private static ListActivity lsActivity;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ User usr = new User(cli);
+ List parent = new List(usr);
+ lsActivity = new ListActivity(parent);
+
+ }
//
// @Test
// public void exec() {
@@ -68,8 +68,9 @@ public class JU_ListActivity {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsActivity.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java
index eea80640..977bbb11 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java
@@ -22,54 +22,85 @@
package org.onap.aaf.auth.cmd.test.user;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.ns.Create;
+import org.onap.aaf.auth.cmd.ns.NS;
import org.onap.aaf.auth.cmd.test.JU_AAFCli;
import org.onap.aaf.auth.cmd.user.List;
import org.onap.aaf.auth.cmd.user.ListApprovals;
import org.onap.aaf.auth.cmd.user.User;
+import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListApprovals {
-// private static ListApprovals lsApprovals;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// User usr = new User(cli);
-// List parent = new List(usr);
-// lsApprovals = new ListApprovals(parent);
-//
-// }
-//
-// @Test
-// public void exec() {
-// try {
-// assertEquals(lsApprovals._exec(0, "add","del","reset","extend","clear", "rename", "create"),500);
-// } catch (CadiException e) {
-//
-// e.printStackTrace();
-// } catch (APIException e) {
-//
-// e.printStackTrace();
-// } catch (LocatorException e) {
-//
-// e.printStackTrace();
-// }
-// }
+ private static ListApprovals lsApprovals;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+
+ @Before
+ public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ User usr = new User(aafcli);
+ List parent = new List(usr);
+ lsApprovals = new ListApprovals(parent);
+ }
+
+
+
+ @Test
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ Item value = mock(Item.class);
+ Locator.Item item = new Locator.Item() {
+ };
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, item, secSet);
+ String[] strArr = {"user","approver","ticket"};
+ //lsApprovals._exec(0, strArr);
+
+ }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsApprovals.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java
index 495170a2..a1a21ed4 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java
@@ -41,17 +41,17 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListDelegates {
-// private static ListDelegates lsDelegates;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// User usr = new User(cli);
-// List parent = new List(usr);
-// lsDelegates = new ListDelegates(parent);
-//
-// }
-//
+ private static ListDelegates lsDelegates;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ User usr = new User(cli);
+ List parent = new List(usr);
+ lsDelegates = new ListDelegates(parent);
+
+ }
+
// @Test
// public void exec() {
// try {
@@ -68,8 +68,9 @@ public class JU_ListDelegates {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsDelegates.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java
index da7fcc24..0573da4a 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java
@@ -22,8 +22,17 @@
package org.onap.aaf.auth.cmd.test.user;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -34,42 +43,62 @@ import org.onap.aaf.auth.cmd.test.JU_AAFCli;
import org.onap.aaf.auth.cmd.user.List;
import org.onap.aaf.auth.cmd.user.ListForCreds;
import org.onap.aaf.auth.cmd.user.User;
+import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListForCreds {
-//
-// private static ListForCreds lsForCreds;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// User usr = new User(cli);
-// List parent = new List(usr);
-// lsForCreds = new ListForCreds(parent);
-//
-// }
-//
-// @Test
-// public void exec() {
-// try {
-// assertEquals(lsForCreds._exec(0, "add","del","reset","extend","clear", "rename", "create"),500);
-// } catch (CadiException e) {
-//
-// e.printStackTrace();
-// } catch (APIException e) {
-//
-// e.printStackTrace();
-// } catch (LocatorException e) {
-//
-// e.printStackTrace();
-// }
-// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ private static ListForCreds lsForCreds;
+ User user;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+
+ @Before
+ public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ User usr = new User(aafcli);
+ List parent = new List(usr);
+ lsForCreds = new ListForCreds(parent);
+
+ }
+
+ @Test
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ Item value = mock(Item.class);
+ Locator.Item item = new Locator.Item() {
+ };
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, item, secSet);
+ String[] strArr = {"ns","id","ns","id"};
+ //lsForCreds._exec(0, strArr);
+
+ }
+
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsForCreds.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java
index f15738fd..bebd7eca 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java
@@ -40,18 +40,18 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListForPermission {
-//
-// private static ListForPermission lsForPermission;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// User usr = new User(cli);
-// List parent = new List(usr);
-// lsForPermission = new ListForPermission(parent);
-//
-// }
-//
+
+ private static ListForPermission lsForPermission;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ User usr = new User(cli);
+ List parent = new List(usr);
+ lsForPermission = new ListForPermission(parent);
+
+ }
+
// @Test
// public void exec() {
// try {
@@ -68,8 +68,9 @@ public class JU_ListForPermission {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsForPermission.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java
index 7e2614e9..457c1987 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java
@@ -41,17 +41,17 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListForRoles {
-// private static ListForRoles lsForRoles;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// User usr = new User(cli);
-// List parent = new List(usr);
-// lsForRoles = new ListForRoles(parent);
-//
-// }
-//
+ private static ListForRoles lsForRoles;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ User usr = new User(cli);
+ List parent = new List(usr);
+ lsForRoles = new ListForRoles(parent);
+
+ }
+
// @Test
// public void exec() {
// try {
@@ -68,8 +68,9 @@ public class JU_ListForRoles {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsForRoles.detailedHelp(0, sb);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java
index ce482bf2..9e2c3f59 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java
@@ -22,8 +22,17 @@
package org.onap.aaf.auth.cmd.test.user;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -33,41 +42,70 @@ import org.onap.aaf.auth.cmd.AAFcli;
import org.onap.aaf.auth.cmd.test.JU_AAFCli;
import org.onap.aaf.auth.cmd.user.Role;
import org.onap.aaf.auth.cmd.user.User;
+import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Role {
-// private static Role role;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// User usr = new User(cli);
-// role = new Role(usr);
-//
-// }
-//
-// @Test
-// public void exec() {
-// try {
-// assertEquals(role._exec(0, "add","del","reset","extend","clear", "rename", "create"),500);
-// } catch (CadiException e) {
-//
-// e.printStackTrace();
-// } catch (APIException e) {
-//
-// e.printStackTrace();
-// } catch (LocatorException e) {
-//
-// e.printStackTrace();
-// }
-// }
+ private static Role role;
+ User user;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+
+ @Before
+ public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ User usr = new User(aafcli);
+ role = new Role(usr);
+
+ }
+
+ @Test
+ public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+ Item value = mock(Item.class);
+ Locator.Item item = new Locator.Item() {
+ };
+ when(loc.best()).thenReturn(value);
+ URI uri = new URI("http://java.sun.com/j2se/1.3/");
+ when(loc.get(value)).thenReturn(uri);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ HRcli hcli = new HRcli(hman, uri, item, secSet);
+ String[] strArr = {"add", "del", "setTo","extend", "del", "setTo","extend"};
+ Assert.assertEquals(200, role._exec(0, strArr));
+
+ String[] strArr1 = { "del", "setTo","extend","add", "del", "setTo","extend"};
+ Assert.assertEquals(501, role._exec(0, strArr1));
+
+ String[] strArr2 = {"setTo","extend","add", "del", "del", "setTo","extend" };
+ Assert.assertEquals(501, role._exec(0, strArr2));
+
+ String[] strArr3 = {"extend","add", "del","setTo", "del", "setTo","extend" };
+ Assert.assertEquals(501, role._exec(0, strArr3));
+
+ }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ role.detailedHelp(0, sb);
}
}