@Override public Session run() throws Exception { return repository.login(); } }, null);
@Override protected void beforeSuite() throws Exception { session = getRepository().login(getCredentials()); node = session.getRootNode().addNode(TEST_ID); session.save(); }
@Override public void beforeSuite() throws RepositoryException { session = getRepository().login(getCredentials()); node = session.getRootNode().addNode(ROOT_NODE_NAME, "nt:unstructured"); for (int i = 0; i < CHILD_COUNT; i++) { node.addNode("node" + i, "nt:unstructured"); } }
@Override public void execute(Repository repository, Credentials credentials, ScalabilityAbstractSuite.ExecutionContext context) throws Exception { Writer writer = new Writer(this.getClass().getSimpleName() + UUID.randomUUID(), 100, repository.login(credentials), context); writer.process(); } }
@Override public void runTest() throws RepositoryException { Repository repository = getRepository(); for (int i = 0; i < COUNT; i++) { repository.login(getCredentials()).logout(); } } }
@Override public void execute(Repository repository, Credentials credentials, ExecutionContext context) throws Exception { Session session = repository.login(credentials); QueryManager qm; try { qm = session.getWorkspace().getQueryManager(); search(qm, context); } catch (RepositoryException e) { e.printStackTrace(); } }
@Override @NotNull public Session impersonate(Credentials credentials) throws RepositoryException { checkAlive(); ImpersonationCredentials impCreds = new ImpersonationCredentials( checkNotNull(credentials), sd.getAuthInfo()); return getRepository().login(impCreds, sd.getWorkspaceName()); }
private boolean isReindexFinished() throws RepositoryException { Session s = repos.get(0).login(ADMIN); try { boolean reindex = s.getNode("/oak:index/" + INDEX_DEF_NODE) .getProperty(REINDEX_PROPERTY_NAME).getBoolean(); return !reindex; } finally { s.logout(); } }
@Test public void repositoryLogin() throws Exception{ //Simple sanity test to see if repository is working Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray())); session.logout(); } }
@Before public void setUp() throws Exception { jackrabbitRepository = JcrUtils.getRepository( new File("target", "jackrabbit").toURI().toURL().toString()); oakRepository = new Jcr().createRepository(); writeSessions.add((JackrabbitSession) jackrabbitRepository.login(new SimpleCredentials("admin", "admin".toCharArray()))); writeSessions.add((JackrabbitSession) oakRepository.login(new SimpleCredentials("admin", "admin".toCharArray()))); setupAuthorizables(); setupContent(); readSessions.add(jackrabbitRepository.login(new SimpleCredentials(userId, userId.toCharArray()))); readSessions.add(oakRepository.login(new SimpleCredentials(userId, userId.toCharArray()))); }
public void testAnonymousSimpleCredentialsLogin() throws RepositoryException { testSession = repository.login(new GuestCredentials()); String anonymousID = testSession.getUserID(); testSession.logout(); try { testSession = repository.login(new SimpleCredentials(anonymousID, new char[0])); fail("Anonymous cannot login with simple credentials."); } catch (LoginException e) { // success // EXERCISE: explain why } }
@Override public Session getSession(String logicalWorkspaceName, Credentials credentials) throws RepositoryException { WorkspaceMappingDefinition mapping = this.workspaceMapping.getWorkspaceMapping(logicalWorkspaceName); if (mapping == null) throw new NoSuchWorkspaceException(logicalWorkspaceName); Repository repository = getRepository(mapping.getRepositoryName()); String physicalWorkspaceName = mapping.getPhysicalWorkspaceName(); Session session = repository.login(credentials, physicalWorkspaceName); return wrapSession(session, logicalWorkspaceName); }
private Session newSession(boolean refreshIntervalZero) throws RepositoryException { Credentials creds = new SimpleCredentials("admin", "admin".toCharArray()); if (refreshIntervalZero){ return ((JackrabbitRepository) getRepository()) .login(creds, null, Collections.<String, Object>singletonMap(REFRESH_INTERVAL, 0)); } else{ return getRepository().login(creds); } }
public void testAnonymousSimpleCredentialsLoginSuccess() throws RepositoryException { testSession = repository.login(new GuestCredentials()); String anonymousID = testSession.getUserID(); // EXERCISE: how to you need to modify the test-case that this would work? Session anonymousUserSession = repository.login(new SimpleCredentials(anonymousID, new char[0])); assertEquals(UserConstants.DEFAULT_ANONYMOUS_ID, testSession.getUserID()); }
@Test(expected = NoSuchWorkspaceException.class) public void loginInvalidWorkspace() throws RepositoryException { Repository repository = getRepository(); repository.login(new GuestCredentials(), "invalid"); }
@Test public void testLoginWithOldPassword() throws RepositoryException, NotExecutableException { try { user.changePassword("changed"); superuser.save(); Session s = getHelper().getRepository().login(new SimpleCredentials(user.getID(), testPw.toCharArray())); s.logout(); fail("user pw has changed. login must fail."); } catch (LoginException e) { // success } }
public void testGetCredentials() throws RepositoryException { testUser = userManager.createUser(testId, TEST_PW); Credentials creds = testUser.getCredentials(); // EXERCISE fix the expectation Credentials expected = null; assertEquals(expected, creds); // EXERCISE : complete and explain the expected behavior getHelper().getRepository().login(creds).logout(); }
@Before public void before() throws Exception { store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build(); repo = new Jcr(store).createRepository(); session = repo.login(new SimpleCredentials("admin", "admin".toCharArray())); vMgr = session.getWorkspace().getVersionManager(); }
public void testImpersonateOneSelf() throws RepositoryException { // EXERCISE: walk through this impersonation. does it work? if it does: why? Session testSession = superuser.getRepository().login(ExerciseUtility.getTestCredentials(testUser.getID())); sessionList.add(testSession); Session impersonated = testSession.impersonate(new SimpleCredentials(testUser.getID(), new char[0])); sessionList.add(impersonated); assertEquals(testUser.getID(), impersonated.getUserID()); }
@Before public void before() throws Exception { ns = builderProvider.newBuilder().setAsyncDelay(0) .setDocumentStore(store).build(); repository = new Jcr(ns).createRepository(); session = repository.login(new SimpleCredentials("admin", "admin".toCharArray())); }