Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.MockConnector


  private MockInstantiator getMockInstantiator() throws Exception {
    MockInstantiator instantiator =
        new MockInstantiator(new ThreadPool(5, new SystemClock()));
    instantiator.setupTestTraversers();
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    return instantiator;
  }
View Full Code Here


  }

  /** Test getDocumentMetaData. */
  public void testGetDocumentMetaData() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    Document document = manager.getDocumentMetaData(connectorName, "docid");
    assertNotNull(document);
    assertEquals("docid",
        Value.getSingleValueString(document, SpiConstants.PROPNAME_DOCID));
  }
View Full Code Here

  }

  /** Test authenticate() with no AuthenticationManager. */
  public void testAuthenticateNoAuthenticationManger() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, null, null));
    AuthenticationResponse response =
        manager.authenticate(connectorName, identity);
    assertNotNull(response);
    assertFalse(response.isValid());
    assertNull(response.getData());
View Full Code Here

    assertNull(response.getGroups());
  }

  /** Test authenticate() with success response. */
  public void testAuthenticateSuccess() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new AuthenticatingAuthenticationManager(), null, null, null));
    AuthenticationResponse response =
        manager.authenticate(connectorName, identity);
    assertNotNull(response);
    assertTrue(response.isValid());
View Full Code Here

    assertEquals("bar", response.getData());
  }

  /** Test authenticate() ConnectorNotFoundException. */
  public void testAuthenticateConnectorNotFoundException() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new AuthenticatingAuthenticationManager(), null, null, null));
    AuthenticationResponse response =
        manager.authenticate("nonexistent", identity);
    assertNotNull(response);
    assertFalse(response.isValid());
View Full Code Here

    assertNull(response.getGroups());
  }

  /** Test authenticate() throws RepositoryException. */
  public void testAuthenticateRepositoryException() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new ExceptionalAuthenticationManager(new RepositoryException()),
        null, null, null));
    AuthenticationResponse response =
        manager.authenticate(connectorName, identity);
    assertNotNull(response);
View Full Code Here

    assertNull(response.getGroups());
  }

  /** Test authenticate() throws RepositoryLoginException. */
  public void testAuthenticateRepositoryLoginException() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new ExceptionalAuthenticationManager(new RepositoryLoginException()),
        null, null, null));
    AuthenticationResponse response =
        manager.authenticate(connectorName, identity);
    assertNotNull(response);
View Full Code Here

    assertNull(response.getGroups());
  }

  /** Test authenticate() throws RuntimeException. */
  public void testAuthenticateRuntimeException() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new ExceptionalAuthenticationManager(null), null, null, null));
    AuthenticationResponse response = manager.authenticate(
        connectorName, identity);
    assertNotNull(response);
    assertFalse(response.isValid());
View Full Code Here

  }

  /** Test authorizeDocids with no AuthorizationManager. */
  public void testAuthorizeDocidsNoAuthorizationManager() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, null, null));
    List<String> docids = Arrays.asList(new String[] { "foo", "bar", "baz" });
    assertNull(manager.authorizeDocids(connectorName, docids, identity));
  }
View Full Code Here

  }

  /** Test authorizeDocids with Exception throwing AuthorizationManager. */
  public void testAuthorizeDocidsExceptionalAuthorizationManager()
      throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null, null,
        new ExceptionalAuthorizationManager(), null, null));
    List<String> docids = Arrays.asList(new String[] { "foo", "bar", "baz" });
    assertNull(manager.authorizeDocids(connectorName, docids, identity));
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.MockConnector

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.