Package com.google.enterprise.connector.spi

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


    assertNull(manager.authorizeDocids("nonexistent", docids, identity));
  }

  /** Test authorizeDocids. */
  public void testAuthorizeDocids() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null, null,
        new AuthorizeAllAuthorizationManager(), null, null));
    List<String> docids = Arrays.asList(new String[] { "foo", "bar", "baz" });
    Collection<AuthorizationResponse> authorized =
        manager.authorizeDocids(connectorName, docids, identity);

View Full Code Here


  }

  /** Test getDocumentContent with no Retriever. */
  public void testGetDocumentContentNoRetriever() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, null, null));
    assertNull(manager.getDocumentContent(connectorName, "docid"));
  }
View Full Code Here

  }

  /** Test getDocumentContent with Document NotFound. */
  public void testGetDocumentContentDocumentNotFound() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    try {
      manager.getDocumentContent(connectorName, MockRetriever.DOCID_NOT_FOUND);
      fail("Expected RepositoryDocumentException");
    } catch (RepositoryDocumentException expected) {
      // Expected.
View Full Code Here

  }

  /** Test getDocumentContent with RepositoryException. */
  public void testGetDocumentContentRepositoryException() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    try {
      manager.getDocumentContent(connectorName,
                                 MockRetriever.DOCID_REPOSITORY_EXCEPTION);
      fail("Expected RepositoryException");
    } catch (RepositoryException expected) {
View Full Code Here

  }

  /** Test getDocumentContent where document has no content. */
  public void testGetDocumentContentNoContent() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    InputStream in = manager.getDocumentContent(connectorName,
                                                MockRetriever.DOCID_NO_CONTENT);
    // GSA still doesn't handle docs with no content, so the
    // Production Manager substitutes a single space.
    assertNotNull(in);
View Full Code Here

  }

  /** Test getDocumentContent where document has empty content. */
  public void testGetDocumentContentEmptyContent() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    InputStream in = manager.getDocumentContent(connectorName,
                                                MockRetriever.DOCID_NO_CONTENT);
    // GSA still doesn't handle docs with no content, so the
    // Production Manager substitutes a single space.
    assertNotNull(in);
View Full Code Here

  }

  /** Test getDocumentContent. */
  public void testGetDocumentContent() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    InputStream in = manager.getDocumentContent(connectorName, "docid");
    assertNotNull(in);
    assertEquals("docid", StringUtils.streamToString(in));
  }
View Full Code Here

  }

  /** Test getDocumentMetaData with no Retriever. */
  public void testGetDocumentMetaDataNoRetriever() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, null, null));
    assertNull(manager.getDocumentMetaData(connectorName, "docid"));
  }
View Full Code Here

  }

  /** Test getDocumentMetaData with Document NotFound. */
  public void testGetDocumentMetaDataDocumentNotFound() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    try {
      manager.getDocumentMetaData(connectorName, MockRetriever.DOCID_NOT_FOUND);
      fail("Expected RepositoryDocumentException");
    } catch (RepositoryDocumentException expected) {
      // Expected.
View Full Code Here

  }

  /** Test getDocumentMetaData with RepositoryException. */
  public void testGetDocumentMetaDataRepositoryException() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, new MockRetriever(), null));
    try {
      manager.getDocumentMetaData(connectorName,
                                  MockRetriever.DOCID_REPOSITORY_EXCEPTION);
      fail("Expected RepositoryException");
    } catch (RepositoryException expected) {
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.