Increased coverage auth cmd perm 75/43775/6
authorgabe.maurer <gabe.maurer@att.com>
Mon, 23 Apr 2018 18:16:39 +0000 (13:16 -0500)
committergabe.maurer <gabe.maurer@att.com>
Mon, 23 Apr 2018 18:48:03 +0000 (13:48 -0500)
Issue-ID: AAF-237
Change-Id: I0c0ea4de29ae198718ad6e40b9a0485ed7644f1f
Signed-off-by: gabe.maurer <gabe.maurer@att.com>
Increased auth cmd code coverage

Issue-ID: AAF-237
Change-Id: I0c76e1aff0d562421f34cbd1a337ff2eee3d592f
Signed-off-by: gabe.maurer <gabe.maurer@att.com>
Fixed offnetwork issue

Issue-ID: AAF-237
Change-Id: I8a4ddc7535f2b9b077c7b721316d6ee15b29dca6
Signed-off-by: gabe.maurer <gabe.maurer@att.com>
32 files changed:
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java [new file with mode: 0644]
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java [new file with mode: 0644]
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByNS.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java
auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java
auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java

index bbc84ec..13394a3 100644 (file)
@@ -180,6 +180,12 @@ public class JU_Cmd {
                //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
new file mode 100644 (file)
index 0000000..02a9e26
--- /dev/null
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * ===========================================================================
+ * * Licensed under the Apache License, Version 2.0 (the "License");
+ * * you may not use this file except in compliance with the License.
+ * * You may obtain a copy of the License at
+ * * 
+ *  *      http://www.apache.org/licenses/LICENSE-2.0
+ * * 
+ *  * Unless required by applicable law or agreed to in writing, software
+ * * distributed under the License is distributed on an "AS IS" BASIS,
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * * See the License for the specific language governing permissions and
+ * * limitations under the License.
+ * * ============LICENSE_END====================================================
+ * *
+ * *
+ ******************************************************************************/
+
+package org.onap.aaf.auth.cmd.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.Cmd;
+import org.onap.aaf.auth.cmd.DeprecatedCMD;
+import org.onap.aaf.auth.cmd.Param;
+import org.onap.aaf.auth.cmd.test.JU_Cmd;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.misc.env.APIException;
+
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+
+import org.junit.Test;
+
+public class JU_DeprecatedCMD {
+
+       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
+               }
+
+               @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/mgmt/JU_Deny.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java
new file mode 100644 (file)
index 0000000..c8c00c7
--- /dev/null
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * ============LICENSE_START====================================================
+ * * org.onap.aaf
+ * * ===========================================================================
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * * ===========================================================================
+ * * Licensed under the Apache License, Version 2.0 (the "License");
+ * * you may not use this file except in compliance with the License.
+ * * You may obtain a copy of the License at
+ * * 
+ *  *      http://www.apache.org/licenses/LICENSE-2.0
+ * * 
+ *  * Unless required by applicable law or agreed to in writing, software
+ * * distributed under the License is distributed on an "AS IS" BASIS,
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * * See the License for the specific language governing permissions and
+ * * limitations under the License.
+ * * ============LICENSE_END====================================================
+ * *
+ * *
+ ******************************************************************************/
+
+package org.onap.aaf.auth.cmd.test.mgmt;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.mgmt.Deny;
+import org.onap.aaf.auth.cmd.mgmt.Deny.DenySomething;
+import org.onap.aaf.auth.cmd.mgmt.Mgmt;
+import org.onap.aaf.auth.cmd.ns.Create;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.env.AuthzTransOnlyFilter;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
+import org.onap.aaf.misc.env.APIException;
+
+import static org.mockito.Mockito.*;
+
+import java.io.Writer;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.HttpURLConnection;
+import java.net.URI;
+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;
+
+       @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://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+
+//             String[] strArr = {"add","del", "add","del"};
+//             deny._exec(0, strArr);
+//             
+//             String[] strArr1 = {"del", "add","del"};
+//             deny._exec(0, strArr1);
+               
+       }
+
+}
index 01ff6c4..2441fba 100644 (file)
 package org.onap.aaf.auth.cmd.test.mgmt;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+
 import static org.junit.Assert.assertEquals;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.auth.cmd.AAFcli;
 import org.onap.aaf.auth.cmd.mgmt.Log;
+import org.onap.aaf.auth.cmd.mgmt.Mgmt;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_Log {
        
        private static Log log;
+       private static Log log1;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp() {
+       @Before
+       public void setUp() throws APIException, LocatorException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               Mgmt mgmt = new Mgmt(aafcli);
                log = mock(Log.class);
+               log1 = new Log(mgmt);
        }
        
        @Test
-       public void exec() {
-               try {
-                       assertEquals(log._exec(0, "session clear"), 0);
-               } catch (CadiException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (APIException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (LocatorException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
+       public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+//             Item value = mock(Item.class);
+//             Locator.Item item = new Locator.Item() {
+//             };
+//             when(loc.best()).thenReturn(value);
+//             URI uri = new URI("http://java.sun.com/j2se/1.3/");
+//             when(loc.get(value)).thenReturn(uri);
+//             SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+//             HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               log._exec(0, strArr);
+               
+//             String[] strArr1 = {"del","add","upd","del"};
+//             log1._exec(0, strArr1);
+//             
+//             String[] strArr2 = {"add","upd","del","add","upd","del"};
+//             log1._exec(0, strArr2);
        }
 }
index 29a6483..6105756 100644 (file)
 package org.onap.aaf.auth.cmd.test.mgmt;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.mockito.Mockito.mock;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+
 import static org.junit.Assert.assertEquals;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.mgmt.Mgmt;
 import org.onap.aaf.auth.cmd.mgmt.SessClear;
+import org.onap.aaf.auth.cmd.mgmt.Session;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.http.HMangr;
 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;
        
-       @BeforeClass
-       public static void setUp() {
-               sessclr = mock(SessClear.class);
+       @Before
+       public  void setUp() throws LocatorException, APIException {
+               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 exec() {
+//             try {
+//                     assertEquals(sessclr._exec(0, "session clear"), 0);
+//             } catch (CadiException e) {
+//                     // TODO Auto-generated catch block
+//                     e.printStackTrace();
+//             } catch (APIException e) {
+//                     // TODO Auto-generated catch block
+//                     e.printStackTrace();
+//             } catch (LocatorException e) {
+//                     // TODO Auto-generated catch block
+//                     e.printStackTrace();
+//             }
+//     }
+       
        @Test
-       public void exec() {
-               try {
-                       assertEquals(sessclr._exec(0, "session clear"), 0);
-               } catch (CadiException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (APIException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (LocatorException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               //sessclr.detailedHelp(0, sb);
        }
 }
index a3f3f42..6e344d5 100644 (file)
@@ -80,20 +80,20 @@ public class JU_Admin {
                
        }
        
-//     @Test
-//     public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
-//             Item value = mock(Item.class);
-//             Locator.Item item = new Locator.Item() {
-//             };
-//             when(loc.best()).thenReturn(value);
-//             URI uri = new URI("http://java.sun.com/j2se/1.3/");
-//             when(loc.get(value)).thenReturn(uri);
-//             SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
-//             HRcli hcli = new HRcli(hman, uri, item, secSet);
-//             String[] strArr = {"add", "del","add","add"};
-//             admin._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://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add", "del","add","add"};
+               admin._exec(0, strArr);
+               
+       }
 
        @Test
        public void detailedHelp() {
index 3dd338f..ac53c4b 100644 (file)
@@ -82,20 +82,20 @@ public class JU_Attrib {
                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://java.sun.com/j2se/1.3/");
-//             when(loc.get(value)).thenReturn(uri);
-//             SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
-//             HRcli hcli = new HRcli(hman, uri, item, secSet);
-//             String[] strArr = {"add","upd","del","add","upd","del"};
-//             attrib._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://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               attrib._exec(0, strArr);
+               
+       }
 
        @Test
        public void detailedHelp() {
index 592f627..805ca3a 100644 (file)
 package org.onap.aaf.auth.cmd.test.ns;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -33,29 +42,57 @@ import org.onap.aaf.auth.cmd.AAFcli;
 import org.onap.aaf.auth.cmd.ns.Create;
 import org.onap.aaf.auth.cmd.ns.NS;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
+import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_Create {
 
        private static Create create;//might need to replace import with org.onap.aaf.auth.cmd.perm
-
-       @BeforeClass
-       public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               NS ns = new NS(cli);
+       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 exec() {
-//             try {
-//                     assertEquals(create._exec(0, "add", "del", "reset", "extend"), 500);
-//             } catch (Exception e) {
-//                     assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
-//             }
-//     }
+       @Test
+       public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               create._exec(0, strArr);
+               
+       }
 
        @Test
        public void detailedHelp() {
index c408681..04fd64f 100644 (file)
 package org.onap.aaf.auth.cmd.test.ns;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.io.IOException;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.security.GeneralSecurityException;
 
 import org.junit.BeforeClass;
@@ -34,29 +42,55 @@ import org.onap.aaf.auth.cmd.AAFcli;
 import org.onap.aaf.auth.cmd.ns.Delete;
 import org.onap.aaf.auth.cmd.ns.NS;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 public class JU_Delete {
 
        private static Delete delete;//import may be org.onap.aaf.auth.cmd.perm
-
-       @BeforeClass
-       public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               NS ns = new NS(cli);
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
+       
+       @Before
+       public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
+               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 exec() {
-//             try {
-//                     delete._exec(0, "del", "del", "del");
-//             } catch (Exception e) {
-//                     assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
-//             }
-//     }
+       @Test
+       public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               delete._exec(0, strArr);
+               
+       }
 
        @Test
        public void detailedHelp() {
@@ -68,10 +102,5 @@ public class JU_Delete {
                }
                assertEquals(hasNoError, true);
        }
-       
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
-       }
 
 }
index 7bec934..d51773e 100644 (file)
 package org.onap.aaf.auth.cmd.test.ns;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.CALLS_REAL_METHODS;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
+import java.io.Writer;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -38,37 +45,55 @@ import org.onap.aaf.auth.cmd.AAFcli;
 import org.onap.aaf.auth.cmd.ns.Describe;
 import org.onap.aaf.auth.cmd.ns.NS;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_Describe {
        
        private static Describe desc;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               NS ns = new NS(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               NS ns = new NS(aafcli);
                desc = new Describe(ns);
        }
-//     
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(desc._exec(0, "add","del","reset","extend"),500);
-//             } catch (CadiException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             } catch (APIException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             } catch (LocatorException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             }
-//     }
+       
+       @Test
+       public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               desc._exec(0, strArr);
+               
+       }
        
        @Test
        public void testDetailedHelp() {
index c36088f..298c116 100644 (file)
 package org.onap.aaf.auth.cmd.test.ns;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -35,38 +44,56 @@ import org.onap.aaf.auth.cmd.ns.List;
 import org.onap.aaf.auth.cmd.ns.ListActivity;
 import org.onap.aaf.auth.cmd.ns.NS;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListActivity {
        
        private static ListActivity lsActivity;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               NS ns = new NS(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               NS ns = new NS(aafcli);
                List ls = new List(ns);
                lsActivity = new ListActivity(ls);
        }
        
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(lsActivity._exec(0, "add","del","reset","extend"),500);
-//             } catch (CadiException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             } catch (APIException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             } catch (LocatorException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             }
-//     }
+       @Test
+       public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               //lsActivity._exec(0, strArr);
+               
+       }
        
        @Test
        public void testDetailedHelp() {
index 40136f2..ca7879e 100644 (file)
 package org.onap.aaf.auth.cmd.test.ns;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,39 +43,56 @@ import org.onap.aaf.auth.cmd.ns.List;
 import org.onap.aaf.auth.cmd.ns.ListAdminResponsible;
 import org.onap.aaf.auth.cmd.ns.NS;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListAdminResponsible {
        
        private static ListAdminResponsible lsAdminRes;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               NS ns = new NS(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               NS ns = new NS(aafcli);
                List ls = new List(ns);
                lsAdminRes = new ListAdminResponsible(ls);
        }
        
-//     @Test
-//     public void exec() {
-//             try {
-//                     //TODO: Gabe [JUnit] Not visible for junit
-//                     assertEquals(lsAdminRes._exec(0, "add","del","reset","extend"),500);
-//             } catch (CadiException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             } catch (APIException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             } catch (LocatorException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             }
-//     }
+       @Test
+       public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               //lsAdminRes._exec(0, strArr);
+               
+       }
        
        @Test
        public void testDetailedHelp() {
index cba3710..064e4a5 100644 (file)
 package org.onap.aaf.auth.cmd.test.ns;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,38 +43,56 @@ import org.onap.aaf.auth.cmd.ns.List;
 import org.onap.aaf.auth.cmd.ns.ListByName;
 import org.onap.aaf.auth.cmd.ns.NS;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListByName {
        
        private static ListByName lsByName;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               NS ns = new NS(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               NS ns = new NS(aafcli);
                List ls = new List(ns);
                lsByName = new ListByName(ls);
        }
        
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(lsByName._exec(0, "add","del","reset","extend"),500);
-//             } catch (CadiException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             } catch (APIException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             } catch (LocatorException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             }
-//     }
+       @Test
+       public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               //lsByName._exec(0, strArr);
+               
+       }
        
        @Test
        public void testDetailedHelp() {
index 20a5f2c..14dcbe6 100644 (file)
@@ -80,20 +80,20 @@ public class JU_ListUsersContact {
                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://java.sun.com/j2se/1.3/");
-//             when(loc.get(value)).thenReturn(uri);
-//             SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
-//             HRcli hcli = new HRcli(hman, uri, item, secSet);
-//             lUContact._exec(0, "test");
-//             
-//     }
+       @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://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               //lUContact._exec(0, "test");
+               
+       }
        
        @Test
        public void testDetailedHelp() {
index 058d946..cd49d89 100644 (file)
 package org.onap.aaf.auth.cmd.test.perm;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,41 +43,62 @@ import org.onap.aaf.auth.cmd.perm.Create;
 import org.onap.aaf.auth.cmd.perm.Perm;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_Create {
+               
+       private static Create create;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-//     private static Create create;
-//     
-//     @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);
-//             create = new Create(perm);
-//     }
-//     
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(create._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();
-//             }
-//     }
+       @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);
+               create = new Create(perm);
+               
+       }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"grant","ungrant","setTo","grant","ungrant","setTo"};
+               create._exec(0, strArr);
+
        }
+       
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               create.detailedHelp(0, sb);
+       }
+       
 }
index eb9fd28..1cfa6c7 100644 (file)
 package org.onap.aaf.auth.cmd.test.perm;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,41 +43,60 @@ import org.onap.aaf.auth.cmd.perm.Delete;
 import org.onap.aaf.auth.cmd.perm.Perm;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_Delete {
        
-//     private static Delete del;
-//     
-//     @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);
-//             del = new Delete(perm);
-//     }
-//     
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(del._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();
-//             }
-//     }
+       private static Delete del;
+       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);
+               del = new Delete(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://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"grant","ungrant","setTo","grant","ungrant","setTo"};
+               del._exec(0, strArr);
+
+       }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               del.detailedHelp(0, sb);
        }
 }
index 49dd014..2f6346a 100644 (file)
 package org.onap.aaf.auth.cmd.test.perm;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,41 +43,60 @@ import org.onap.aaf.auth.cmd.perm.Describe;
 import org.onap.aaf.auth.cmd.perm.Perm;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_Describe {
 //     
-//     private static Describe desc;
-//     
-//     @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);
-//             desc = new Describe(perm);
-//     }
-//     
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(desc._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();
-//             }
-//     }
+       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);
+               Perm perm = new Perm(role);
+               desc = new Describe(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://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"grant","ungrant","setTo","grant","ungrant","setTo"};
+               desc._exec(0, strArr);
+
+       }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               desc.detailedHelp(0, sb);
        }
 }
index 4c0ab53..c40f20c 100644 (file)
 package org.onap.aaf.auth.cmd.test.perm;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,41 +43,66 @@ import org.onap.aaf.auth.cmd.perm.Grant;
 import org.onap.aaf.auth.cmd.perm.Perm;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_Grant {
        
-//     private static Grant grant;
-//     
-//     @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);
-//             grant = new Grant(perm);
-//     }
-//     
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(grant._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();
-//             }
-//     }
+       private static Grant grant;
+       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);
+               grant = new Grant(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://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"grant","ungrant","setTo","grant","ungrant","setTo"};
+               grant._exec(0, strArr);
+               
+               String[] strArr1 = {"ungrant","setTo","grant","ungrant","setTo", "grant"};
+               grant._exec(0, strArr1);
+               
+               String[] strArr2 = {"setTo","grant","ungrant","setTo", "grant", "ungrant"};
+               grant._exec(0, strArr2);
+               
+       }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               grant.detailedHelp(0, sb);
        }
 }
index ee413c0..03945aa 100644 (file)
@@ -42,17 +42,17 @@ 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();
-//             Role role = new Role(cli);
-//             Perm perm = new Perm(role);
-//             List ls = new List(perm);
-//             lsActivity = new ListActivity(ls);
-//     }
-//     
+       private static ListActivity lsActivity;
+       
+       @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);
+               lsActivity = new ListActivity(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -69,8 +69,9 @@ public class JU_ListActivity {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               lsActivity.detailedHelp(0, sb);
        }
 }
index e4976b5..e8f34f3 100644 (file)
@@ -42,17 +42,17 @@ 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);
-//     }
-//     
+       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 {
@@ -69,8 +69,9 @@ public class JU_ListByNS {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               lsByNS.detailedHelp(0, sb);
        }
 }
index 3a4e346..ad9f76a 100644 (file)
@@ -42,17 +42,17 @@ import org.onap.aaf.misc.env.APIException;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListByName {
        
-//     private static ListByName 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 ListByName(ls);
-//     }
-//     
+       private static ListByName 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 ListByName(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -69,8 +69,9 @@ public class JU_ListByName {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               lsByName.detailedHelp(0, sb);
        }
 }
index 98e421d..c9302aa 100644 (file)
@@ -42,17 +42,17 @@ 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);
-//     }
-//     
+       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 {
@@ -69,8 +69,9 @@ public class JU_ListByRole {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               lsByRole.detailedHelp(0, sb);
        }
 }
index 751b240..d220d39 100644 (file)
@@ -42,17 +42,17 @@ 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);
-//     }
-//     
+       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 {
@@ -69,8 +69,9 @@ public class JU_ListByUser {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               lsByName.detailedHelp(0, sb);
        }
 }
index 7581005..13f1314 100644 (file)
 package org.onap.aaf.auth.cmd.test.perm;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,41 +43,60 @@ import org.onap.aaf.auth.cmd.perm.Perm;
 import org.onap.aaf.auth.cmd.perm.Rename;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_Rename {
        
-//     private static Rename rename;
-//     
-//     @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);
-//             rename = new Rename(perm);
-//     }
-//     
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(rename._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();
-//             }
-//     }
+       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://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"grant","ungrant","setTo","grant","ungrant","setTo"};
+               rename._exec(0, strArr);
+               
+       }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               rename.detailedHelp(0, sb);
        }
 }
index 8b9a8f2..df2d8f4 100644 (file)
 package org.onap.aaf.auth.cmd.test.role;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -33,37 +42,58 @@ import org.onap.aaf.auth.cmd.AAFcli;
 import org.onap.aaf.auth.cmd.role.CreateDelete;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_CreateDelete {
        
        private static CreateDelete createDel;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               Role role = new Role(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               Role role = new Role(aafcli);
                createDel = new CreateDelete(role);
        }
        
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(createDel._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 testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"create","delete","create","delete"};
+               createDel._exec(0, strArr);
+               
+               String[] strArr1 = {"delete","create","delete"};
+               createDel._exec(0, strArr1);
+               
+       }
        
        @Test
        public void testDetailedHelp() {
index e7ac12a..0eb42c6 100644 (file)
 package org.onap.aaf.auth.cmd.test.role;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -33,37 +42,55 @@ import org.onap.aaf.auth.cmd.AAFcli;
 import org.onap.aaf.auth.cmd.role.Describe;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_Describe {
        
        private static Describe desc;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               Role role = new Role(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               Role role = new Role(aafcli);
                desc = new Describe(role);
        }
        
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(desc._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 testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               desc._exec(0, strArr);
+               
+       }
        
        @Test
        public void detailedHelp() {
index e09035c..f61b71f 100644 (file)
 package org.onap.aaf.auth.cmd.test.role;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,38 +43,56 @@ import org.onap.aaf.auth.cmd.role.List;
 import org.onap.aaf.auth.cmd.role.ListActivity;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListActivity {
        
        private static ListActivity lsActivity;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               Role role = new Role(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               Role role = new Role(aafcli);
                List ls = new List(role);
                lsActivity = new ListActivity(ls);
        }
        
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(lsActivity._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 testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               //lsActivity._exec(0, strArr);
+               
+       }
        
        @Test
        public void detailedHelp() {
index 6c2f1b4..ae2bd8c 100644 (file)
 package org.onap.aaf.auth.cmd.test.role;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,38 +43,56 @@ import org.onap.aaf.auth.cmd.role.List;
 import org.onap.aaf.auth.cmd.role.ListByNameOnly;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListByNameOnly {
        
        private static ListByNameOnly lsByName;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               Role role = new Role(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               Role role = new Role(aafcli);
                List ls = new List(role);
                lsByName = new ListByNameOnly(ls);
        }
        
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(lsByName._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 testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               //lsByName._exec(0, strArr);
+               
+       }
        
        @Test
        public void detailedHelp() {
index d03511b..f50b27d 100644 (file)
 package org.onap.aaf.auth.cmd.test.role;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,38 +43,56 @@ import org.onap.aaf.auth.cmd.role.List;
 import org.onap.aaf.auth.cmd.role.ListByUser;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListByUser {
        
        private static ListByUser lsByUser;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               Role role = new Role(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               Role role = new Role(aafcli);
                List ls = new List(role);
                lsByUser = new ListByUser(ls);
        }
        
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(lsByUser._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 testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","upd","del","add","upd","del"};
+               //lsByUser._exec(0, strArr);
+               
+       }
        
        @Test
        public void detailedHelp() {
index fa83596..3c57680 100644 (file)
 package org.onap.aaf.auth.cmd.test.role;
 
 import org.junit.Assert;
+import org.junit.Before;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -34,37 +43,64 @@ import org.onap.aaf.auth.cmd.perm.Perm;
 import org.onap.aaf.auth.cmd.role.Role;
 import org.onap.aaf.auth.cmd.role.User;
 import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
 import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
 import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_User {
        
        private static User user;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
        
-       @BeforeClass
-       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-               AAFcli cli = JU_AAFCli.getAAfCli();
-               Role role = new Role(cli);
+       @Before
+       public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               Role role = new Role(aafcli);
                user = new User(role);
        }
        
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(user._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 testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+               Item value = mock(Item.class);
+               Locator.Item item = new Locator.Item() {
+               };
+               when(loc.best()).thenReturn(value);
+               URI uri = new URI("http://java.sun.com/j2se/1.3/");
+               when(loc.get(value)).thenReturn(uri);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               HRcli hcli = new HRcli(hman, uri, item, secSet);
+               String[] strArr = {"add","del","setTo","extend","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() {
index 6d4daa9..dc76886 100644 (file)
@@ -60,6 +60,7 @@ public class JU_AbsData {
                public AbsDataStub(File dataf, char sepChar, int maxLineSize, int fieldOffset) {
                        super(dataf, sepChar, maxLineSize, fieldOffset);
                        // TODO Auto-generated constructor stub
+                       
                }
                
        }
index 76d662d..1252a69 100644 (file)
@@ -69,6 +69,7 @@ public class JU_TextIndex {
                public AbsDataStub(File dataf, char sepChar, int maxLineSize, int fieldOffset) {
                        super(dataf, sepChar, maxLineSize, fieldOffset);
                        // TODO Auto-generated constructor stub
+                       
                }
                
        }