@Override protected void afterSuite() throws Exception { super.afterSuite(); cs.close(); }
@Override public void after() throws Exception { try { if (testSession != null) { testSession.close(); } } finally { super.after(); } }
@Override public void after() throws Exception { try { if (testSession != null) { testSession.close(); } } finally { super.after(); } }
@Test public void testLoginWithPrincipalName() throws Exception { // EXERCISE fix the test case and add proper verification login(ExerciseUtility.getTestCredentials(testPrincipal.getName())).close(); }
@Test public void testCustomCredentialsLogin() throws LoginException, RepositoryException, IOException { String loginID = null; // EXERCISE String pw = null; // EXERCISE ContentSession contentSession = login(new CustomCredentials(loginID, pw, Collections.EMPTY_MAP)); // EXERCISE: add verification of the AuthInfo according to your implementation of the custom login module. contentSession.close(); } }
@Test public void testGuestLogin() throws Exception { ContentSession cs = null; try { cs = login(new GuestCredentials()); } finally { if (cs != null) { cs.close(); } } }
@Test public void testLogin() throws LoginException, NoSuchWorkspaceException, IOException { ContentSession contentSession = login(new GuestCredentials()); contentSession.close(); }
@Override public void after() throws Exception { try { if (testSession != null) { testSession.close(); } root.getTree("/a").remove(); root.commit(); } finally { super.after(); } }
@Test public void testSyncCreatesRepExternalPrincipals() throws Exception { try { login(new SimpleCredentials(USER_ID, new char[0])).close(); root.refresh(); assertExternalPrincipalNames(getUserManager(root), USER_ID); } finally { options.clear(); } }
@Test public void testLoginAsSystemUser() throws Exception { createUser(null); try { login(new SimpleCredentials(uid, new char[0])).close(); fail(); } catch (LoginException e) { // success } }
@Test public void testLoginAsSystemUser2() throws Exception { User user = createUser(null); try { login(user.getCredentials()).close(); fail(); } catch (LoginException e) { // success } }
@Override public void after() throws Exception { try { if (testSession != null) { testSession.close(); } assertTrue(root.getTree("/" + testPath).remove()); root.commit(); } finally { super.after(); } }
@Test public void testLoginFailed() throws Exception { try { ContentSession cs = login(new SimpleCredentials(USER_ID, new char[0])); cs.close(); fail("login failure expected"); } catch (LoginException e) { // success } finally { assertNull(userManager.getAuthorizable(USER_ID)); } }
@Test public void testReadAcl2() throws Exception { ContentSession cs = createTestSession2(); try { Root r = cs.getLatestRoot(); assertTrue(r.getTree("/content/rep:policy").exists()); } finally { cs.close(); } }
@Test public void testImpersonateSystemUser() throws Exception { createUser(null); ContentSession cs = login(new ImpersonationCredentials(new SimpleCredentials(uid, new char[0]), adminSession.getAuthInfo())); cs.close(); }
@Test public void testRequiresSyncAfterCreate() throws Exception { login(new SimpleCredentials(USER_ID, new char[0])).close(); root.refresh(); SyncedIdentity id = syncHandler.findIdentity(userManager, USER_ID); assertNotNull("Known authorizable should exist", id); assertFalse("Freshly synced id should not require sync", syncHandler.requiresSync(id)); }
@Test public void testNullLogin() throws Exception { ContentSession cs = login(null); try { AuthInfo authInfo = cs.getAuthInfo(); String anonymousID = UserUtil.getAnonymousId(getUserConfiguration().getParameters()); assertEquals(anonymousID, authInfo.getUserID()); } finally { cs.close(); } }
@Test public void testLogin() throws Exception { TestCredentials creds = new TestCredentials("testUser"); ContentSession cs = login(creds); try { AuthInfo info = cs.getAuthInfo(); assertEquals("testUser", info.getUserID()); assertAttributes(getCredentialsSupport().getAttributes(creds), info); } finally { cs.close(); } }
@Override public void before() throws Exception { super.before(); testUserPath = getTestUser().getPath(); // force an external user to be synchronized into the repo login(new SimpleCredentials(USER_ID, new char[0])).close(); root.refresh(); Authorizable a = getUserManager(root).getAuthorizable(USER_ID); assertNotNull(a); assertEquals(isDynamic(), a.hasProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES)); externalUserPath = a.getPath(); }
@Test public void testFindExternalIdentity() throws Exception { login(new SimpleCredentials(USER_ID, new char[0])).close(); root.refresh(); SyncedIdentity id = syncHandler.findIdentity(userManager, USER_ID); assertNotNull("known authorizable should exist", id); ExternalIdentityRef ref = id.getExternalIdRef(); assertNotNull(ref); assertEquals("external user should have correct external ref.idp", idp.getName(), ref.getProviderName()); assertEquals("external user should have correct external ref.id", USER_ID, id.getExternalIdRef().getId()); }