diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-09-07 12:21:34 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-09-07 12:22:50 -0500 |
commit | 4b5a7d721d994a49057e9bfb403c7bff1b376660 (patch) | |
tree | a36d03227b63a3e60346d6c3ca87b061087dae85 /auth/auth-cmd/src/test/java/org | |
parent | 824dc7b5fc0e1ccdf7f460479aff344727f0f01e (diff) |
Mass removal of all Tabs (Style Warnings)
Issue-ID: AAF-473
Change-Id: Iaf0ef8120882937959bb0065f2f6ba74a021940f
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-cmd/src/test/java/org')
58 files changed, 2711 insertions, 2711 deletions
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/HMangrStub.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/HMangrStub.java index c1b87540..ddb39ea7 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/HMangrStub.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/HMangrStub.java @@ -33,26 +33,26 @@ import org.onap.aaf.cadi.client.Retryable; import org.onap.aaf.cadi.http.HMangr; public class HMangrStub extends HMangr { - - private Rcli<HttpURLConnection> clientMock; + + private Rcli<HttpURLConnection> clientMock; - public HMangrStub(Access access, Locator<URI> loc, Rcli<HttpURLConnection> clientMock) throws LocatorException { - super(access, loc); - this.clientMock = clientMock; - } + public HMangrStub(Access access, Locator<URI> loc, Rcli<HttpURLConnection> clientMock) throws LocatorException { + super(access, loc); + this.clientMock = clientMock; + } - @Override public<RET> RET same(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) { - try { - return retryable.code(clientMock); - } catch (Exception e) { - } - return null; - } - @Override public<RET> RET oneOf(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable, boolean notify, String host) { - try { - return retryable.code(clientMock); - } catch (Exception e) { - } - return null; - } + @Override public<RET> RET same(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) { + try { + return retryable.code(clientMock); + } catch (Exception e) { + } + return null; + } + @Override public<RET> RET oneOf(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable, boolean notify, String host) { + try { + return retryable.code(clientMock); + } catch (Exception e) { + } + return null; + } } 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 d9da835d..9f439053 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 @@ -52,209 +52,209 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_AAFCli { - private static AAFcli cli; - private static int TIMEOUT = Integer.parseInt(Config.AAF_CONN_TIMEOUT_DEF); + private static AAFcli cli; + private static int TIMEOUT = Integer.parseInt(Config.AAF_CONN_TIMEOUT_DEF); - @BeforeClass - public static void setUp() throws Exception, Exception { - cli = getAAfCli(); - } + @BeforeClass + public static void setUp() throws Exception, Exception { + cli = getAAfCli(); + } - @Test - public void eval() throws Exception { - assertTrue(cli.eval("#startswith")); - } + @Test + public void eval() throws Exception { + assertTrue(cli.eval("#startswith")); + } - @Test - public void eval_empty() throws Exception { - assertTrue(cli.eval("")); - } + @Test + public void eval_empty() throws Exception { + assertTrue(cli.eval("")); + } - @Test - public void eval1() throws Exception { - assertTrue(cli.eval("@[123")); - } + @Test + public void eval1() throws Exception { + assertTrue(cli.eval("@[123")); + } -// @Test -// public void eval2() throws Exception { -// assertFalse(cli.eval("as @[ 123")); -// } +// @Test +// public void eval2() throws Exception { +// assertFalse(cli.eval("as @[ 123")); +// } - @Test - public void eval3() throws Exception { - try { - cli.eval("expect @[ 123"); - } catch (Exception e) { - // TODO Auto-generated catch block - assertTrue(e instanceof CadiException); - } - } + @Test + public void eval3() throws Exception { + try { + cli.eval("expect @[ 123"); + } catch (Exception e) { + // TODO Auto-generated catch block + assertTrue(e instanceof CadiException); + } + } - public void eval31() throws Exception { - try { - cli.eval("expect 1 @[ 123"); - } catch (Exception e) { - // TODO Auto-generated catch block - assertTrue(e instanceof CadiException); - } - } + public void eval31() throws Exception { + try { + cli.eval("expect 1 @[ 123"); + } catch (Exception e) { + // TODO Auto-generated catch block + assertTrue(e instanceof CadiException); + } + } - @Test - public void eval4() throws Exception { - try { - cli.eval("sleep @[ 123"); - } catch (Exception e) { - assertTrue(e instanceof NumberFormatException); - } - } + @Test + public void eval4() throws Exception { + try { + cli.eval("sleep @[ 123"); + } catch (Exception e) { + assertTrue(e instanceof NumberFormatException); + } + } - @Test - public void eval41() throws Exception { - assertTrue(cli.eval("sleep 1 @[ 123")); - } + @Test + public void eval41() throws Exception { + assertTrue(cli.eval("sleep 1 @[ 123")); + } - @Test - public void eval5() throws Exception { - try { - cli.eval("delay @[ 123"); - } catch (Exception e) { - assertTrue(e instanceof NumberFormatException); - } - } + @Test + public void eval5() throws Exception { + try { + cli.eval("delay @[ 123"); + } catch (Exception e) { + assertTrue(e instanceof NumberFormatException); + } + } - @Test - public void eval51() throws Exception { - assertTrue(cli.eval("delay 1 @[ 123")); - } + @Test + public void eval51() throws Exception { + assertTrue(cli.eval("delay 1 @[ 123")); + } - @Test - public void eval7() throws Exception { - assertFalse(cli.eval("exit @[ 123")); - } + @Test + public void eval7() throws Exception { + assertFalse(cli.eval("exit @[ 123")); + } - @Test - public void eval8() throws Exception { - assertTrue(cli.eval("REQUEST @[ 123")); - } + @Test + public void eval8() throws Exception { + assertTrue(cli.eval("REQUEST @[ 123")); + } - @Test - public void eval9() throws Exception { - assertTrue(cli.eval("FORCE @[ 123")); - } + @Test + public void eval9() throws Exception { + assertTrue(cli.eval("FORCE @[ 123")); + } - @Test - 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 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 { - boolean noError=true; - try { - cli.keyboardHelp(); - } catch (Exception e) { - noError=false; - } - assertTrue(noError); - } + @Test + public void keyboardHelp() throws Exception { + boolean noError=true; + try { + cli.keyboardHelp(); + } catch (Exception e) { + noError=false; + } + assertTrue(noError); + } - @Test - public void setProp() throws Exception { - boolean noError=true; - try { - cli.keyboardHelp(); - } catch (Exception e) { - noError=false; - } - assertTrue(noError); - } - - @Test - public void eval_randomString() throws Exception { - assertTrue(cli.eval("Some random string @#&*& to check complete 100 coverage")); - } + @Test + public void setProp() throws Exception { + boolean noError=true; + try { + cli.keyboardHelp(); + } catch (Exception e) { + noError=false; + } + assertTrue(noError); + } + + @Test + public void eval_randomString() throws Exception { + assertTrue(cli.eval("Some random string @#&*& to check complete 100 coverage")); + } - public static AAFcli getAAfCli() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { - final AuthzEnv env = new AuthzEnv(System.getProperties()); - String aafUrl = "https://DME2RESOLVE"; - SecurityInfoC<HttpURLConnection> si = mock(SecurityInfoC.class); - env.loadToSystemPropsStartsWith("AAF", "DME2"); - Locator loc; - loc = new PropertyLocator(aafUrl); - TIMEOUT = Integer.parseInt(env.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF)); - HMangr hman = new HMangr(env, loc).readTimeout(TIMEOUT).apiVersion("2.0"); + public static AAFcli getAAfCli() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { + final AuthzEnv env = new AuthzEnv(System.getProperties()); + String aafUrl = "https://DME2RESOLVE"; + SecurityInfoC<HttpURLConnection> si = mock(SecurityInfoC.class); + env.loadToSystemPropsStartsWith("AAF", "DME2"); + Locator loc; + loc = new PropertyLocator(aafUrl); + TIMEOUT = Integer.parseInt(env.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF)); + HMangr hman = new HMangr(env, loc).readTimeout(TIMEOUT).apiVersion("2.0"); - // TODO: Consider requiring a default in properties - env.setProperty(Config.AAF_DEFAULT_REALM, - System.getProperty(Config.AAF_DEFAULT_REALM, Config.getDefaultRealm())); - - HBasicAuthSS ss = mock(HBasicAuthSS.class); - env.setProperty(Config.AAF_APPPASS, "test"); - return new AAFcli(env, new OutputStreamWriter(System.out), hman, si, ss); - } - - @Test - public void testVerbose() { - cli.verbose(true); - cli.verbose(false); - } - - @Test - public void testClose() { - cli.close(); - } - - @Test - public void testTimeout() { - Assert.assertNotNull(cli.timeout()); - } - - @Test - public void testTest() { - Assert.assertNotNull(cli.isTest()); - } - - @Test - public void testIsDetailed() { - Assert.assertNotNull(cli.isDetailed()); - } - - @Test - public void testAddRequest() { - Assert.assertNotNull(cli.addRequest()); - } - - @Test - public void testForceString() { - cli.clearSingleLineProperties(); - Assert.assertNull(cli.forceString()); - } - - @Test - public void testClearSingleLineProperties() { - cli.clearSingleLineProperties(); - } - - @Test - public void testGui() { - cli.gui(true); - cli.gui(false); - } - - @Test - public void testMain() { - String[] strArr = {"\\*","test1"}; - //cli.main(strArr); - } - + // TODO: Consider requiring a default in properties + env.setProperty(Config.AAF_DEFAULT_REALM, + System.getProperty(Config.AAF_DEFAULT_REALM, Config.getDefaultRealm())); + + HBasicAuthSS ss = mock(HBasicAuthSS.class); + env.setProperty(Config.AAF_APPPASS, "test"); + return new AAFcli(env, new OutputStreamWriter(System.out), hman, si, ss); + } + + @Test + public void testVerbose() { + cli.verbose(true); + cli.verbose(false); + } + + @Test + public void testClose() { + cli.close(); + } + + @Test + public void testTimeout() { + Assert.assertNotNull(cli.timeout()); + } + + @Test + public void testTest() { + Assert.assertNotNull(cli.isTest()); + } + + @Test + public void testIsDetailed() { + Assert.assertNotNull(cli.isDetailed()); + } + + @Test + public void testAddRequest() { + Assert.assertNotNull(cli.addRequest()); + } + + @Test + public void testForceString() { + cli.clearSingleLineProperties(); + Assert.assertNull(cli.forceString()); + } + + @Test + public void testClearSingleLineProperties() { + cli.clearSingleLineProperties(); + } + + @Test + public void testGui() { + cli.gui(true); + 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 79a3dd53..211ec7d0 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 @@ -50,71 +50,71 @@ import aaf.v2_0.History; @RunWith(MockitoJUnitRunner.class) public class JU_BaseCmd { - private static AAFcli cli; - private static BaseCmd bCmd; - - @BeforeClass - public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { - 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 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); - - } + private static AAFcli cli; + private static BaseCmd bCmd; + + @BeforeClass + public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { + 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 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_BasicAuth.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BasicAuth.java index 7cc5cede..d035ac59 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BasicAuth.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BasicAuth.java @@ -35,22 +35,22 @@ import junit.framework.Assert; //TODO: Gabe [JUnit] Import missing @RunWith(MockitoJUnitRunner.class) public class JU_BasicAuth { - -// @Test -// public void getID () { -// try { -// BasicAuth bAuth = new BasicAuth("testUser", "nopass"); -// assertEquals(bAuth.getID(), "testUser"); -// System.out.println(bAuth.getID()); -// } catch (IOException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// -// } - - @Test - public void netYetTested() { - Assert.assertTrue(true); - } + +// @Test +// public void getID () { +// try { +// BasicAuth bAuth = new BasicAuth("testUser", "nopass"); +// assertEquals(bAuth.getID(), "testUser"); +// System.out.println(bAuth.getID()); +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// +// } + + @Test + public void netYetTested() { + Assert.assertTrue(true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java index 3566555d..8adeeee3 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java @@ -62,130 +62,130 @@ import org.junit.Test; public class JU_Cmd { - CmdStub cmd; - CmdStub cmd1; - CmdStub cmd2; - AAFcli cli; - - private class CmdStub extends Cmd { + CmdStub cmd; + CmdStub cmd1; + CmdStub cmd2; + AAFcli cli; + + private class CmdStub extends Cmd { - public CmdStub(AAFcli aafcli, String name, Param[] params) { - super(aafcli, name, params); - // TODO Auto-generated constructor stub - } - - public CmdStub(Cmd parent, String name, Param[] params) { - super(parent, name, params); - // TODO Auto-generated constructor stub - } + public CmdStub(AAFcli aafcli, String name, Param[] params) { + super(aafcli, name, params); + // TODO Auto-generated constructor stub + } + + public CmdStub(Cmd parent, String name, Param[] params) { + super(parent, name, params); + // TODO Auto-generated constructor stub + } - @Override - protected int _exec(int idx, String... args) throws CadiException, APIException, LocatorException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void error(Future<?> future) { - super.error(future); - } + @Override + protected int _exec(int idx, String... args) throws CadiException, APIException, LocatorException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void error(Future<?> future) { + super.error(future); + } - } - - @Before - public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { - cli = JU_AAFCli.getAAfCli(); - Param[] param = new Param[] {new Param("name",true)}; - - cmd = new CmdStub(cli,"test", param); - cmd1 = new CmdStub(cmd,"test", param); - cmd2 = new CmdStub(cmd,"test", param); - } - - @Test - public void testReportColHead() { - String[] args = new String[] {new String("test")}; - cmd.reportColHead("format", args); - } - - @Test - public void testBuilder() { - StringBuilder detail = new StringBuilder(); - StringBuilder sb = new StringBuilder("test 123"); - - cmd.build(sb, detail); - detail.append("test"); - cmd.build(sb, detail); - } - - @Test - public void testApi() throws APIException, CadiException { - StringBuilder sb = new StringBuilder("test 123"); - Define def = new Define(); - PropAccess prop = new PropAccess(); - def.set(prop); - Mgmt mgmt = new Mgmt(cli); - Cache cache = new Cache(mgmt); - Clear clr = new Clear(cache); - clr.detailedHelp(0, sb); - } - - @Test - public void testToString() { - cmd.toString(); - } - - @Test - public void testFullID() { - cmd.fullID("test"); - cmd.fullID("t@st"); - cmd.fullID(null); - } - - @Test - public void testError() { - Future<?> future = mock(Future.class); - cmd.error(future); - when(future.code()).thenReturn(401); - cmd.error(future); - when(future.code()).thenReturn(403); - cmd.error(future); - when(future.code()).thenReturn(404); - cmd.error(future); - when(future.body()).thenReturn("NotNull"); - cmd.error(future); - when(future.body()).thenReturn("{NotNull"); - cmd.error(future); - when(future.body()).thenReturn("<html>NotNull"); - cmd.error(future); - } - - @Test - public void testActivity() { - History hist = new History(); - cmd.activity(hist, "test"); - cmd.activity(hist, "te[st"); - } - - @Test - public void testWhichOption() throws CadiException { - String[] strArr = {"a", "b", "c"}; - cmd.whichOption(strArr, "b"); - } - - @Test - public void testOneOf() throws APIException, CadiException, LocatorException { - Retryable retryable = mock(Retryable.class); - //cmd.oneOf(retryable, "host"); //TODO: AAF-111 need input for hMan - } - - @Test - public void testExec() throws CadiException, APIException, LocatorException { - String[] strArr = {"a", "b", "c"}; - cmd.exec(1, strArr); - } - - + } + + @Before + public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { + cli = JU_AAFCli.getAAfCli(); + Param[] param = new Param[] {new Param("name",true)}; + + cmd = new CmdStub(cli,"test", param); + cmd1 = new CmdStub(cmd,"test", param); + cmd2 = new CmdStub(cmd,"test", param); + } + + @Test + public void testReportColHead() { + String[] args = new String[] {new String("test")}; + cmd.reportColHead("format", args); + } + + @Test + public void testBuilder() { + StringBuilder detail = new StringBuilder(); + StringBuilder sb = new StringBuilder("test 123"); + + cmd.build(sb, detail); + detail.append("test"); + cmd.build(sb, detail); + } + + @Test + public void testApi() throws APIException, CadiException { + StringBuilder sb = new StringBuilder("test 123"); + Define def = new Define(); + PropAccess prop = new PropAccess(); + def.set(prop); + Mgmt mgmt = new Mgmt(cli); + Cache cache = new Cache(mgmt); + Clear clr = new Clear(cache); + clr.detailedHelp(0, sb); + } + + @Test + public void testToString() { + cmd.toString(); + } + + @Test + public void testFullID() { + cmd.fullID("test"); + cmd.fullID("t@st"); + cmd.fullID(null); + } + + @Test + public void testError() { + Future<?> future = mock(Future.class); + cmd.error(future); + when(future.code()).thenReturn(401); + cmd.error(future); + when(future.code()).thenReturn(403); + cmd.error(future); + when(future.code()).thenReturn(404); + cmd.error(future); + when(future.body()).thenReturn("NotNull"); + cmd.error(future); + when(future.body()).thenReturn("{NotNull"); + cmd.error(future); + when(future.body()).thenReturn("<html>NotNull"); + cmd.error(future); + } + + @Test + public void testActivity() { + History hist = new History(); + cmd.activity(hist, "test"); + cmd.activity(hist, "te[st"); + } + + @Test + public void testWhichOption() throws CadiException { + String[] strArr = {"a", "b", "c"}; + cmd.whichOption(strArr, "b"); + } + + @Test + public void testOneOf() throws APIException, CadiException, LocatorException { + Retryable retryable = mock(Retryable.class); + //cmd.oneOf(retryable, "host"); //TODO: AAF-111 need input for hMan + } + + @Test + public void testExec() throws CadiException, APIException, LocatorException { + String[] strArr = {"a", "b", "c"}; + cmd.exec(1, strArr); + } + + } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java index 02a9e26f..32697473 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java @@ -47,32 +47,32 @@ import org.junit.Test; public class JU_DeprecatedCMD { - CmdStub cmd; - AAFcli cli; - - private class CmdStub extends Cmd { + CmdStub cmd; + AAFcli cli; + + private class CmdStub extends Cmd { - public CmdStub(AAFcli aafcli, String name, Param[] params) { - super(aafcli, name, params); - // TODO Auto-generated constructor stub - } + public CmdStub(AAFcli aafcli, String name, Param[] params) { + super(aafcli, name, params); + // TODO Auto-generated constructor stub + } - @Override - protected int _exec(int idx, String... args) throws CadiException, APIException, LocatorException { - // TODO Auto-generated method stub - return 0; - } - - } - - @Test - public void testExec() throws CadiException, APIException, LocatorException, GeneralSecurityException, IOException { - cli = JU_AAFCli.getAAfCli(); - Param[] param = new Param[] {new Param("name",true)}; - - cmd = new CmdStub(cli,"test", param); - DeprecatedCMD deprecatedcmd = new DeprecatedCMD(cmd,"test", "test"); - deprecatedcmd._exec(0, "test"); - } + @Override + protected int _exec(int idx, String... args) throws CadiException, APIException, LocatorException { + // TODO Auto-generated method stub + return 0; + } + + } + + @Test + public void testExec() throws CadiException, APIException, LocatorException, GeneralSecurityException, IOException { + cli = JU_AAFCli.getAAfCli(); + Param[] param = new Param[] {new Param("name",true)}; + + cmd = new CmdStub(cli,"test", param); + DeprecatedCMD deprecatedcmd = new DeprecatedCMD(cmd,"test", "test"); + deprecatedcmd._exec(0, "test"); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Help.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Help.java index 50da3e37..9599e803 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Help.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Help.java @@ -50,79 +50,79 @@ import junit.framework.Assert; @RunWith(MockitoJUnitRunner.class) public class JU_Help { - - private static AAFcli cli; - private static Help help; - String[] strArr = {"null","null","b","c"}; - private class CmdStub extends Cmd { + + private static AAFcli cli; + private static Help help; + String[] strArr = {"null","null","b","c"}; + private class CmdStub extends Cmd { - public CmdStub(AAFcli aafcli, String name, Param[] params) { - super(aafcli, name, params); - // TODO Auto-generated constructor stub - } - - public CmdStub(Cmd parent, String name, Param[] params) { - super(parent, name, params); - // TODO Auto-generated constructor stub - } + public CmdStub(AAFcli aafcli, String name, Param[] params) { + super(aafcli, name, params); + // TODO Auto-generated constructor stub + } + + public CmdStub(Cmd parent, String name, Param[] params) { + super(parent, name, params); + // TODO Auto-generated constructor stub + } - @Override - protected int _exec(int idx, String... args) throws CadiException, APIException, LocatorException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void error(Future<?> future) { - super.error(future); - } - - } - - @Mock - private static List<Cmd> cmds; - - @Before - public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { - cli = JU_AAFCli.getAAfCli(); - cmds = new ArrayList<>(); - Param[] param = new Param[] {new Param("name",true)}; - CmdStub cmd = new CmdStub(cli, "null", param); - cmds.add(cmd); - help = new Help(cli, cmds); - } - - @Test - public void exec_HTTP_200() { - try { - assertEquals(help._exec(1, "helps"), HttpStatus.OK_200); - assertEquals(help._exec(1, strArr), HttpStatus.OK_200); - } catch (CadiException | APIException | LocatorException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Test - public void exec_HTTP_200_1() { - try { - assertEquals(help._exec(1, "helps","help"), HttpStatus.OK_200); - } catch (CadiException | APIException | LocatorException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Test - public void detailhelp() { - boolean hasError=false; - try { - help.detailedHelp(2, new StringBuilder("detail help test")); - } catch (Exception e) { - hasError=true; - } - assertEquals(hasError,false); - } + @Override + protected int _exec(int idx, String... args) throws CadiException, APIException, LocatorException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void error(Future<?> future) { + super.error(future); + } + + } + + @Mock + private static List<Cmd> cmds; + + @Before + public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { + cli = JU_AAFCli.getAAfCli(); + cmds = new ArrayList<>(); + Param[] param = new Param[] {new Param("name",true)}; + CmdStub cmd = new CmdStub(cli, "null", param); + cmds.add(cmd); + help = new Help(cli, cmds); + } + + @Test + public void exec_HTTP_200() { + try { + assertEquals(help._exec(1, "helps"), HttpStatus.OK_200); + assertEquals(help._exec(1, strArr), HttpStatus.OK_200); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void exec_HTTP_200_1() { + try { + assertEquals(help._exec(1, "helps","help"), HttpStatus.OK_200); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void detailhelp() { + boolean hasError=false; + try { + help.detailedHelp(2, new StringBuilder("detail help test")); + } catch (Exception e) { + hasError=true; + } + assertEquals(hasError,false); + } } 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 c0ac0f21..112fc92c 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 @@ -45,24 +45,24 @@ import junit.framework.Assert; //TODO: Gabe [JUnit] Import missing @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, CadiException { - 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); + + private static AAFcli cli; + private static Version version; + + @BeforeClass + public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { + 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); // -// } - - @Test //TODO: Temporary fix AAF-111 - public void netYetTested() { - Assert.assertTrue(true); - } +// } + + @Test //TODO: Temporary fix AAF-111 + public void netYetTested() { + Assert.assertTrue(true); + } } 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 43d228d6..102e8fcd 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 @@ -58,51 +58,51 @@ 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); - - } - - @Test - public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException { - Item value = mock(Item.class); - when(loc.best()).thenReturn(value); - URI uri = new URI("http://www.oracle.com/technetwork/java/index.html"); - 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); + + 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); + + } + + @Test + public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException { + Item value = mock(Item.class); + when(loc.best()).thenReturn(value); + URI uri = new URI("http://www.oracle.com/technetwork/java/index.html"); + 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 testDetailedHelp() throws CadiException { - Define define = new Define(); - define.set(prop); - StringBuilder sb = new StringBuilder(); -// clr.detailedHelp(0, sb); - } + } + + @Test + 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_Deny.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java index 7e888a7c..5b372881 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java @@ -59,50 +59,50 @@ import java.net.URISyntaxException; import org.junit.Test; public class JU_Deny { - - Deny deny; - DenySomething denyS; - PropAccess prop; - AuthzEnv aEnv; - Writer wtr; - Locator<URI> loc; - HMangr hman; - AAFcli aafcli; + + Deny deny; + DenySomething denyS; + 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); -// Mgmt mgmt = new Mgmt(aafcli); -// deny = new Deny(mgmt); - //denyS = deny.new DenySomething(deny,"ip","ipv4or6[,ipv4or6]*"); + @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 mgmt = new Mgmt(aafcli); +// deny = new Deny(mgmt); + //denyS = deny.new DenySomething(deny,"ip","ipv4or6[,ipv4or6]*"); - } - - + } + + - @Test - public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { - Item value = mock(Item.class); - Locator.Item item = new Locator.Item() { - }; - when(loc.best()).thenReturn(value); - URI uri = new URI("http://www.oracle.com/technetwork/java/index.html"); - when(loc.get(value)).thenReturn(uri); - SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); -// HRcli hcli = new HRcli(hman, uri, item, secSet); + @Test + public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + Item value = mock(Item.class); + Locator.Item item = new Locator.Item() { + }; + when(loc.best()).thenReturn(value); + URI uri = new URI("http://www.oracle.com/technetwork/java/index.html"); + when(loc.get(value)).thenReturn(uri); + SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); +// HRcli hcli = new HRcli(hman, uri, item, secSet); -// String[] strArr = {"add","del", "add","del"}; -// deny._exec(0, strArr); -// -// String[] strArr1 = {"del", "add","del"}; -// deny._exec(0, strArr1); - - } +// String[] strArr = {"add","del", "add","del"}; +// deny._exec(0, strArr); +// +// String[] strArr1 = {"del", "add","del"}; +// deny._exec(0, strArr1); + + } } 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 6e6f06ed..6b227f38 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 @@ -55,53 +55,53 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Log { - - private static Log log; - private static Log log1; - PropAccess prop; - AuthzEnv aEnv; - Writer wtr; - Locator<URI> loc; - HMangr hman; - AAFcli aafcli; - - @Before - public void setUp() throws APIException, LocatorException, CadiException { - 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 mgmt = new Mgmt(aafcli); - 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://www.oracle.com/technetwork/java/index.html"); - 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"}; -// log1._exec(0, strArr); + + private static Log log; + private static Log log1; + PropAccess prop; + AuthzEnv aEnv; + Writer wtr; + Locator<URI> loc; + HMangr hman; + AAFcli aafcli; + + @Before + public void setUp() throws APIException, LocatorException, CadiException { + 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 mgmt = new Mgmt(aafcli); + 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://www.oracle.com/technetwork/java/index.html"); + 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"}; +// log1._exec(0, strArr); // -// String[] strArr1 = {"del","add","upd","del"}; -// log1._exec(0, strArr1); +// 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); - } + } + + @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 f55bf2f9..f1f4d9a9 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 @@ -56,50 +56,50 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_SessClear { - - private static SessClear sessclr; - PropAccess prop; - AuthzEnv aEnv; - Writer wtr; - Locator<URI> loc; - HMangr hman; - AAFcli aafcli; - - @Before - public void setUp() throws LocatorException, APIException, CadiException { - 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 mgmt = new Mgmt(aafcli); -// Session sess = new Session(mgmt); -// sessclr = new SessClear(sess); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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); + + private static SessClear sessclr; + PropAccess prop; + AuthzEnv aEnv; + Writer wtr; + Locator<URI> loc; + HMangr hman; + AAFcli aafcli; + + @Before + public void setUp() throws LocatorException, APIException, CadiException { + 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 mgmt = new Mgmt(aafcli); +// Session sess = new Session(mgmt); +// sessclr = new SessClear(sess); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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() throws CadiException { - Define define = new Define(); - define.set(prop); - StringBuilder sb = new StringBuilder(); -// sessclr.detailedHelp(0, sb); - } + } + + @Test + public void testDetailedHelp() throws CadiException { + Define define = new Define(); + define.set(prop); + StringBuilder sb = new StringBuilder(); +// 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 35dead11..ef4383fe 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 @@ -56,57 +56,57 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Admin { - private static Admin admin; - - PropAccess prop; - AuthzEnv aEnv; - Writer wtr; - Locator<URI> loc; - HMangr hman; - AAFcli aafcli; - + private static Admin admin; + + 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); - NS ns = new NS(aafcli); - admin = new Admin(ns); - - } - - @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://www.oracle.com/technetwork/java/index.html"); - when(loc.get(value)).thenReturn(uri); - SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); -// HRcli hcli = new HRcli(hman, uri, item, secSet); -// String[] strArr = {"add", "del","add","add"}; -// admin._exec(0, strArr); -// -// String[] strArr1 = {"del","add","add"}; -// admin._exec(0, strArr1); - - } + @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); + NS ns = new NS(aafcli); + admin = new Admin(ns); + + } + + @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://www.oracle.com/technetwork/java/index.html"); + when(loc.get(value)).thenReturn(uri); + SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); +// HRcli hcli = new HRcli(hman, uri, item, secSet); +// String[] strArr = {"add", "del","add","add"}; +// admin._exec(0, strArr); +// +// String[] strArr1 = {"del","add","add"}; +// admin._exec(0, strArr1); + + } - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - admin.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + admin.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } 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 181b4526..0f14d8ea 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 @@ -61,57 +61,57 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Attrib { - private static Attrib attrib; - PropAccess prop; - AuthzEnv aEnv; - Writer wtr; - Locator<URI> loc; - HMangr hman; - AAFcli aafcli; + private static Attrib attrib; + 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); - NS ns = new NS(aafcli); - attrib = new Attrib(ns); - } + @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); + NS ns = new NS(aafcli); + attrib = new Attrib(ns); + } - @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://www.oracle.com/technetwork/java/index.html"); - 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","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 + 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://www.oracle.com/technetwork/java/index.html"); + 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","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 - public void detailedHelp() { - boolean hasNoError = true; - try { - attrib.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + attrib.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java index bc590695..83417138 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java @@ -51,52 +51,52 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Create { - private static Create create;//might need to replace import with org.onap.aaf.auth.cmd.perm - 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); - NS ns = new NS(aafcli); - create = new Create(ns); - } - - + private static Create create;//might need to replace import with org.onap.aaf.auth.cmd.perm + 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); + NS ns = new NS(aafcli); + create = new Create(ns); + } + + - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; - create._exec(0, strArr); - - } + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; + create._exec(0, strArr); + + } - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - create.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + create.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java index ee877a4b..8d4c739d 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java @@ -49,52 +49,52 @@ import org.onap.aaf.misc.env.APIException; public class JU_Delete { - private static Delete delete;//import may be org.onap.aaf.auth.cmd.perm - PropAccess prop; - AuthzEnv aEnv; - Writer wtr; - Locator<URI> loc; - HMangr hman; - AAFcli aafcli; - - @Before - public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { - 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); - NS ns = new NS(aafcli); - delete = new Delete(ns); + private static Delete delete;//import may be org.onap.aaf.auth.cmd.perm + PropAccess prop; + AuthzEnv aEnv; + Writer wtr; + Locator<URI> loc; + HMangr hman; + AAFcli aafcli; + + @Before + public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { + 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); + NS ns = new NS(aafcli); + delete = new Delete(ns); - } + } - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; -// delete._exec(0, strArr); - - } + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; +// delete._exec(0, strArr); + + } - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - delete.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + delete.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java index c0efec00..862c1158 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java @@ -48,47 +48,47 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Describe { - - private static Describe desc; - 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); - NS ns = new NS(aafcli); - desc = new Describe(ns); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; -// desc._exec(0, strArr); - - } - - @Test - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - desc.detailedHelp(0, sb ); - } + + private static Describe desc; + 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); + NS ns = new NS(aafcli); + desc = new Describe(ns); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; +// desc._exec(0, strArr); + + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + desc.detailedHelp(0, sb ); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java index a6d2130f..78add994 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java @@ -53,91 +53,91 @@ import static org.mockito.Mockito.*; import org.junit.Test; public class JU_List { - - List list; - AAFcli aafcli; - User user; - - private class NssStub extends Nss { - public void addNs(Nss.Ns ns) { - if (this.ns == null) { - this.ns = new ArrayList<>(); - } - this.ns.add(ns); - } - - private class NsStub extends Ns{ - public void addAttrib(Nss.Ns.Attrib attrib) { - if ( this.attrib == null) { - this.attrib = new ArrayList<>(); - } - this.attrib.add(attrib); - } - - public void addResponsible(String str) { - if (this.responsible == null) { - this.responsible = new ArrayList<>(); - } - this.responsible.add(str); - } - - public void addAdmin(String str) { - if (this.admin == null) { - this.admin = new ArrayList<>(); - } - this.admin.add(str); - } - } - - - - - } - + + List list; + AAFcli aafcli; + User user; + + private class NssStub extends Nss { + public void addNs(Nss.Ns ns) { + if (this.ns == null) { + this.ns = new ArrayList<>(); + } + this.ns.add(ns); + } + + private class NsStub extends Ns{ + public void addAttrib(Nss.Ns.Attrib attrib) { + if ( this.attrib == null) { + this.attrib = new ArrayList<>(); + } + this.attrib.add(attrib); + } + + public void addResponsible(String str) { + if (this.responsible == null) { + this.responsible = new ArrayList<>(); + } + this.responsible.add(str); + } + + public void addAdmin(String str) { + if (this.admin == null) { + this.admin = new ArrayList<>(); + } + this.admin.add(str); + } + } + + + + + } + - @Before - public void setUp() throws APIException, LocatorException, CadiException { - PropAccess prop = new PropAccess(); - AuthzEnv aEnv = new AuthzEnv(); - Writer wtr = mock(Writer.class); - Locator loc = mock(Locator.class); - HMangr hman = new HMangr(aEnv, loc); - aafcli = new AAFcli(prop, aEnv, wtr, hman, null, null); - user = new User(); - NS ns = new NS(aafcli); - - list = new List(ns); - } - - @Test - public void testReport() throws Exception { - Future<Nss> fu = mock(Future.class); - NssStub nssStub = new NssStub(); - NssStub.NsStub nsStub = nssStub.new NsStub(); - Nss.Ns.Attrib attrib = mock(Nss.Ns.Attrib.class); - when(attrib.getKey()).thenReturn("key"); - when(attrib.getValue()).thenReturn("value"); - nsStub.addAttrib(attrib); - nsStub.addResponsible("test"); - nsStub.addAdmin("admin"); - nssStub.addNs(nsStub); - fu.value = nssStub; - aafcli.eval("DETAILS @[ 123"); - - list.report(fu, "test"); - } - - @Test - public void testGetType() { - Assert.assertEquals("n/a", list.getType(user)); - user.setType(1); - Assert.assertEquals("U/P", list.getType(user)); - user.setType(2); - Assert.assertEquals("U/P2", list.getType(user)); - user.setType(10); - Assert.assertEquals("Cert", list.getType(user)); - user.setType(200); - Assert.assertEquals("x509", list.getType(user)); - } - + @Before + public void setUp() throws APIException, LocatorException, CadiException { + PropAccess prop = new PropAccess(); + AuthzEnv aEnv = new AuthzEnv(); + Writer wtr = mock(Writer.class); + Locator loc = mock(Locator.class); + HMangr hman = new HMangr(aEnv, loc); + aafcli = new AAFcli(prop, aEnv, wtr, hman, null, null); + user = new User(); + NS ns = new NS(aafcli); + + list = new List(ns); + } + + @Test + public void testReport() throws Exception { + Future<Nss> fu = mock(Future.class); + NssStub nssStub = new NssStub(); + NssStub.NsStub nsStub = nssStub.new NsStub(); + Nss.Ns.Attrib attrib = mock(Nss.Ns.Attrib.class); + when(attrib.getKey()).thenReturn("key"); + when(attrib.getValue()).thenReturn("value"); + nsStub.addAttrib(attrib); + nsStub.addResponsible("test"); + nsStub.addAdmin("admin"); + nssStub.addNs(nsStub); + fu.value = nssStub; + aafcli.eval("DETAILS @[ 123"); + + list.report(fu, "test"); + } + + @Test + public void testGetType() { + Assert.assertEquals("n/a", list.getType(user)); + user.setType(1); + Assert.assertEquals("U/P", list.getType(user)); + user.setType(2); + Assert.assertEquals("U/P2", list.getType(user)); + user.setType(10); + Assert.assertEquals("Cert", list.getType(user)); + user.setType(200); + Assert.assertEquals("x509", list.getType(user)); + } + } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java index bdebe0f9..298d4732 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java @@ -57,49 +57,49 @@ 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; - - @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); - NS ns = new NS(aafcli); - List ls = new List(ns); - lsActivity = new ListActivity(ls); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; - //lsActivity._exec(0, strArr); - - } - - @Test - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsActivity.detailedHelp(0, sb ); - } + + private static ListActivity lsActivity; + 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); + NS ns = new NS(aafcli); + List ls = new List(ns); + lsActivity = new ListActivity(ls); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; + //lsActivity._exec(0, strArr); + + } + + @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/ns/JU_ListAdminResponsible.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java index 0e146edb..7d7422fd 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java @@ -56,48 +56,48 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListAdminResponsible { - - private static ListAdminResponsible lsAdminRes; - 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); - NS ns = new NS(aafcli); - List ls = new List(ns); - lsAdminRes = new ListAdminResponsible(ls); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; - //lsAdminRes._exec(0, strArr); - - } - - @Test - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsAdminRes.detailedHelp(0, sb ); - } + + private static ListAdminResponsible lsAdminRes; + 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); + NS ns = new NS(aafcli); + List ls = new List(ns); + lsAdminRes = new ListAdminResponsible(ls); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; + //lsAdminRes._exec(0, strArr); + + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + lsAdminRes.detailedHelp(0, sb ); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java index 48711dc9..c37237dc 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java @@ -56,48 +56,48 @@ 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; - - @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); - NS ns = new NS(aafcli); - List ls = new List(ns); - lsByName = new ListByName(ls); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; - //lsByName._exec(0, strArr); - - } - - @Test - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsByName.detailedHelp(0, sb ); - } + + private static ListByName lsByName; + 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); + NS ns = new NS(aafcli); + List ls = new List(ns); + lsByName = new ListByName(ls); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; + //lsByName._exec(0, strArr); + + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + lsByName.detailedHelp(0, sb ); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java index 5723f19f..5b697de0 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java @@ -41,37 +41,37 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListChildren { - - private static ListChildren lsChildren; - - @BeforeClass - public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - NS ns = new NS(cli); - List ls = new List(ns); - lsChildren = new ListChildren(ls); - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsChildren._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 testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsChildren.detailedHelp(0, sb ); - } + + private static ListChildren lsChildren; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns); + lsChildren = new ListChildren(ls); + } + +// @Test +// public void exec() { +// try { +// assertEquals(lsChildren._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 testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + lsChildren.detailedHelp(0, sb ); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java index a1b0da19..6c8e61a5 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java @@ -40,37 +40,37 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListNsKeysByAttrib { - - private static ListNsKeysByAttrib lsNsKeys; - - @BeforeClass - public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - NS ns = new NS(cli); - List ls = new List(ns); - lsNsKeys = new ListNsKeysByAttrib(ls); - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsNsKeys._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 testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsNsKeys.detailedHelp(0, sb ); - } + + private static ListNsKeysByAttrib lsNsKeys; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns); + lsNsKeys = new ListNsKeysByAttrib(ls); + } + +// @Test +// public void exec() { +// try { +// assertEquals(lsNsKeys._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 testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + lsNsKeys.detailedHelp(0, sb ); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java index 909e852e..f400e16d 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java @@ -52,29 +52,29 @@ import org.junit.Test; public class JU_ListUsers { - AAFcli cli; - NS ns; - List list; - ListUsers lUsers; - - @Before - public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { - cli = JU_AAFCli.getAAfCli(); - ns = new NS(cli); - list = new List(ns); - lUsers = new ListUsers(list); - } - - @Test - public void testReports() throws DatatypeConfigurationException { - Users.User user = new Users.User(); - GregorianCalendar gcal = new GregorianCalendar(); - XMLGregorianCalendar xgcal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal); - user.setExpires(xgcal); - - lUsers.report("header", "ns"); - lUsers.report("subHead"); - lUsers.report("prefix", user); - } + AAFcli cli; + NS ns; + List list; + ListUsers lUsers; + + @Before + public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException { + cli = JU_AAFCli.getAAfCli(); + ns = new NS(cli); + list = new List(ns); + lUsers = new ListUsers(list); + } + + @Test + public void testReports() throws DatatypeConfigurationException { + Users.User user = new Users.User(); + GregorianCalendar gcal = new GregorianCalendar(); + XMLGregorianCalendar xgcal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal); + user.setExpires(xgcal); + + lUsers.report("header", "ns"); + lUsers.report("subHead"); + lUsers.report("prefix", user); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java index 536d70fa..e0029791 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java @@ -55,51 +55,51 @@ import org.junit.Test; public class JU_ListUsersContact { - PropAccess prop; - AuthzEnv aEnv; - Writer wtr; - Locator<URI> loc; - HMangr hman; - AAFcli aafcli; - NS ns; - List list; - ListUsers lUsers; - ListUsersContact lUContact; - - @Before - public void setUp() throws LocatorException, APIException, CadiException { - 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); - ns = new NS(aafcli); - list = new List(ns); - lUsers = new ListUsers(list); - } - - @Test - public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException { - lUContact = new ListUsersContact(lUsers); - Item value = mock(Item.class); - Locator.Item item = new Locator.Item() { - }; - when(loc.best()).thenReturn(value); - URI uri = new URI("http://www.oracle.com/technetwork/java/index.html"); - when(loc.get(value)).thenReturn(uri); - SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); - HRcli hcli = new HRcli(hman, uri, item, secSet); - //lUContact._exec(0, "test"); - - } - - @Test - public void testDetailedHelp() { - lUContact = new ListUsersContact(lUsers); - StringBuilder sb = new StringBuilder(); - lUContact.detailedHelp(0, sb); - } + PropAccess prop; + AuthzEnv aEnv; + Writer wtr; + Locator<URI> loc; + HMangr hman; + AAFcli aafcli; + NS ns; + List list; + ListUsers lUsers; + ListUsersContact lUContact; + + @Before + public void setUp() throws LocatorException, APIException, CadiException { + 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); + ns = new NS(aafcli); + list = new List(ns); + lUsers = new ListUsers(list); + } + + @Test + public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException { + lUContact = new ListUsersContact(lUsers); + Item value = mock(Item.class); + Locator.Item item = new Locator.Item() { + }; + when(loc.best()).thenReturn(value); + URI uri = new URI("http://www.oracle.com/technetwork/java/index.html"); + when(loc.get(value)).thenReturn(uri); + SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); + HRcli hcli = new HRcli(hman, uri, item, secSet); + //lUContact._exec(0, "test"); + + } + + @Test + public void testDetailedHelp() { + lUContact = new ListUsersContact(lUsers); + StringBuilder sb = new StringBuilder(); + lUContact.detailedHelp(0, sb); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java index 9f61b009..8d4cf593 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java @@ -39,35 +39,35 @@ import org.onap.aaf.auth.cmd.test.JU_AAFCli; @RunWith(MockitoJUnitRunner.class) public class JU_ListUsersInRole { - private static ListUsersInRole lsUserinRole; + private static ListUsersInRole lsUserinRole; - @BeforeClass - public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - NS ns = new NS(cli); - List ls = new List(ns);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other options - ListUsers lsU = new ListUsers(ls); - lsUserinRole = new ListUsersInRole(lsU); - } + @BeforeClass + public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other options + ListUsers lsU = new ListUsers(ls); + lsUserinRole = new ListUsersInRole(lsU); + } -// @Test -// public void exec() { -// try { -// assertEquals(lsUserinRole._exec(0, "add", "del", "reset", "extend"), 500); -// } catch (Exception e) { -// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE"); -// } -// } +// @Test +// public void exec() { +// try { +// assertEquals(lsUserinRole._exec(0, "add", "del", "reset", "extend"), 500); +// } catch (Exception e) { +// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE"); +// } +// } - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - lsUserinRole.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + lsUserinRole.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java index 62984d63..dd750c66 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java @@ -39,40 +39,40 @@ import org.onap.aaf.auth.cmd.test.JU_AAFCli; @RunWith(MockitoJUnitRunner.class) public class JU_ListUsersWithPerm { - private static ListUsersWithPerm lsUserWithPerm; + private static ListUsersWithPerm lsUserWithPerm; - @BeforeClass - public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - NS ns = new NS(cli); - List ls = new List(ns);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other option - ListUsers lsU = new ListUsers(ls); - lsUserWithPerm = new ListUsersWithPerm(lsU); - } + @BeforeClass + public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other option + ListUsers lsU = new ListUsers(ls); + lsUserWithPerm = new ListUsersWithPerm(lsU); + } -// @Test -// public void exec() { -// try { -// assertEquals(lsUserWithPerm._exec(0, "add", "del", "reset", "extend"), 500); -// } catch (Exception e) { -// assertEquals(e.getMessage(), "No Services Found for https://DME2RESOLVE [ ]"); +// @Test +// public void exec() { +// try { +// assertEquals(lsUserWithPerm._exec(0, "add", "del", "reset", "extend"), 500); +// } catch (Exception e) { +// assertEquals(e.getMessage(), "No Services Found for https://DME2RESOLVE [ ]"); // -// } -// } +// } +// } - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - lsUserWithPerm.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } - - @Test //TODO: Temporary fix AAF-111 - public void netYetTested() { - Assert.assertTrue(true); - } + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + lsUserWithPerm.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } + + @Test //TODO: Temporary fix AAF-111 + public void netYetTested() { + Assert.assertTrue(true); + } } 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 a03cb3ad..2b552b91 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 @@ -52,31 +52,31 @@ import org.junit.Test; public class JU_Owner { - private static Owner owner; + private static Owner owner; - @BeforeClass - public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - NS ns = new NS(cli); - owner = new Owner(ns); - } - - @Test - public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException { - String[] strArr = {"add","del","add","del"}; - //owner._exec(0, strArr); + @BeforeClass + public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + owner = new Owner(ns); + } + + @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 { - owner.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + } + + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + owner.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Responsible.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Responsible.java index 4c1cdc6f..9229ba2c 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Responsible.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Responsible.java @@ -37,39 +37,39 @@ import org.onap.aaf.misc.env.APIException; public class JU_Responsible { -// private static Responsible responsible;//TODO: Gabe[JUnit] check with Jonathan +// private static Responsible responsible;//TODO: Gabe[JUnit] check with Jonathan // -// @BeforeClass -// public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException { -// AAFcli cli = JU_AAFCli.getAAfCli(); -// NS ns = new NS(cli); -// responsible = new Responsible(ns); +// @BeforeClass +// public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException { +// AAFcli cli = JU_AAFCli.getAAfCli(); +// NS ns = new NS(cli); +// responsible = new Responsible(ns); // -// } +// } // -// @Test -// public void exec1() { -// try { -// responsible._exec(0, "del", "del", "del"); -// } catch (Exception e) { -// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE"); -// } -// } +// @Test +// public void exec1() { +// try { +// responsible._exec(0, "del", "del", "del"); +// } catch (Exception e) { +// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE"); +// } +// } // -// @Test -// public void detailedHelp() { -// boolean hasNoError = true; -// try { -// responsible.detailedHelp(1, new StringBuilder("test")); -// } catch (Exception e) { -// hasNoError = false; -// } -// assertEquals(hasNoError, true); -// } - - @Test - public void netYetTested() { - Assert.assertTrue(true); - } +// @Test +// public void detailedHelp() { +// boolean hasNoError = true; +// try { +// responsible.detailedHelp(1, new StringBuilder("test")); +// } catch (Exception e) { +// hasNoError = false; +// } +// assertEquals(hasNoError, true); +// } + + @Test + public void netYetTested() { + Assert.assertTrue(true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java index 41295c79..bfd0ad6d 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java @@ -56,60 +56,60 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Create { - @Mock private SecuritySetter<HttpURLConnection> ssMock; - @Mock private Locator<URI> locMock; - @Mock private Writer wrtMock; - @Mock private Rcli<HttpURLConnection> clientMock; - @Mock private Future<String> futureMock; - - private static Create create; + @Mock private SecuritySetter<HttpURLConnection> ssMock; + @Mock private Locator<URI> locMock; + @Mock private Writer wrtMock; + @Mock private Rcli<HttpURLConnection> clientMock; + @Mock private Future<String> futureMock; + + private static Create create; - private NS ns; - private PropAccess access; - private HMangrStub hman; - private AuthzEnv aEnv; - private AAFcli aafcli; - - @Before - public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - MockitoAnnotations.initMocks(this); - - when(clientMock.create(any(), any(), any(String.class))).thenReturn(futureMock); - when(clientMock.delete(any(), any(), any(String.class))).thenReturn(futureMock); - when(clientMock.update(any(), any(), any(String.class))).thenReturn(futureMock); + private NS ns; + private PropAccess access; + private HMangrStub hman; + private AuthzEnv aEnv; + private AAFcli aafcli; + + @Before + public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + MockitoAnnotations.initMocks(this); + + when(clientMock.create(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.delete(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.update(any(), any(), any(String.class))).thenReturn(futureMock); - hman = new HMangrStub(access, locMock, clientMock); - access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]); - aEnv = new AuthzEnv(); - aafcli = new AAFcli(access, aEnv, wrtMock, hman, null, ssMock); - - ns = new NS(aafcli); + hman = new HMangrStub(access, locMock, clientMock); + access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]); + aEnv = new AuthzEnv(); + aafcli = new AAFcli(access, aEnv, wrtMock, hman, null, ssMock); + + ns = new NS(aafcli); - create = new Create(ns); - } - - @Test - public void testError() throws APIException, LocatorException, CadiException, URISyntaxException { - create._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - create._exec(4, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { - when(futureMock.code()).thenReturn(202); - create._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } + create = new Create(ns); + } + + @Test + public void testError() throws APIException, LocatorException, CadiException, URISyntaxException { + create._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + create._exec(4, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { + when(futureMock.code()).thenReturn(202); + create._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } - @Test - public void testSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { - when(futureMock.get(any(Integer.class))).thenReturn(true); - create._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - create.detailedHelp(0, sb); - } - + @Test + public void testSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { + when(futureMock.get(any(Integer.class))).thenReturn(true); + create._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + create.detailedHelp(0, sb); + } + }
\ No newline at end of file diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java index 19cacedb..e504b765 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java @@ -57,60 +57,60 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Delete { - - @Mock private SecuritySetter<HttpURLConnection> ssMock; - @Mock private Locator<URI> locMock; - @Mock private Writer wrtMock; - @Mock private Rcli<HttpURLConnection> clientMock; - @Mock private Future<String> futureMock; + + @Mock private SecuritySetter<HttpURLConnection> ssMock; + @Mock private Locator<URI> locMock; + @Mock private Writer wrtMock; + @Mock private Rcli<HttpURLConnection> clientMock; + @Mock private Future<String> futureMock; - private static Delete del; - - private PropAccess access; - private HMangrStub hman; - private AuthzEnv aEnv; - private AAFcli aafcli; - - @Before - public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - MockitoAnnotations.initMocks(this); + private static Delete del; + + private PropAccess access; + private HMangrStub hman; + private AuthzEnv aEnv; + private AAFcli aafcli; + + @Before + public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + MockitoAnnotations.initMocks(this); - when(clientMock.create(any(), any(), any(String.class))).thenReturn(futureMock); - when(clientMock.delete(any(), any(), any(String.class))).thenReturn(futureMock); - when(clientMock.update(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.create(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.delete(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.update(any(), any(), any(String.class))).thenReturn(futureMock); - hman = new HMangrStub(access, locMock, clientMock); - access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]); - aEnv = new AuthzEnv(); - aafcli = new AAFcli(access, aEnv, wrtMock, hman, null, ssMock); + hman = new HMangrStub(access, locMock, clientMock); + access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]); + aEnv = new AuthzEnv(); + aafcli = new AAFcli(access, aEnv, wrtMock, hman, null, ssMock); - Role role = new Role(aafcli); - Perm perm = new Perm(role); + Role role = new Role(aafcli); + Perm perm = new Perm(role); - del = new Delete(perm); - } - - @Test - public void testExecError() throws APIException, LocatorException, CadiException, URISyntaxException { - del._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } + del = new Delete(perm); + } + + @Test + public void testExecError() throws APIException, LocatorException, CadiException, URISyntaxException { + del._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } - @Test - public void testExecSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { - when(futureMock.code()).thenReturn(202); - del._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testExecSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { - when(futureMock.get(any(Integer.class))).thenReturn(true); - del._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - del.detailedHelp(0, sb); - } - + @Test + public void testExecSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { + when(futureMock.code()).thenReturn(202); + del._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testExecSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { + when(futureMock.get(any(Integer.class))).thenReturn(true); + del._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + del.detailedHelp(0, sb); + } + }
\ No newline at end of file diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java index 9a5fc734..4d3b36d0 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java @@ -57,58 +57,58 @@ import org.onap.aaf.auth.cmd.test.HMangrStub; @RunWith(MockitoJUnitRunner.class) public class JU_Describe { - @Mock private SecuritySetter<HttpURLConnection> ssMock; - @Mock private Locator<URI> locMock; - @Mock private Writer wrtMock; - @Mock private Rcli<HttpURLConnection> clientMock; - @Mock private Future<String> futureMock; + @Mock private SecuritySetter<HttpURLConnection> ssMock; + @Mock private Locator<URI> locMock; + @Mock private Writer wrtMock; + @Mock private Rcli<HttpURLConnection> clientMock; + @Mock private Future<String> futureMock; - private PropAccess access; - private HMangrStub hman; - private AuthzEnv aEnv; - private AAFcli aafcli; - - private Describe desc; - - @Before - public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - MockitoAnnotations.initMocks(this); + private PropAccess access; + private HMangrStub hman; + private AuthzEnv aEnv; + private AAFcli aafcli; + + private Describe desc; + + @Before + public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + MockitoAnnotations.initMocks(this); - when(clientMock.create(any(), any(), any(String.class))).thenReturn(futureMock); - when(clientMock.delete(any(), any(), any(String.class))).thenReturn(futureMock); - when(clientMock.update(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.create(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.delete(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.update(any(), any(), any(String.class))).thenReturn(futureMock); - hman = new HMangrStub(access, locMock, clientMock); - access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]); - aEnv = new AuthzEnv(); - aafcli = new AAFcli(access, aEnv, wrtMock, hman, null, ssMock); + hman = new HMangrStub(access, locMock, clientMock); + access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]); + aEnv = new AuthzEnv(); + aafcli = new AAFcli(access, aEnv, wrtMock, hman, null, ssMock); - Role role = new Role(aafcli); - Perm perm = new Perm(role); + Role role = new Role(aafcli); + Perm perm = new Perm(role); - desc = new Describe(perm); - } - - @Test - public void testExecError() throws APIException, LocatorException, CadiException, URISyntaxException { - desc._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testExecSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { - when(futureMock.code()).thenReturn(202); - desc._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testExecSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { - when(futureMock.get(any(Integer.class))).thenReturn(true); - desc._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - desc.detailedHelp(0, sb); - } + desc = new Describe(perm); + } + + @Test + public void testExecError() throws APIException, LocatorException, CadiException, URISyntaxException { + desc._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testExecSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { + when(futureMock.code()).thenReturn(202); + desc._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testExecSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { + when(futureMock.get(any(Integer.class))).thenReturn(true); + desc._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + desc.detailedHelp(0, sb); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java index 975b83d2..a85b1aa6 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java @@ -56,76 +56,76 @@ import org.onap.aaf.auth.cmd.test.HMangrStub; @RunWith(MockitoJUnitRunner.class) public class JU_Grant { - - private static Grant grant; + + private static Grant grant; - @Mock private SecuritySetter<HttpURLConnection> ssMock; - @Mock private Locator<URI> locMock; - @Mock private Writer wrtMock; - @Mock private Rcli<HttpURLConnection> clientMock; - @Mock private Future<String> futureMock; + @Mock private SecuritySetter<HttpURLConnection> ssMock; + @Mock private Locator<URI> locMock; + @Mock private Writer wrtMock; + @Mock private Rcli<HttpURLConnection> clientMock; + @Mock private Future<String> futureMock; - private PropAccess access; - private HMangrStub hman; - private AuthzEnv aEnv; - private AAFcli aafcli; - - @Before - public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - MockitoAnnotations.initMocks(this); + private PropAccess access; + private HMangrStub hman; + private AuthzEnv aEnv; + private AAFcli aafcli; + + @Before + public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + MockitoAnnotations.initMocks(this); - when(clientMock.create(any(), any(), any(String.class))).thenReturn(futureMock); - when(clientMock.delete(any(), any(), any(String.class))).thenReturn(futureMock); - when(clientMock.update(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.create(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.delete(any(), any(), any(String.class))).thenReturn(futureMock); + when(clientMock.update(any(), any(), any(String.class))).thenReturn(futureMock); - hman = new HMangrStub(access, locMock, clientMock); - access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]); - aEnv = new AuthzEnv(); - aafcli = new AAFcli(access, aEnv, wrtMock, hman, null, ssMock); + hman = new HMangrStub(access, locMock, clientMock); + access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]); + aEnv = new AuthzEnv(); + aafcli = new AAFcli(access, aEnv, wrtMock, hman, null, ssMock); - Role role = new Role(aafcli); - Perm perm = new Perm(role); + Role role = new Role(aafcli); + Perm perm = new Perm(role); - grant = new Grant(perm); - } + grant = new Grant(perm); + } - @Test - public void testExecError() throws APIException, LocatorException, CadiException, URISyntaxException { - grant._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testExecSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { - when(futureMock.code()).thenReturn(202); - grant._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - grant._exec(1, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testExecSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { - when(futureMock.get(any(Integer.class))).thenReturn(true); - grant._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testExecSetToError() throws APIException, LocatorException, CadiException, URISyntaxException { - grant._exec(2, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testExecSetToSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { - when(futureMock.get(any(Integer.class))).thenReturn(true); - grant._exec(2, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); - } - - @Test - public void testExecSetToSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { - grant._exec(2, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo","another"}); - } - - @Test - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - grant.detailedHelp(0, sb); - } + @Test + public void testExecError() throws APIException, LocatorException, CadiException, URISyntaxException { + grant._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testExecSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { + when(futureMock.code()).thenReturn(202); + grant._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + grant._exec(1, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testExecSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { + when(futureMock.get(any(Integer.class))).thenReturn(true); + grant._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testExecSetToError() throws APIException, LocatorException, CadiException, URISyntaxException { + grant._exec(2, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testExecSetToSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException { + when(futureMock.get(any(Integer.class))).thenReturn(true); + grant._exec(2, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"}); + } + + @Test + public void testExecSetToSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException { + grant._exec(2, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo","another"}); + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + grant.detailedHelp(0, sb); + } } 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 16bd3f9c..1f691768 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 @@ -57,48 +57,48 @@ 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; - - @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 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://www.oracle.com/technetwork/java/index.html"); - 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); + + private static ListActivity lsActivity; + 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); + Role role = new Role(aafcli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsActivity = new ListActivity(ls); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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() { - StringBuilder sb = new StringBuilder(); - lsActivity.detailedHelp(0, sb); - } + } + + @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/perm/JU_ListByNS.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByNS.java index e8f34f38..ee367541 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByNS.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByNS.java @@ -41,37 +41,37 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListByNS { - - private static ListByNS lsByNS; - - @BeforeClass - public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - Role role = new Role(cli); - Perm perm = new Perm(role); - List ls = new List(perm); - lsByNS = new ListByNS(ls); - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsByNS._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 testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsByNS.detailedHelp(0, sb); - } + + private static ListByNS lsByNS; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsByNS = new ListByNS(ls); + } + +// @Test +// public void exec() { +// try { +// assertEquals(lsByNS._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 testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + lsByNS.detailedHelp(0, sb); + } } 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 fb845181..a6c3a895 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 @@ -57,48 +57,48 @@ 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; - - @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 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://www.oracle.com/technetwork/java/index.html"); - 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); + + private static ListByName lsByName; + 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); + Role role = new Role(aafcli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsByName = new ListByName(ls); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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() { - StringBuilder sb = new StringBuilder(); - lsByName.detailedHelp(0, sb); - } + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + lsByName.detailedHelp(0, sb); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java index c9302aa2..ae61d267 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java @@ -41,37 +41,37 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListByRole { - - private static ListByRole lsByRole; - - @BeforeClass - public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - Role role = new Role(cli); - Perm perm = new Perm(role); - List ls = new List(perm); - lsByRole = new ListByRole(ls); - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsByRole._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 testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsByRole.detailedHelp(0, sb); - } + + private static ListByRole lsByRole; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsByRole = new ListByRole(ls); + } + +// @Test +// public void exec() { +// try { +// assertEquals(lsByRole._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 testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + lsByRole.detailedHelp(0, sb); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java index d220d397..5eafbf05 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java @@ -41,37 +41,37 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListByUser { - - private static ListByUser lsByName; - - @BeforeClass - public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - Role role = new Role(cli); - Perm perm = new Perm(role); - List ls = new List(perm); - lsByName = new ListByUser(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 testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsByName.detailedHelp(0, sb); - } + + private static ListByUser lsByName; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsByName = new ListByUser(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 testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + lsByName.detailedHelp(0, sb); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java index b4d86edd..5503750e 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java @@ -56,47 +56,47 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Rename { - - private static Rename rename; - 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); - Role role = new Role(aafcli); - Perm perm = new Perm(role); - rename = new Rename(perm); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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"}; -// rename._exec(0, strArr); - - } - - @Test - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - rename.detailedHelp(0, sb); - } + + private static Rename rename; + 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); + Role role = new Role(aafcli); + Perm perm = new Perm(role); + rename = new Rename(perm); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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"}; +// rename._exec(0, strArr); + + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + rename.detailedHelp(0, sb); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java index bf2741e5..e2cd56d4 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java @@ -55,54 +55,54 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_CreateDelete { - - private static CreateDelete createDel; - 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); - Role role = new Role(aafcli); - createDel = new CreateDelete(role); - } - - @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://www.oracle.com/technetwork/java/index.html"); - when(loc.get(value)).thenReturn(uri); - SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); -// HRcli hcli = new HRcli(hman, uri, item, secSet); -// String[] strArr = {"create","delete","create","delete"}; -// createDel._exec(0, strArr); -// -// String[] strArr1 = {"delete","create","delete"}; -// createDel._exec(0, strArr1); - - } - - @Test - public void testDetailedHelp() { - boolean hasNoError = true; - try { - createDel.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + + private static CreateDelete createDel; + 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); + Role role = new Role(aafcli); + createDel = new CreateDelete(role); + } + + @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://www.oracle.com/technetwork/java/index.html"); + when(loc.get(value)).thenReturn(uri); + SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); +// HRcli hcli = new HRcli(hman, uri, item, secSet); +// String[] strArr = {"create","delete","create","delete"}; +// createDel._exec(0, strArr); +// +// String[] strArr1 = {"delete","create","delete"}; +// createDel._exec(0, strArr1); + + } + + @Test + public void testDetailedHelp() { + boolean hasNoError = true; + try { + createDel.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java index 61236eee..8733ceac 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java @@ -49,51 +49,51 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Describe { - - private static Describe desc; - 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); - Role role = new Role(aafcli); - desc = new Describe(role); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; -// desc._exec(0, strArr); - - } - - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - desc.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + + private static Describe desc; + 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); + Role role = new Role(aafcli); + desc = new Describe(role); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; +// desc._exec(0, strArr); + + } + + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + desc.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } 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 84b3caa9..ce5d74d0 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 @@ -65,97 +65,97 @@ import java.util.ArrayList; 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; + + AAFcli cli; + Role role; + List list; + PropAccess prop; + AuthzEnv aEnv; + Writer wtr; + Locator<URI> loc; + HMangr hman; + AAFcli aafcli; - private class ListRolesStub extends List { + private class ListRolesStub extends List { - public ListRolesStub(Role parent) { - super(parent); - // TODO Auto-generated constructor stub - } - } - - private class RolesStub extends Roles { - public void addRole(aaf.v2_0.Role role) { - if (this.role == null) { - this.role = new ArrayList<>(); - } - this.role.add(role); - } - } - - private class RoleStub extends aaf.v2_0.Role { - - public void addPerms(Pkey perms) { - if (this.perms == null) { - this.perms = new ArrayList<>(); - } - this.perms.add(perms); - } - } - - @Before - public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException{ - 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(aafcli); - ListRolesStub listStub = new ListRolesStub(role); - Future future = mock(Future.class); - Rcli rcli = mock(Rcli.class); - - Class c = listStub.getClass(); - Class[] cArg = new Class[3]; - cArg[0] = Future.class; - cArg[1] = Rcli.class; - cArg[2] = String.class;//Steps to test a protected method - //Method listMethod = c.getDeclaredMethod("list", cArg); - //listMethod.setAccessible(true); - //listMethod.invoke(listStub, future, rcli, "test"); - - } - - @Test - public void testReport() throws Exception { - UserRoles urs = new UserRoles(); - Perms perms = new Perms(); - RolesStub roles = new RolesStub(); - list.report(roles, perms , urs , "test"); - AAFcli cli = JU_AAFCli.getAAfCli(); - RoleStub role = new RoleStub(); - roles.addRole(role); - Pkey pkey = new Pkey(); - pkey.setInstance("test"); - pkey.setAction("test"); - pkey.setInstance("test"); - pkey.setType("test"); - role.addPerms(pkey); - list.report(roles, perms , null , "test"); - list.report(roles, perms , urs , "test"); - - aafcli.eval("DETAILS @[ 123"); - role.setName("test"); + public ListRolesStub(Role parent) { + super(parent); + // TODO Auto-generated constructor stub + } + } + + private class RolesStub extends Roles { + public void addRole(aaf.v2_0.Role role) { + if (this.role == null) { + this.role = new ArrayList<>(); + } + this.role.add(role); + } + } + + private class RoleStub extends aaf.v2_0.Role { + + public void addPerms(Pkey perms) { + if (this.perms == null) { + this.perms = new ArrayList<>(); + } + this.perms.add(perms); + } + } + + @Before + public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException{ + 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(aafcli); + ListRolesStub listStub = new ListRolesStub(role); + Future future = mock(Future.class); + Rcli rcli = mock(Rcli.class); + + Class c = listStub.getClass(); + Class[] cArg = new Class[3]; + cArg[0] = Future.class; + cArg[1] = Rcli.class; + cArg[2] = String.class;//Steps to test a protected method + //Method listMethod = c.getDeclaredMethod("list", cArg); + //listMethod.setAccessible(true); + //listMethod.invoke(listStub, future, rcli, "test"); + + } + + @Test + public void testReport() throws Exception { + UserRoles urs = new UserRoles(); + Perms perms = new Perms(); + RolesStub roles = new RolesStub(); + list.report(roles, perms , urs , "test"); + AAFcli cli = JU_AAFCli.getAAfCli(); + RoleStub role = new RoleStub(); + roles.addRole(role); + Pkey pkey = new Pkey(); + pkey.setInstance("test"); + pkey.setAction("test"); + pkey.setInstance("test"); + pkey.setType("test"); + role.addPerms(pkey); + list.report(roles, perms , null , "test"); + list.report(roles, perms , urs , "test"); + + aafcli.eval("DETAILS @[ 123"); + role.setName("test"); - list.report(roles, perms , urs , "test"); - } + list.report(roles, perms , urs , "test"); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java index 4976f753..5c1a839e 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java @@ -56,52 +56,52 @@ 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; - - @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); - List ls = new List(role); - lsActivity = new ListActivity(ls); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; - //lsActivity._exec(0, strArr); - - } - - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - lsActivity.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + + private static ListActivity lsActivity; + 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); + Role role = new Role(aafcli); + List ls = new List(role); + lsActivity = new ListActivity(ls); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; + //lsActivity._exec(0, strArr); + + } + + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + lsActivity.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java index 6017905c..c8443912 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java @@ -40,41 +40,41 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListByNS { - - private static ListByNS lsByNS; - - @BeforeClass - public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - Role role = new Role(cli); - List ls = new List(role); - lsByNS = new ListByNS(ls); - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsByNS._exec(0, "add","del","reset","extend","clear", "rename", "create"),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 detailedHelp() { - boolean hasNoError = true; - try { - lsByNS.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + + private static ListByNS lsByNS; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + List ls = new List(role); + lsByNS = new ListByNS(ls); + } + +// @Test +// public void exec() { +// try { +// assertEquals(lsByNS._exec(0, "add","del","reset","extend","clear", "rename", "create"),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 detailedHelp() { + boolean hasNoError = true; + try { + lsByNS.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java index 49a53d82..1bac5004 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java @@ -56,52 +56,52 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListByNameOnly { - - private static ListByNameOnly lsByName; - 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); - Role role = new Role(aafcli); - List ls = new List(role); - lsByName = new ListByNameOnly(ls); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; - //lsByName._exec(0, strArr); - - } - - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - lsByName.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + + private static ListByNameOnly lsByName; + 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); + Role role = new Role(aafcli); + List ls = new List(role); + lsByName = new ListByNameOnly(ls); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; + //lsByName._exec(0, strArr); + + } + + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + lsByName.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java index 65f2c6f0..cc1a4b75 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java @@ -40,41 +40,41 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListByPerm { - - private static ListByPerm lsByPerm; - - @BeforeClass - public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - Role role = new Role(cli); - List ls = new List(role); - lsByPerm = new ListByPerm(ls); - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsByPerm._exec(0, "add","del","reset","extend","clear", "rename", "create"),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 detailedHelp() { - boolean hasNoError = true; - try { - lsByPerm.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + + private static ListByPerm lsByPerm; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + List ls = new List(role); + lsByPerm = new ListByPerm(ls); + } + +// @Test +// public void exec() { +// try { +// assertEquals(lsByPerm._exec(0, "add","del","reset","extend","clear", "rename", "create"),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 detailedHelp() { + boolean hasNoError = true; + try { + lsByPerm.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java index 37accbbc..064346ab 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java @@ -40,42 +40,42 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListByRole { - - private static ListByRole lsByRole; - - @BeforeClass - public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { - AAFcli cli = JU_AAFCli.getAAfCli(); - Role role = new Role(cli); - List ls = new List(role); - lsByRole = new ListByRole(ls); - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsByRole._exec(0, "add","del","reset","extend","clear", "rename", "create"),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 detailedHelp() { - boolean hasNoError = true; - try { - lsByRole.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } - + + private static ListByRole lsByRole; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + List ls = new List(role); + lsByRole = new ListByRole(ls); + } + +// @Test +// public void exec() { +// try { +// assertEquals(lsByRole._exec(0, "add","del","reset","extend","clear", "rename", "create"),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 detailedHelp() { + boolean hasNoError = true; + try { + lsByRole.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } + } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java index 86ce24cc..a6f297ec 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java @@ -56,53 +56,53 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListByUser { - - private static ListByUser lsByUser; - 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); - Role role = new Role(aafcli); - List ls = new List(role); - lsByUser = new ListByUser(ls); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","upd","del"}; - //lsByUser._exec(0, strArr); - - } - - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - lsByUser.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } - + + private static ListByUser lsByUser; + 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); + Role role = new Role(aafcli); + List ls = new List(role); + lsByUser = new ListByUser(ls); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","upd","del"}; + //lsByUser._exec(0, strArr); + + } + + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + lsByUser.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } + } diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java index ead62eb6..530362a8 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java @@ -56,60 +56,60 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_User { - - private static 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); - Role role = new Role(aafcli); - user = new User(role); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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","add","del","setTo","extend"}; -// user._exec(0, strArr); -// -// String[] strArr1 = {"del","setTo","extend","add","del","setTo","extend"}; -// user._exec(0, strArr1); -// -// String[] strArr2 = {"setTo","extend","add","del","setTo","extend"}; -// user._exec(0, strArr2); -// -// String[] strArr3 = {"extend","add","del","setTo","extend"}; -// user._exec(0, strArr3); - - } - - @Test - public void detailedHelp() { - boolean hasNoError = true; - try { - user.detailedHelp(1, new StringBuilder("test")); - } catch (Exception e) { - hasNoError = false; - } - assertEquals(hasNoError, true); - } + + private static 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); + Role role = new Role(aafcli); + user = new User(role); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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","add","del","setTo","extend"}; +// user._exec(0, strArr); +// +// String[] strArr1 = {"del","setTo","extend","add","del","setTo","extend"}; +// user._exec(0, strArr1); +// +// String[] strArr2 = {"setTo","extend","add","del","setTo","extend"}; +// user._exec(0, strArr2); +// +// String[] strArr3 = {"extend","add","del","setTo","extend"}; +// user._exec(0, strArr3); + + } + + @Test + public void detailedHelp() { + boolean hasNoError = true; + try { + user.detailedHelp(1, new StringBuilder("test")); + } catch (Exception e) { + hasNoError = false; + } + assertEquals(hasNoError, true); + } } 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 033aff3f..cca28fd4 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 @@ -59,56 +59,56 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Cred { - User user; - Cred cred; - PropAccess prop; - AuthzEnv aEnv; - Writer wtr; - Locator<URI> loc; - HMangr hman; - AAFcli aafcli; + 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, CadiException { - 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 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://www.oracle.com/technetwork/java/index.html"); - 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); + @Before + public void setUp() throws FileNotFoundException, APIException, LocatorException, CadiException { + 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 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://www.oracle.com/technetwork/java/index.html"); + 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 testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - cred.detailedHelp(0, sb); - } + } + + @Test + 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 eec11880..03a7cc3e 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 @@ -56,55 +56,55 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Delg { - - private static User testUser; - private static Delg delg; - User user; - PropAccess prop; - AuthzEnv aEnv; - Writer wtr; - Locator<URI> loc; - HMangr hman; - AAFcli aafcli; + + private static User testUser; + private static Delg delg; + User user; + PropAccess prop; + AuthzEnv aEnv; + Writer wtr; + Locator<URI> loc; + HMangr hman; + AAFcli aafcli; - @Before - public void setUp() throws FileNotFoundException, APIException, LocatorException, CadiException { - prop = new PropAccess(); - aEnv = new AuthzEnv(); - wtr = mock(Writer.class); - loc = mock(Locator.class); - SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); - hman = mock(HMangr.class); //new HMangr(aEnv, loc); - aafcli = mock(AAFcli.class);//new AAFcli(prop, aEnv, wtr, hman, null, secSet); -// user = mock(User.class); //new User(aafcli); -// delg = new Delg(user); - } - - @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://www.oracle.com/technetwork/java/index.html"); - 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); + @Before + public void setUp() throws FileNotFoundException, APIException, LocatorException, CadiException { + prop = new PropAccess(); + aEnv = new AuthzEnv(); + wtr = mock(Writer.class); + loc = mock(Locator.class); + SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class); + hman = mock(HMangr.class); //new HMangr(aEnv, loc); + aafcli = mock(AAFcli.class);//new AAFcli(prop, aEnv, wtr, hman, null, secSet); +// user = mock(User.class); //new User(aafcli); +// delg = new Delg(user); + } + + @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://www.oracle.com/technetwork/java/index.html"); + 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 testDetailedHelp() { - StringBuilder sb = new StringBuilder(); -// delg.detailedHelp(0, sb); - } - + } + + @Test + 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 11517248..fc1c9aac 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 @@ -40,37 +40,37 @@ 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); - - } -// -// @Test -// public void exec() { -// try { -// assertEquals(lsActivity._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 - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsActivity.detailedHelp(0, sb); - } + + 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() { +// try { +// assertEquals(lsActivity._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 + 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 4a9e3aba..457f277c 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 @@ -58,49 +58,49 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListApprovals { - - 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); - } - - + + 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://www.oracle.com/technetwork/java/index.html"); - 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 - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsApprovals.detailedHelp(0, sb); - } + @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://www.oracle.com/technetwork/java/index.html"); + 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 + 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 a1a21ed4..4ddbd337 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 @@ -40,37 +40,37 @@ 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); - - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsDelegates._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 - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsDelegates.detailedHelp(0, sb); - } + + 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 { +// assertEquals(lsDelegates._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 + 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 89364b2b..08d5f5c4 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 @@ -56,49 +56,49 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_ListForCreds { - - 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://www.oracle.com/technetwork/java/index.html"); - 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); + + 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://www.oracle.com/technetwork/java/index.html"); + 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); - } + } + + @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 bebd7eca..0cc20550 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,37 +40,37 @@ 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); - - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsForPermission._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 - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsForPermission.detailedHelp(0, sb); - } + + 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 { +// assertEquals(lsForPermission._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 + 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 457c1987..62b05150 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 @@ -40,37 +40,37 @@ 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); - - } - -// @Test -// public void exec() { -// try { -// assertEquals(lsForRoles._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 - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - lsForRoles.detailedHelp(0, sb); - } + + 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 { +// assertEquals(lsForRoles._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 + 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 2799f93d..ce490819 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 @@ -55,57 +55,57 @@ import org.onap.aaf.misc.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_Role { - - 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://www.oracle.com/technetwork/java/index.html"); - 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)); + + 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://www.oracle.com/technetwork/java/index.html"); + 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 - public void testDetailedHelp() { - StringBuilder sb = new StringBuilder(); - role.detailedHelp(0, sb); - } + } + + @Test + public void testDetailedHelp() { + StringBuilder sb = new StringBuilder(); + role.detailedHelp(0, sb); + } } |