Merge "Cleanup JUnits"
authorJonathan Gathman <jonathan.gathman@att.com>
Thu, 19 Apr 2018 17:18:04 +0000 (17:18 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 19 Apr 2018 17:18:04 +0000 (17:18 +0000)
36 files changed:
auth/auth-cass/docker/backup/backup.sh
auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
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/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_List.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_ListChildren.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java [new file with mode: 0644]
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java [new file with mode: 0644]
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java [new file with mode: 0644]
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_List.java [new file with mode: 0644]
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_ListByNS.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_ListByPerm.java
auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.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/main/java/org/onap/aaf/auth/org/Organization.java
auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java
auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
cadi/shiro/pom.xml

index db59d16..1359d3d 100644 (file)
@@ -1,28 +1,32 @@
 # BEGIN Store prev
-if [ -e "6day" ]; then
-   rm -Rf 6day
+BD=/opt/app/osaaf/backup
+if [ -e "$BD/6day" ]; then
+   rm -Rf $BD/6day
 fi
 
-PREV=6day
-for D in 5day 4day 3day 2day yesterday; do
+PREV=$BD/6day
+for D in $BD/5day $BD/4day $BD/3day $BD/2day $BD/yesterday; do
    if [ -e "$D" ]; then
       mv "$D" "$PREV"
    fi
    PREV="$D"
 done
 
-if [ -e "today" ]; then
-    mv today yesterday
-    gzip yesterday/*
+if [ -e "$BD/today" ]; then
+    if [ -e "$BD/backup.log" ]; then
+       mv $BD/backup.log $BD/today
+    fi
+    gzip $BD/today/*
+    mv $BD/today $BD/yesterday
 fi
 
+mkdir $BD/today
+
 # END Store prev
 date
 docker exec -t aaf_cass bash -c "mkdir -p /opt/app/cass_backup"
-docker container cp cbackup.sh aaf_cass:/opt/app/cass_backup/backup.sh
+docker container cp $BD/cbackup.sh aaf_cass:/opt/app/cass_backup/backup.sh
 # echo "login as Root, then run \nbash /opt/app/cass_backup/backup.sh"
 docker exec -t aaf_cass bash /opt/app/cass_backup/backup.sh
-mkdir today
-docker container cp aaf_cass:/opt/app/cass_backup/. today
-
+docker container cp aaf_cass:/opt/app/cass_backup/. $BD/today
 date
index 1f67907..b7b17c9 100644 (file)
@@ -40,23 +40,23 @@ import org.onap.aaf.auth.dao.cass.DelegateDAO;
 import org.onap.aaf.auth.dao.cass.FutureDAO;
 import org.onap.aaf.auth.dao.cass.Namespace;
 import org.onap.aaf.auth.dao.cass.NsDAO;
+import org.onap.aaf.auth.dao.cass.NsDAO.Data;
 import org.onap.aaf.auth.dao.cass.NsSplit;
 import org.onap.aaf.auth.dao.cass.NsType;
 import org.onap.aaf.auth.dao.cass.PermDAO;
 import org.onap.aaf.auth.dao.cass.RoleDAO;
 import org.onap.aaf.auth.dao.cass.Status;
 import org.onap.aaf.auth.dao.cass.UserRoleDAO;
-import org.onap.aaf.auth.dao.cass.NsDAO.Data;
 import org.onap.aaf.auth.dao.hl.Question.Access;
 import org.onap.aaf.auth.env.AuthzTrans;
 import org.onap.aaf.auth.env.AuthzTrans.REQD_TYPE;
 import org.onap.aaf.auth.layer.Result;
 import org.onap.aaf.auth.org.Executor;
 import org.onap.aaf.auth.org.Organization;
-import org.onap.aaf.auth.org.OrganizationException;
 import org.onap.aaf.auth.org.Organization.Expiration;
 import org.onap.aaf.auth.org.Organization.Identity;
 import org.onap.aaf.auth.org.Organization.Policy;
+import org.onap.aaf.auth.org.OrganizationException;
 
 public class Function {
 
@@ -735,7 +735,7 @@ public class Function {
 
        private Result<Void> checkValidID(AuthzTrans trans, Date now, String user) {
                Organization org = trans.org();
-               if (user.endsWith(org.getRealm())) {
+               if (org.supportsRealm(user)) {
                        try {
                                if (org.getIdentity(trans, user) == null) {
                                        return Result.err(Status.ERR_Denied,
index e87df80..bbc84ec 100644 (file)
@@ -28,6 +28,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.Mockito;
+import static org.mockito.Mockito.*;
 import org.onap.aaf.auth.cmd.AAFcli;
 import org.onap.aaf.auth.cmd.Cmd;
 import org.onap.aaf.auth.cmd.Param;
@@ -49,8 +50,6 @@ import org.onap.aaf.misc.env.impl.BasicEnv;
 import aaf.v2_0.History;
 import aaf.v2_0.History.Item;
 
-import static org.mockito.Mockito.*;
-
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
index 4da21e8..a3f3f42 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;
@@ -31,42 +40,70 @@ import org.junit.runner.RunWith;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.onap.aaf.auth.cmd.AAFcli;
 import org.onap.aaf.auth.cmd.ns.Admin;
+import org.onap.aaf.auth.cmd.ns.ListUsersContact;
 import org.onap.aaf.auth.cmd.ns.NS;
+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_Admin {
 
-//     private static Admin admin;
-//
-//     @BeforeClass
-//     public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = org.onap.aaf.auth.cmd.test.JU_AAFCli.getAAfCli();
-//             NS ns = new NS(cli);
-//             admin = new Admin(ns);
-//     }
-//
-//     @Test
-//     public void exec() {
-//             try {
-//                     assertEquals(admin._exec(0, "add", "del", "reset", "extend"), 500);
-//             } catch (Exception e) {
-//                     assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
-//             }
-//     }
-//
+       private static Admin admin;
+       
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
+       
+
+       @Before
+       public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               NS ns = new NS(aafcli);
+               admin = new Admin(ns);
+               
+       }
+       
 //     @Test
-//     public void detailedHelp() {
-//             boolean hasNoError = true;
-//             try {
-//                     admin.detailedHelp(1, new StringBuilder("test"));
-//             } catch (Exception e) {
-//                     hasNoError = false;
-//             }
-//             assertEquals(hasNoError, true);
+//     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                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       admin.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
+
 }
index 4ef49cb..3dd338f 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 java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import static org.mockito.Mockito.*;
+import org.mockito.Mockito;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -33,41 +47,65 @@ import org.onap.aaf.auth.cmd.AAFcli;
 import org.onap.aaf.auth.cmd.ns.Attrib;
 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_Attrib {
 
-//     private static Attrib attrib;
-//
-//     @BeforeClass
-//     public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             NS ns = new NS(cli);
-//             attrib = new Attrib(ns);
-//     }
-//
-//     @Test
-//     public void exec() {
-//             try {
-//                     attrib._exec(0, "add", "del", "reset", "extend");
-//             } catch (Exception e) {
-//                     assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
-//             }
-//     }
-//
+       private static Attrib attrib;
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
+
+       @Before
+       public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               NS ns = new NS(aafcli);
+               attrib = new Attrib(ns);
+       }
+
 //     @Test
-//     public void detailedHelp() {
-//             boolean hasNoError = true;
-//             try {
-//                     attrib.detailedHelp(1, new StringBuilder("test"));
-//             } catch (Exception e) {
-//                     hasNoError = false;
-//             }
-//             assertEquals(hasNoError, true);
+//     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                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       attrib.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
+
 }
index 86e0553..592f627 100644 (file)
@@ -39,28 +39,25 @@ 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);
-//             create = new Create(ns);
-//     }
-       
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @BeforeClass
+       public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               NS ns = new NS(cli);
+               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 exec() {
+//             try {
+//                     assertEquals(create._exec(0, "add", "del", "reset", "extend"), 500);
+//             } catch (Exception e) {
+//                     assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
+//             }
+//     }
 
-       //@Test
+       @Test
        public void detailedHelp() {
                boolean hasNoError = true;
                try {
index 0623b09..c408681 100644 (file)
@@ -39,16 +39,16 @@ 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);
-//             delete = new Delete(ns);
-//
-//     }
-//
+       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);
+               delete = new Delete(ns);
+
+       }
+
 //     @Test
 //     public void exec() {
 //             try {
@@ -57,17 +57,17 @@ public class JU_Delete {
 //                     assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
 //             }
 //     }
-//
-//     @Test
-//     public void detailedHelp() {
-//             boolean hasNoError = true;
-//             try {
-//                     delete.detailedHelp(1, new StringBuilder("test"));
-//             } catch (Exception e) {
-//                     hasNoError = false;
-//             }
-//             assertEquals(hasNoError, true);
-//     }
+
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       delete.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
+       }
        
        @Test                                           //TODO: Temporary fix AAF-111
        public void netYetTested() {
index 7c65939..7bec934 100644 (file)
@@ -45,14 +45,14 @@ 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();
-//             NS ns = new NS(cli);
-//             desc = new Describe(ns);
-//     }
+       private static Describe desc;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               NS ns = new NS(cli);
+               desc = new Describe(ns);
+       }
 //     
 //     @Test
 //     public void exec() {
@@ -70,9 +70,10 @@ public class JU_Describe {
 //             }
 //     }
        
-       @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 99ad284..f62a818 100644 (file)
  * 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.ns;
 
 import static org.junit.Assert.*;
@@ -78,5 +78,5 @@ public class JU_List {
                list.report(null, "test");
                list.report(fu, "test");
        }
-
+       
 }
index 9ff82d1..c36088f 100644 (file)
@@ -42,16 +42,16 @@ import org.onap.aaf.misc.env.APIException;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListActivity {
        
-//     private static ListActivity lsActivity;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             NS ns = new NS(cli);
-//             List ls = new List(ns);
-//             lsActivity = new ListActivity(ls);
-//     }
-//     
+       private static ListActivity lsActivity;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               NS ns = new NS(cli);
+               List ls = new List(ns);
+               lsActivity = new ListActivity(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -68,9 +68,11 @@ public class JU_ListActivity {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               lsActivity.detailedHelp(0, sb );
        }
+
 }
 
index aacf842..40136f2 100644 (file)
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListAdminResponsible {
        
-//     private static ListAdminResponsible lsAdminRes;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             NS ns = new NS(cli);
-//             List ls = new List(ns);
-//             lsAdminRes = new ListAdminResponsible(ls);
-//     }
-//     
+       private static ListAdminResponsible lsAdminRes;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               NS ns = new NS(cli);
+               List ls = new List(ns);
+               lsAdminRes = new ListAdminResponsible(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -68,9 +68,10 @@ public class JU_ListAdminResponsible {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               lsAdminRes.detailedHelp(0, sb );
        }
 }
 
index 1900010..cba3710 100644 (file)
@@ -41,16 +41,16 @@ 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();
-//             NS ns = new NS(cli);
-//             List ls = new List(ns);
-//             lsByName = new ListByName(ls);
-//     }
-//     
+       private static ListByName lsByName;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               NS ns = new NS(cli);
+               List ls = new List(ns);
+               lsByName = new ListByName(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -67,9 +67,10 @@ 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 5695c62..5723f19 100644 (file)
@@ -41,17 +41,17 @@ import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListChildren {
-//     
-//     private static ListChildren lsChildren;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             NS ns = new NS(cli);
-//             List ls = new List(ns);
-//             lsChildren = new ListChildren(ls);
-//     }
-//     
+       
+       private static ListChildren lsChildren;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               NS ns = new NS(cli);
+               List ls = new List(ns);
+               lsChildren = new ListChildren(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -68,9 +68,10 @@ public class JU_ListChildren {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               lsChildren.detailedHelp(0, sb );
        }
 }
 
index ad36151..a1b0da1 100644 (file)
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListNsKeysByAttrib {
        
-//     private static ListNsKeysByAttrib lsNsKeys;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             NS ns = new NS(cli);
-//             List ls = new List(ns);
-//             lsNsKeys = new ListNsKeysByAttrib(ls);
-//     }
-//     
+       private static ListNsKeysByAttrib lsNsKeys;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               NS ns = new NS(cli);
+               List ls = new List(ns);
+               lsNsKeys = new ListNsKeysByAttrib(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -67,9 +67,10 @@ public class JU_ListNsKeysByAttrib {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               StringBuilder sb = new StringBuilder();
+               lsNsKeys.detailedHelp(0, sb );
        }
 }
 
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java
new file mode 100644 (file)
index 0000000..e44a821
--- /dev/null
@@ -0,0 +1,79 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.ns;
+
+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.ns.List;
+import org.onap.aaf.auth.cmd.ns.ListUsers;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.misc.env.APIException;
+
+import aaf.v2_0.Users;
+
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.GregorianCalendar;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.junit.Test;
+
+public class JU_ListUsers {
+
+       AAFcli cli;
+       NS ns;
+       List list;
+       ListUsers lUsers;
+       
+       @Before
+       public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
+               cli = JU_AAFCli.getAAfCli();
+               ns = new NS(cli);
+               list = new List(ns);
+               lUsers = new ListUsers(list);
+       }
+       
+       @Test
+       public void testReports() throws DatatypeConfigurationException {
+               Users.User user = new Users.User();
+               GregorianCalendar gcal = new GregorianCalendar();
+           XMLGregorianCalendar xgcal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal);
+               user.setExpires(xgcal);
+               
+               lUsers.report("header", "ns");
+               lUsers.report("subHead");
+               lUsers.report("prefix", user);
+       }
+
+}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java
new file mode 100644 (file)
index 0000000..20a5f2c
--- /dev/null
@@ -0,0 +1,105 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.ns;
+
+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.ns.List;
+import org.onap.aaf.auth.cmd.ns.ListUsers;
+import org.onap.aaf.auth.cmd.ns.ListUsersContact;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.Locator.Item;
+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.cadi.http.HRcli;
+import org.onap.aaf.misc.env.APIException;
+
+import static org.mockito.Mockito.*;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.junit.Test;
+
+public class JU_ListUsersContact {
+
+       PropAccess prop;
+       AuthzEnv aEnv;
+       Writer wtr;
+       Locator<URI> loc;
+       HMangr hman;    
+       AAFcli aafcli;
+       NS ns;
+       List list;
+       ListUsers lUsers;
+       ListUsersContact lUContact;
+       
+       @Before
+       public void setUp() throws LocatorException, APIException {
+               prop = new PropAccess();
+               aEnv = new AuthzEnv();
+               wtr = mock(Writer.class);
+               loc = mock(Locator.class);
+               SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+               hman = new HMangr(aEnv, loc);   
+               aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+               ns = new NS(aafcli);
+               list = new List(ns);
+               lUsers = new ListUsers(list);
+       }
+       
+//     @Test
+//     public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+//             lUContact = new ListUsersContact(lUsers);
+//             Item value = mock(Item.class);
+//             Locator.Item item = new Locator.Item() {
+//             };
+//             when(loc.best()).thenReturn(value);
+//             URI uri = new URI("http://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() {
+               lUContact = new ListUsersContact(lUsers);
+               StringBuilder sb = new StringBuilder();
+               lUContact.detailedHelp(0, sb);
+       }
+
+}
index ae13606..9f61b00 100644 (file)
@@ -39,17 +39,17 @@ import org.onap.aaf.auth.cmd.test.JU_AAFCli;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListUsersInRole {
 
-//     private static ListUsersInRole lsUserinRole;
-//
-//     @BeforeClass
-//     public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             NS ns = new NS(cli);
-//             List ls = new List(ns);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other options
-//             ListUsers lsU = new ListUsers(ls);
-//             lsUserinRole = new ListUsersInRole(lsU);
-//     }
-//
+       private static ListUsersInRole lsUserinRole;
+
+       @BeforeClass
+       public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               NS ns = new NS(cli);
+               List ls = new List(ns);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other options
+               ListUsers lsU = new ListUsers(ls);
+               lsUserinRole = new ListUsersInRole(lsU);
+       }
+
 //     @Test
 //     public void exec() {
 //             try {
@@ -58,20 +58,16 @@ public class JU_ListUsersInRole {
 //                     assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
 //             }
 //     }
-//
-//     @Test
-//     public void detailedHelp() {
-//             boolean hasNoError = true;
-//             try {
-//                     lsUserinRole.detailedHelp(1, new StringBuilder("test"));
-//             } catch (Exception e) {
-//                     hasNoError = false;
-//             }
-//             assertEquals(hasNoError, true);
-//     }
-       
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       lsUserinRole.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
+
 }
index b8e83e6..62984d6 100644 (file)
@@ -50,15 +50,15 @@ public class JU_ListUsersWithPerm {
                lsUserWithPerm = new ListUsersWithPerm(lsU);
        }
 
-       @Test
-       public void exec() {
-               try {
-                       assertEquals(lsUserWithPerm._exec(0, "add", "del", "reset", "extend"), 500);
-               } catch (Exception e) {
-                       assertEquals(e.getMessage(), "No Services Found for https://DME2RESOLVE [ ]");
-
-               }
-       }
+//     @Test
+//     public void exec() {
+//             try {
+//                     assertEquals(lsUserWithPerm._exec(0, "add", "del", "reset", "extend"), 500);
+//             } catch (Exception e) {
+//                     assertEquals(e.getMessage(), "No Services Found for https://DME2RESOLVE [ ]");
+//
+//             }
+//     }
 
        @Test
        public void detailedHelp() {
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java
new file mode 100644 (file)
index 0000000..39698c3
--- /dev/null
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * ============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.ns;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+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.ns.Create;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.cmd.ns.Owner;
+import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+
+import static org.mockito.Mockito.*;
+import org.junit.Test;
+
+public class JU_Owner {
+
+       private static Owner owner;
+
+       @BeforeClass
+       public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               NS ns = new NS(cli);
+               owner = new Owner(ns);
+       }
+       
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       owner.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
+       }
+
+}
index 08fb7d4..8b9a8f2 100644 (file)
@@ -40,15 +40,15 @@ import org.onap.aaf.misc.env.APIException;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_CreateDelete {
        
-//     private static CreateDelete createDel;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             Role role = new Role(cli);
-//             createDel = new CreateDelete(role);
-//     }
-//     
+       private static CreateDelete createDel;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               Role role = new Role(cli);
+               createDel = new CreateDelete(role);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -65,8 +65,14 @@ public class JU_CreateDelete {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void testDetailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       createDel.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
 }
index ee62f53..e7ac12a 100644 (file)
@@ -40,15 +40,15 @@ 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);
-//             desc = new Describe(role);
-//     }
-//     
+       private static Describe desc;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               Role role = new Role(cli);
+               desc = new Describe(role);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -65,8 +65,14 @@ public class JU_Describe {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       desc.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
 }
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java
new file mode 100644 (file)
index 0000000..2334e1b
--- /dev/null
@@ -0,0 +1,90 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.cmd.test.role;
+
+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.role.List;
+import org.onap.aaf.auth.cmd.role.Role;
+import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.cmd.Cmd;
+import org.onap.aaf.auth.cmd.Param;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.client.Future;
+import org.onap.aaf.cadi.client.Rcli;
+import org.onap.aaf.misc.env.APIException;
+
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.GeneralSecurityException;
+import java.security.Principal;
+
+import org.junit.Test;
+
+public class JU_List {
+       
+       AAFcli cli;
+
+       private class ListRolesStub extends List {
+
+               public ListRolesStub(Role parent) {
+                       super(parent);
+                       // TODO Auto-generated constructor stub
+               }
+
+
+       }
+       
+       @Before
+       public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException{
+               cli = JU_AAFCli.getAAfCli();
+       }
+       
+       @Test
+       public void testRoles() throws APIException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+               Role role = new Role(cli);
+               ListRolesStub listStub = new ListRolesStub(role);
+               Future future = mock(Future.class);
+               Rcli rcli = mock(Rcli.class);
+               
+               Class c = listStub.getClass();
+               Class[] cArg = new Class[3];
+               cArg[0] = Future.class;
+               cArg[1] = Rcli.class;
+               cArg[2] = String.class;//Steps to test a protected method
+               //Method listMethod = c.getDeclaredMethod("list", cArg);
+               //listMethod.setAccessible(true);
+               //listMethod.invoke(listStub, future, rcli, "test");
+               
+       }
+
+}
index 87530f6..e09035c 100644 (file)
@@ -40,17 +40,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);
-//             List ls = new List(role);
-//             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);
+               List ls = new List(role);
+               lsActivity = new ListActivity(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -67,8 +67,14 @@ public class JU_ListActivity {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       lsActivity.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
 }
index 9d6baf9..6017905 100644 (file)
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListByNS {
        
-//     private static ListByNS lsByNS;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             Role role = new Role(cli);
-//             List ls = new List(role);
-//             lsByNS = new ListByNS(ls);
-//     }
-//     
+       private static ListByNS lsByNS;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               Role role = new Role(cli);
+               List ls = new List(role);
+               lsByNS = new ListByNS(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -67,8 +67,14 @@ public class JU_ListByNS {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       lsByNS.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
 }
index f2106c4..6c2f1b4 100644 (file)
@@ -40,17 +40,17 @@ import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListByNameOnly {
-//     
-//     private static ListByNameOnly lsByName;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             Role role = new Role(cli);
-//             List ls = new List(role);
-//             lsByName = new ListByNameOnly(ls);
-//     }
-//     
+       
+       private static ListByNameOnly lsByName;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               Role role = new Role(cli);
+               List ls = new List(role);
+               lsByName = new ListByNameOnly(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -67,8 +67,14 @@ public class JU_ListByNameOnly {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       lsByName.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
 }
index cfa068b..65f2c6f 100644 (file)
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListByPerm {
        
-//     private static ListByPerm lsByPerm;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             Role role = new Role(cli);
-//             List ls = new List(role);
-//             lsByPerm = new ListByPerm(ls);
-//     }
-//     
+       private static ListByPerm lsByPerm;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               Role role = new Role(cli);
+               List ls = new List(role);
+               lsByPerm = new ListByPerm(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -67,8 +67,14 @@ public class JU_ListByPerm {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       lsByPerm.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
 }
index 66c118c..37accbb 100644 (file)
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListByRole {
        
-//     private static ListByRole lsByRole;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             Role role = new Role(cli);
-//             List ls = new List(role);
-//             lsByRole = new ListByRole(ls);
-//     }
-//     
+       private static ListByRole lsByRole;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               Role role = new Role(cli);
+               List ls = new List(role);
+               lsByRole = new ListByRole(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -67,8 +67,15 @@ public class JU_ListByRole {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       lsByRole.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
+       
 }
index 140998d..d03511b 100644 (file)
@@ -40,17 +40,17 @@ import org.onap.aaf.misc.env.APIException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class JU_ListByUser {
-//     
-//     private static ListByUser lsByUser;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             Role role = new Role(cli);
-//             List ls = new List(role);
-//             lsByUser = new ListByUser(ls);
-//     }
-//     
+       
+       private static ListByUser lsByUser;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               Role role = new Role(cli);
+               List ls = new List(role);
+               lsByUser = new ListByUser(ls);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -67,8 +67,15 @@ public class JU_ListByUser {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       lsByUser.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
+       
 }
index 25acfff..fa83596 100644 (file)
@@ -41,15 +41,15 @@ import org.onap.aaf.misc.env.APIException;
 @RunWith(MockitoJUnitRunner.class)
 public class JU_User {
        
-//     private static User user;
-//     
-//     @BeforeClass
-//     public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-//             AAFcli cli = JU_AAFCli.getAAfCli();
-//             Role role = new Role(cli);
-//             user = new User(role);
-//     }
-//     
+       private static User user;
+       
+       @BeforeClass
+       public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+               AAFcli cli = JU_AAFCli.getAAfCli();
+               Role role = new Role(cli);
+               user = new User(role);
+       }
+       
 //     @Test
 //     public void exec() {
 //             try {
@@ -66,8 +66,14 @@ public class JU_User {
 //             }
 //     }
        
-       @Test                                           //TODO: Temporary fix AAF-111
-       public void netYetTested() {
-               Assert.assertTrue(true);
+       @Test
+       public void detailedHelp() {
+               boolean hasNoError = true;
+               try {
+                       user.detailedHelp(1, new StringBuilder("test"));
+               } catch (Exception e) {
+                       hasNoError = false;
+               }
+               assertEquals(hasNoError, true);
        }
 }
index 6d7a358..8476e06 100644 (file)
@@ -78,6 +78,12 @@ public interface Organization {
         * @return
         */
        public String getRealm();
+       
+       public boolean supportsRealm(String user);
+
+       public void addSupportedRealm(String r);
+
+
 
        String getDomain();
 
@@ -372,6 +378,15 @@ public interface Organization {
                        return N_A;
                }
        
+               @Override
+               public boolean supportsRealm(String r) {
+                       return false;
+               }
+
+               @Override
+               public void addSupportedRealm(String r) {
+               }
+
                @Override
                public String getDomain() {
                        return N_A;
index 843e268..57d37d0 100644 (file)
@@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.onap.aaf.auth.env.AuthzTrans;
 import org.onap.aaf.cadi.util.FQI;
+import org.onap.aaf.cadi.util.Split;
 import org.onap.aaf.misc.env.Env;
 import org.onap.aaf.misc.env.impl.BasicEnv;
 
@@ -98,6 +99,13 @@ public class OrganizationFactory {
                                                Class<Organization> cls = (Class<Organization>) Class.forName(orgClass);
                                                Constructor<Organization> cnst = cls.getConstructor(Env.class,String.class);
                                                org = cnst.newInstance(env,orgNS);
+                                               String other_realms = env.getProperty(orgNS+".also_supports");
+                                               if(other_realms!=null) {
+                                                       for(String r : Split.splitTrim(',', other_realms)) {
+                                                               org.addSupportedRealm(r);
+                                                       }
+                                               }
+                                               
                                        } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | 
                                                        InstantiationException | IllegalAccessException | IllegalArgumentException | 
                                                        InvocationTargetException e) {
index 5674e24..935f99b 100644 (file)
@@ -56,9 +56,12 @@ public class DefaultOrg implements Organization {
        final String realm;
        
        private final String NAME,mailHost,mailFrom;
+       private final Set<String> supportedRealms;
 
        public DefaultOrg(Env env, String realm) throws OrganizationException {
                this.realm = realm;
+               supportedRealms=new HashSet<String>();
+               supportedRealms.add(realm);
                domain=FQI.reverseDomain(realm);
                atDomain = '@'+domain;
                String s;
@@ -668,5 +671,21 @@ public class DefaultOrg implements Organization {
         return addressArray;
        }
 
-                       
+       private String extractRealm(final String r) {
+               int at;
+               if((at=r.indexOf('@'))>=0) {
+                       return FQI.reverseDomain(r.substring(at+1));
+               }
+               return r;
+       }
+       @Override
+       public boolean supportsRealm(final String r) {
+               return supportedRealms.contains(extractRealm(r)) || r.endsWith(realm);
        }
+
+       @Override
+       public synchronized void addSupportedRealm(final String r) {
+               supportedRealms.add(extractRealm(r));
+       }
+                       
+}
index e6f058a..d460628 100644 (file)
@@ -109,6 +109,11 @@ public class JU_DefaultOrg {
                assertTrue(realmTest == REALM);
        }
 
+       public void supportsRealm() {
+               String otherRealm = "org.ossaf.something";
+               defaultOrg.addSupportedRealm(otherRealm);
+               assertTrue(defaultOrg.supportsRealm(otherRealm));
+       }
        //@Test   
        public void testGetName() throws OrganizationException{
                String testName = defaultOrg.getName();
index 446bf46..a6bbbb0 100644 (file)
@@ -153,7 +153,7 @@ public class ServiceValidator extends Validator {
                                str = str.substring(0,idx);
                        }
                        
-                       if(cd.id.endsWith(org.getRealm())) {
+                       if(org.supportsRealm(cd.id)) {
                                if(isNew && (str=org.isValidID(trans, str)).length()>0) {
                                        msg(cd.id,str);
                                }
index 31e5d32..52be7d5 100644 (file)
@@ -163,6 +163,10 @@ public class JU_CmdLine {
                assertThat(outContent.toString().length(), is(2074));
 
                String filePath = "test/output_key";
+               File testDir = new File("test");
+               if(!testDir.exists()) {
+                       testDir.mkdirs();
+               }
                CmdLine.main(new String[]{"keygen", filePath});
                File keyfile = new File(filePath);
                assertTrue(Files.isReadable(Paths.get(filePath)));
index 88509d8..0346dbe 100644 (file)
                        <groupId>org.onap.aaf.authz</groupId>
                        <artifactId>aaf-cadi-aaf</artifactId>
                </dependency>
-               <dependency>
+               <!--<dependency>
                        <groupId>org.apache.shiro</groupId>
                        <artifactId>shiro-core</artifactId>
                        <version>1.4.0</version>
+               </dependency> -->
+               
+               <dependency>
+                       <groupId>org.apache.shiro</groupId>
+                       <artifactId>shiro-core</artifactId>
+                       <version>1.3.2</version>
                </dependency>
                
        </dependencies>