Package javax.jcr

Examples of javax.jcr.Repository.login()


        final MongoMK mk2 = mks.get(1);
        Repository r1 = new Jcr(mk1).createRepository();
        Repository r2 = new Jcr(mk2).createRepository();

        Session s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
        Session s2 = r2.login(new SimpleCredentials("admin", "admin".toCharArray()));

        Node root1 = s1.getRootNode().addNode("session-1");
        s1.save();
        Node root2 = s2.getRootNode().addNode("session-2");
        s2.save();
View Full Code Here


        // nodeStore = fixture.createNodeStore(1);
        nodeStore = fixture.createNodeStore();
       
        if (nodeStore != null) {
            Repository rep  = new Jcr(nodeStore).createRepository();
            session = rep.login(new SimpleCredentials("admin", "admin".toCharArray()));
        }
    }
   
    @After
    public void logout() {
View Full Code Here

        assertThat(repository, is(notNullValue()));

        // Create a session, authenticating using one of the usernames defined by our JAAS policy file(s) ...
        Session session = null;
        try {
            session = repository.login(new SimpleCredentials("superuser", "superuser".toCharArray()));
        } finally {
            if (session != null) session.logout();
        }
    }
View Full Code Here

        assertThat(repository, is(notNullValue()));

        // Create a session, authenticating using one of the usernames defined by our JAAS policy file(s) ...
        Session session = null;
        try {
            session = repository.login(new SimpleCredentials("superuser", "superuser".toCharArray()));

            // Check that the namespace showed up ...
            assertThat(session.getNamespacePrefix("http://www.jboss.org/dna/test/1.0"), is("dnatest"));

            // Check that some of the node types showed up ...
View Full Code Here

            throws Exception {
        synchronized (REPOSITORY_INSTANCES) {
            Repository repo = REPOSITORY_INSTANCES.get(dir);
            if (repo == null) {
                repo = createRepository(dir, xml);
                Session session = repo.login(superuser);
                try {
                    TestContentLoader loader = new TestContentLoader();
                    loader.loadTestContent(session);
                } finally {
                    session.logout();
View Full Code Here

            throws Exception {
        synchronized (REPOSITORY_INSTANCES) {
            Repository repo = REPOSITORY_INSTANCES.get(dir);
            if (repo == null) {
                repo = createRepository(dir, xml);
                Session session = repo.login(superuser);
                try {
                    prepareTestContent(session);
                } finally {
                    session.logout();
                }
View Full Code Here

    public Session getRepositorySession() throws JcrStorageException {
        if (session != null)
            return session;
        try {
            Repository repository = new TransientRepository();
            session = repository.login(new SimpleCredentials("xmpp-admin", "adminpassword".toCharArray()));
            return session;
        } catch (Exception e) {
            throw new JcrStorageException(e);
        }
    }
View Full Code Here

    }

    @Test(expected = NoSuchWorkspaceException.class)
    public void loginInvalidWorkspace() throws RepositoryException {
        Repository repository = getRepository();
        repository.login(new GuestCredentials(), "invalid");
    }

    @Ignore("OAK-118") // TODO OAK-118: implement workspace management
    @Test
    public void getWorkspaceNames() throws RepositoryException {
View Full Code Here

    }

    @Test(expected = NoSuchWorkspaceException.class)
    public void loginInvalidWorkspace() throws RepositoryException {
        Repository repository = getRepository();
        repository.login(new GuestCredentials(), "invalid");
    }

    @Ignore("OAK-118") // TODO OAK-118: implement workspace management
    @Test
    public void getWorkspaceNames() throws RepositoryException {
View Full Code Here

    setUser(new CaoUser(new EmptyApplication(this),form.getUser(),true,true));
    config = form;
    try {
      Repository repo = JcrUtils.getRepository(form.getUri());
      if (MString.isEmptyTrim(form.getWorkspace()))
        session = repo.login(new SimpleCredentials(form.getUser(), form.getPassword().toCharArray()));
      else
        session = repo.login(new SimpleCredentials(form.getUser(), form.getPassword().toCharArray()), form.getWorkspace());
    } catch (Throwable t) {
      throw new ConnectionException(t);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.