Package com.google.enterprise.connector.mock.jcr

Examples of com.google.enterprise.connector.mock.jcr.MockJcrRepository


      mrel = new MockRepositoryEventList(db);
    } catch (RuntimeException e) {
      throw new RepositoryException(e);
    }

    MockJcrRepository repo = new MockJcrRepository(new MockRepository(mrel));
    Credentials creds = null;
    if (iLI != null) {
      creds = new SimpleCredentials(iLI.getUser(), iLI.getPassword()
          .toCharArray());
    } else {
      throw new RepositoryLoginException("No credentials defined for "
          + db);
    }

    try {
      MockJcrSession sess = (MockJcrSession) repo.login(creds);
      if (sess != null) {
        return new MockDmSession(this, repo, sess, db);
      } else {
        return null;
      }
View Full Code Here


  public final void testAuthenticate() throws RepositoryLoginException,
      RepositoryException, LoginException {
    MockRepositoryEventList mrel =
        new MockRepositoryEventList("MockRepositoryEventLog2.txt");
    MockRepository r = new MockRepository(mrel);
    MockJcrRepository repo = new MockJcrRepository(r);
    Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
    Session session = repo.login(creds);
    AuthenticationManager authenticationManager =
        new JcrAuthenticationManager(session);

    Assert.assertFalse(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity("jimbo","jimbo")).isValid());
View Full Code Here

   * registers the created connector with this {@link Instantiator}.
   */
  public void setupConnector(String connectorName, String resourceName) {
    MockRepositoryEventList mrel = new MockRepositoryEventList(resourceName);
    MockRepository mockRepository = new MockRepository(mrel);
    Repository repository = new MockJcrRepository(mockRepository);
    Connector connector = new JcrConnector(repository);
    addConnector(connectorName, connector);
  }
View Full Code Here

      throws RepositoryException, LoginException {

    MockRepositoryEventList mrel =
        new MockRepositoryEventList("MockRepositoryEventLog2.txt");
    MockRepository r = new MockRepository(mrel);
    MockJcrRepository repo = new MockJcrRepository(r);
    Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
    Session session = repo.login(creds);
    AuthorizationManager authorizationManager =
        new JcrAuthorizationManager(session);

    {
      String username = "joe";
View Full Code Here

  public final void testAuthorizeNewFormat()
      throws RepositoryException, LoginException {
    MockRepositoryEventList mrel =
        new MockRepositoryEventList("MockRepositoryEventLogAcl.txt");
    MockRepository r = new MockRepository(mrel);
    MockJcrRepository repo = new MockJcrRepository(r);
    Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
    Session session = repo.login(creds);
    AuthorizationManager authorizationManager =
        new JcrAuthorizationManager(session);
    {
      String username = "joe";
View Full Code Here

  public void testTraversal() throws RepositoryLoginException, RepositoryException {
    MockRepositoryEventList mrel =
      new MockRepositoryEventList("MockRepositoryEventLog1.txt");
    MockRepository r = new MockRepository(mrel);
    javax.jcr.Repository jcrRepo = new MockJcrRepository(r);
    Connector repo = new JcrConnector(jcrRepo);
    Session session = repo.login();
    TraversalManager qtm = session.getTraversalManager();
    QueryTraversalUtil.runTraversal(qtm, 2);
  }
View Full Code Here

    // like the Test Connector would and then extracts the document and the
    // content stream property as it is done during traversal.
    MockRepositoryEventList eventList = new MockRepositoryEventList(
        "MockRepositoryEventLogBinaryFile.txt");
    MockRepository mockRepo = new MockRepository(eventList);
    MockJcrRepository mockJcrRepo = new MockJcrRepository(mockRepo);
    JcrConnector jcrConn = new JcrConnector(mockJcrRepo);
    TraversalManager travMgr = jcrConn.login().getTraversalManager();
    Document document = travMgr.startTraversal().nextDocument();
    assertEquals("worddoc",
        Value.getSingleValueString(document, SpiConstants.PROPNAME_DOCID));
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.mock.jcr.MockJcrRepository

Copyright © 2018 www.massapicom. 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.