Package com.google.enterprise.connector.notes.client.mock

Examples of com.google.enterprise.connector.notes.client.mock.NotesDocumentMock


  public void testSetMetaFieldsTextMultipleValues() throws Exception {
    NotesConnectorDocument doc = new NotesConnectorDocument(null, null, null);
    doc.docProps = new HashMap<String, List<Value>>();

    NotesDocumentMock crawlDoc = new NotesDocumentMock();
    crawlDoc.addItem(new NotesItemMock("name", "x.foo", "type", NotesItem.TEXT,
            "values", "foo text 1", "foo text 2", "foo text 3"));
    doc.crawlDoc = crawlDoc;
    doc.setMetaFields();
    Property p = doc.findProperty("foo");
    assertNotNull("property foo missing", p);
View Full Code Here


    assertEquals("property foo 3", "foo text 3", v.toString());
    assertNull(p.nextValue());
  }

  public void testDeleteDocument() throws Exception {
    NotesDocumentMock crawlDoc = new NotesDocumentMock();
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.ITM_ACTION,
            "type", NotesItem.TEXT, "values", ActionType.DELETE));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.ITM_DOCID, "type",
            NotesItem.TEXT, "values", "docid"));

    NotesConnectorDocument document =
        new NotesConnectorDocument(null, null, null);
    document.setCrawlDoc("unid", crawlDoc);
View Full Code Here

    assertPropertyEquals(ActionType.DELETE.toString(), document,
        SpiConstants.PROPNAME_ACTION);
  }

  public void testAddDocument() throws Exception {
    NotesDocumentMock crawlDoc = getCrawlDoc(false);

    // TODO: move traversalContext to getConnector.
    NotesConnectorDocument document = new NotesConnectorDocument(
        connectorSession, session, connectorDatabase);
    document.setCrawlDoc("unid", crawlDoc);
View Full Code Here

    assertNull(document.findProperty(SpiConstants.PROPNAME_ACLUSERS));
    assertNull(document.findProperty(SpiConstants.PROPNAME_ACLGROUPS));
  }

  public void testDocumentDisplayURL() throws Exception {
    NotesDocumentMock crawlDoc = getAttachmentDoc();
    NotesConnectorDocument document = new NotesConnectorDocument(
        connectorSession, session, connectorDatabase);
    document.setCrawlDoc("unid123", crawlDoc);
    Property displayUrl =
        document.findProperty(SpiConstants.PROPNAME_DISPLAYURL);
View Full Code Here

        document.findProperty(SpiConstants.PROPNAME_DISPLAYURL);
    assertNotNull(displayUrl);
  }

  public void testAttachmentURLs() throws Exception {
    NotesDocumentMock crawlDoc = getAttachmentDoc();
    NotesConnectorDocument document = new NotesConnectorDocument(
        connectorSession, session, connectorDatabase);
    document.setCrawlDoc("unid123", crawlDoc);
    assertPropertyEquals("http://host:42/replicaid/0/unid/$File/attachmentUnid",
        document, SpiConstants.PROPNAME_DOCID);
View Full Code Here

        "http://host:42/replicaid/0/unid/$File/filename.doc?OpenElement",
        document, SpiConstants.PROPNAME_DISPLAYURL);
  }

  public void testAddDocumentWithReaders() throws Exception {
    NotesDocumentMock crawlDoc = getCrawlDoc(true);
    NotesConnectorDocument document = new NotesConnectorDocument(
        connectorSession, session, connectorDatabase);
    document.setCrawlDoc("unid", crawlDoc);

    assertPropertyEquals("http://host:42/replicaid/0/docid",
View Full Code Here

  public void testDocumentPrincipalValues() throws Exception {
    if (!supportsInheritedAcls) {
      return;
    }
    NotesDocumentMock crawlDoc = getCrawlDoc(true);
    // TODO: move traversalContext to getConnector.
    NotesConnectorSession connectorSession =
        (NotesConnectorSession) connector.login();
    SimpleTraversalContext context = new SimpleTraversalContext();
    context.setSupportsInheritedAcls(supportsInheritedAcls);
View Full Code Here

  public void testAddDatabaseAcl() throws Exception {
    if (!supportsInheritedAcls) {
      return;
    }
    NotesDocumentMock crawlDoc = getCrawlDatabaseAcl();
    NotesConnectorSession connectorSession =
        (NotesConnectorSession) connector.login();
    NotesSession session = connectorSession.createNotesSession();
    NotesDatabaseMock connectorDatabase =
        (NotesDatabaseMock) session.getDatabase(
View Full Code Here

  public void testDatabaseAclPrincipalValues() throws Exception {
    if (!supportsInheritedAcls) {
      return;
    }
    NotesDocumentMock crawlDoc = getCrawlDatabaseAcl();
    NotesConnectorSession connectorSession =
        (NotesConnectorSession) connector.login();
    NotesSession session = connectorSession.createNotesSession();
    NotesDatabaseMock connectorDatabase =
        (NotesDatabaseMock) session.getDatabase(
View Full Code Here

    fail("No value for property at index: " + property + "/" + index);
  }

  private NotesDocumentMock getCrawlDatabaseAcl() throws Exception {
    // Mimic NotesDatabasePoller.createDatabaseAclDocument
    NotesDocumentMock crawlDoc = new NotesDocumentMock();
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.NCITM_DBACL, "type",
            NotesItem.TEXT, "values", "true"));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.NCITM_DBACLINHERITTYPE,
            "type", NotesItem.TEXT, "values",
            NCCONST.DB_ACL_INHERIT_TYPE_ANDBOTH));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.NCITM_STATE,
            "type", NotesItem.TEXT, "values", NCCONST.STATEFETCHED));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.ITM_ACTION,
            "type", NotesItem.TEXT, "values", ActionType.ADD));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.NCITM_UNID, "type",
            NotesItem.TEXT, "values", "unid"));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.ITM_DOCID, "type",
            NotesItem.TEXT, "values", "docid"));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.NCITM_DBPERMITUSERS,
            "type", NotesItem.TEXT, "values", "user1", "user2"));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.NCITM_DBNOACCESSUSERS,
            "type", NotesItem.TEXT, "values", "user3", "user4"));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.NCITM_DBPERMITGROUPS,
            "type", NotesItem.TEXT, "values",
            "Domino%2Fgroup1", "Domino%2Fgroup2"));
    crawlDoc.addItem(new NotesItemMock("name", NCCONST.NCITM_DBNOACCESSGROUPS,
            "type", NotesItem.TEXT, "values",
            "Domino%2Fgroup3", "Domino%2Fgroup4"));
    return crawlDoc;
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.notes.client.mock.NotesDocumentMock

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.