Loading projects/cadcAccessControl-Server/test/src/ca/nrc/cadc/ac/server/ldap/LdapGroupDAOTest.java +52 −54 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ public class LdapGroupDAOTest return "CadcDaoTestGroup-" + System.currentTimeMillis(); } // @Test @Test public void testOneGroup() throws Exception { // do everything as owner Loading Loading @@ -222,7 +222,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testSearchOwnerGroups() throws Exception { Subject.doAs(daoTestUser1Subject, new PrivilegedExceptionAction<Object>() Loading Loading @@ -270,7 +270,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testSearchMemberGroups() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -371,7 +371,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testSearchAdminGroups() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -492,7 +492,7 @@ public class LdapGroupDAOTest Group testGroup2 = new Group(testGroup2ID, daoTestUser1); testGroup2 = getGroupDAO().addGroup(testGroup2); log.debug("add group: " + testGroup2ID); Thread.sleep(1000); // sleep to let memberof plugin do its work //Thread.sleep(1000); // sleep to let memberof plugin do its work } catch (Exception e) { Loading Loading @@ -563,7 +563,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testAddGroupExceptions() throws Exception { Subject.doAs(anonSubject, new PrivilegedExceptionAction<Object>() Loading Loading @@ -610,7 +610,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testGetGroupExceptions() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -662,23 +662,24 @@ public class LdapGroupDAOTest } }); Subject.doAs(daoTestUser2Subject, new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { try { getGroupDAO().getGroup(groupID); fail("getGroup with anonymous access should throw " + "AccessControlException"); } catch (AccessControlException ignore) {} return null; } }); // All access ACI's will allow anonymous access // Subject.doAs(daoTestUser2Subject, new PrivilegedExceptionAction<Object>() // { // public Object run() throws Exception // { // try // { // getGroupDAO().getGroup(groupID); // fail("getGroup with anonymous access should throw " + // "AccessControlException"); // } // catch (AccessControlException ignore) {} // return null; // } // }); } // @Test @Test public void testModifyGroupExceptions() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -725,7 +726,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testDeleteGroupExceptions() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -772,7 +773,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testSearchGroupsExceptions() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -820,6 +821,29 @@ public class LdapGroupDAOTest } }); // // change the user // Subject.doAs(daoTestUser2Subject, new PrivilegedExceptionAction<Object>() // { // public Object run() throws Exception // { // try // { // Group group = getGroupDAO().getGroup(groupID); // assertTrue(group == null); // // fail("searchGroups with un-authorized user should throw " + // "AccessControlException"); // } // catch (AccessControlException ignore) // { // // } // // return null; // } // }); Subject.doAs(daoTestUser1Subject, new PrivilegedExceptionAction<Object>() { public Object run() throws Exception Loading @@ -828,32 +852,6 @@ public class LdapGroupDAOTest return null; } }); // change the user Subject.doAs(daoTestUser2Subject, new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { try { Group group = getGroupDAO().getGroup(groupID); assertTrue(group == null); fail("searchGroups with un-authorized user should throw " + "AccessControlException"); } catch (AccessControlException ignore) { } return null; } }); } private void assertGroupsEqual(Group gr1, Group gr2) Loading Loading
projects/cadcAccessControl-Server/test/src/ca/nrc/cadc/ac/server/ldap/LdapGroupDAOTest.java +52 −54 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ public class LdapGroupDAOTest return "CadcDaoTestGroup-" + System.currentTimeMillis(); } // @Test @Test public void testOneGroup() throws Exception { // do everything as owner Loading Loading @@ -222,7 +222,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testSearchOwnerGroups() throws Exception { Subject.doAs(daoTestUser1Subject, new PrivilegedExceptionAction<Object>() Loading Loading @@ -270,7 +270,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testSearchMemberGroups() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -371,7 +371,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testSearchAdminGroups() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -492,7 +492,7 @@ public class LdapGroupDAOTest Group testGroup2 = new Group(testGroup2ID, daoTestUser1); testGroup2 = getGroupDAO().addGroup(testGroup2); log.debug("add group: " + testGroup2ID); Thread.sleep(1000); // sleep to let memberof plugin do its work //Thread.sleep(1000); // sleep to let memberof plugin do its work } catch (Exception e) { Loading Loading @@ -563,7 +563,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testAddGroupExceptions() throws Exception { Subject.doAs(anonSubject, new PrivilegedExceptionAction<Object>() Loading Loading @@ -610,7 +610,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testGetGroupExceptions() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -662,23 +662,24 @@ public class LdapGroupDAOTest } }); Subject.doAs(daoTestUser2Subject, new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { try { getGroupDAO().getGroup(groupID); fail("getGroup with anonymous access should throw " + "AccessControlException"); } catch (AccessControlException ignore) {} return null; } }); // All access ACI's will allow anonymous access // Subject.doAs(daoTestUser2Subject, new PrivilegedExceptionAction<Object>() // { // public Object run() throws Exception // { // try // { // getGroupDAO().getGroup(groupID); // fail("getGroup with anonymous access should throw " + // "AccessControlException"); // } // catch (AccessControlException ignore) {} // return null; // } // }); } // @Test @Test public void testModifyGroupExceptions() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -725,7 +726,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testDeleteGroupExceptions() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -772,7 +773,7 @@ public class LdapGroupDAOTest }); } // @Test @Test public void testSearchGroupsExceptions() throws Exception { final String groupID = getGroupID(); Loading Loading @@ -820,6 +821,29 @@ public class LdapGroupDAOTest } }); // // change the user // Subject.doAs(daoTestUser2Subject, new PrivilegedExceptionAction<Object>() // { // public Object run() throws Exception // { // try // { // Group group = getGroupDAO().getGroup(groupID); // assertTrue(group == null); // // fail("searchGroups with un-authorized user should throw " + // "AccessControlException"); // } // catch (AccessControlException ignore) // { // // } // // return null; // } // }); Subject.doAs(daoTestUser1Subject, new PrivilegedExceptionAction<Object>() { public Object run() throws Exception Loading @@ -828,32 +852,6 @@ public class LdapGroupDAOTest return null; } }); // change the user Subject.doAs(daoTestUser2Subject, new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { try { Group group = getGroupDAO().getGroup(groupID); assertTrue(group == null); fail("searchGroups with un-authorized user should throw " + "AccessControlException"); } catch (AccessControlException ignore) { } return null; } }); } private void assertGroupsEqual(Group gr1, Group gr2) Loading