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

Examples of com.google.enterprise.connector.notes.client.NotesDocument


    assertEquals("Groups' map is not empty", 0, groups.size());
    setUpGroups();
    assertTrue("Groups are not populated from groupUnids", groups.size() > 0);

    for (String unid : groupUnids) {
      NotesDocument doc;
      try {
        doc = namesDatabase.getDocumentByUNID(unid);
        assertEquals(doc.getItemValueString(NCCONST.NCITM_UNID), unid);
        String groupName = doc.getItemValueString(NCCONST.GITM_LISTNAME);
        assertGroupExists(groupName.toLowerCase());
      } catch (RepositoryException e) {
        assertTrue(e.getMessage().contains(nonExistentId));
      }
    }
View Full Code Here


    setUpUsers();
    assertTrue("Users are not populated from userUnids",
        notesUserNames.size() > 0);

    for (String unid : userUnids) {
      NotesDocument doc;
      try {
        doc = namesDatabase.getDocumentByUNID(unid);
        assertEquals(doc.getItemValueString(NCCONST.NCITM_UNID), unid);
        String notesName = doc.getItemValueString(NCCONST.PITM_FULLNAME);
        assertTrue(notesName + " user doesn't exist",
            notesUserNames.containsKey(notesName.toLowerCase()));
      } catch (RepositoryException e) {
        assertTrue(e.getMessage().contains(nonExistentId));
      }
View Full Code Here

    // Setup deleted document
    String delUNID = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX0000";
    NotesDatabaseMock srcDb = setupSourceDatabase("mickey1/mtv/us", "test.nsf",
        TESTCONST.DBSRC_REPLICAID, notesDocMgrDbTest.getDocuments(),
        NCCONST.VIEWINDEXED);
    NotesDocument delDoc = srcDb.getDocumentByUNID(delUNID);
    delDoc.remove(true);
    String docId = "http://" + TESTCONST.SERVER_DOMINO_WEB + TESTCONST.DOMAIN
        + "/" + TESTCONST.DBSRC_REPLICAID + "/0/" + delUNID;

    // Setup template document including formulas
    String searchString =
View Full Code Here

    NotesSession session = connectorSession.createNotesSession();
    NotesDatabase configDb = session.getDatabase("testserver",
        "testconfig.nsf");
    NotesView crawlQueue = configDb.getView(NCCONST.VIEWCRAWLQ);
    assertEquals(1, crawlQueue.getEntryCount());
    NotesDocument docFromQueue = NotesCrawlerThread.getNextFromCrawlQueue(
        session, crawlQueue);
    assertNotNull("No doc from queue", docFromQueue);
    assertEquals(NCCONST.STATEINCRAWL,
        docFromQueue.getItemValueString(NCCONST.NCITM_STATE));
  }
View Full Code Here

    expect(ncs.createNotesSession()).andReturn(ns);
    expect(ns.getDatabase(isA(String.class), isA(String.class))).andReturn(cdb);
    expect(cdb.getView(isA(String.class))).andReturn(crawlQ);
    expect(cdb.getReplicaID()).andReturn("REPLICA100");

    NotesDocument docCrawl = createNiceMock(NotesDocument.class);
    expect(docCrawl.getUniversalID()).andReturn("UNID100");

    NotesDocument docSrc = createNiceMock(NotesDocument.class);
    NotesEmbeddedObject embObj = createNiceMock(NotesEmbeddedObject.class);
    expect(docSrc.getAttachment(attachmentName)).andReturn(embObj);
    expect(embObj.getType()).andReturn(NotesEmbeddedObject.EMBED_ATTACHMENT);
    expect(embObj.getFileSize()).andReturn(1);

    NotesDocument docAttach = createNiceMock(NotesDocument.class);
    expect(cdb.createDocument()).andReturn(docAttach);
    Capture<String> captureContentPath = new Capture<String>();
    expect(docAttach.replaceItemValue(eq(NCCONST.ITM_CONTENTPATH),
        capture(captureContentPath))).andReturn(null);
    replay(ncs, ns, cdb, crawlQ, docCrawl, docSrc, docAttach, embObj);

    NotesCrawlerThread crawler = new NotesCrawlerThread(nc, ncs);
    crawler.connectQueue();
View Full Code Here

          notesId.toString(), "attachment1.doc");
      List<NotesDocumentMock> doclist1 = dbConfigMock.getDocumentsByField(
          NCCONST.ITM_DOCID, expectedReplaceId);
      assertEquals("No delete request is created for replaced attachment", 1,
          doclist1.size());
      NotesDocument deleteReq = doclist1.get(0);
      assertEquals("Action is not equal delete", "delete",
          deleteReq.getItemValueString(NCCONST.ITM_ACTION));
      crawlDoc.replaceItemValue(NCCONST.ITM_GMETAATTACHMENTDOCIDS,
          attachmentNames);
      docMgr.addIndexedDocument(crawlDoc, conn);

      // Remove attachment
      String expectedRemoveId = String.format(NCCONST.SITM_ATTACHMENTDOCID,
          notesId.toString(), attachmentNames.get(0));
      attachmentNames.remove(0);
      crawlerThread.enqueue(notesId, attachmentNames);
      List<NotesDocumentMock> doclist2 =
          dbConfigMock.getDocumentsByField(NCCONST.ITM_DOCID, expectedRemoveId);
      assertEquals("No delete request is created for removed attachment", 1,
          doclist2.size());
      NotesDocument deleteReq2 = doclist2.get(0);
      assertEquals("Action is not equal delete", "delete",
          deleteReq2.getItemValueString(NCCONST.ITM_ACTION));
    } finally {
      docMgr.releaseDatabaseConnection(conn);
    }
  }
View Full Code Here

    try {
      NotesDatabase connectorDatabase = session.getDatabase(
          connectorSession.getServer(), connectorSession.getDatabase());
      NotesView databaseView = connectorDatabase.getView(
          NCCONST.VIEWDATABASES);
      NotesDocument databaseDocument = databaseView.getFirstDocument();
      while (databaseDocument != null) {
        String server =
            databaseDocument.getItemValueString(NCCONST.DITM_SERVER);
        String replicaId =
            databaseDocument.getItemValueString(NCCONST.DITM_REPLICAID);
        NotesDocId id = new NotesDocId();
        id.setHost(server + connectorSession.getDomain(server));
        id.setReplicaId(replicaId);
        String replicaUrl = id.getReplicaUrl();

        int count = 0;
        for (Document doc : documents) {
          String docid = getValue(doc, SpiConstants.PROPNAME_DOCID);
          if (docid.equals(replicaUrl + "/"
                  + NCCONST.DB_ACL_INHERIT_TYPE_ANDBOTH)) {
            count++;
            assertEquals(
                SpiConstants.AclInheritanceType.AND_BOTH_PERMIT.toString(),
                getValue(doc, SpiConstants.PROPNAME_ACLINHERITANCETYPE));
          } else if (docid.equals(replicaUrl + "/"
                  + NCCONST.DB_ACL_INHERIT_TYPE_PARENTOVERRIDES)) {
            count++;
            assertEquals(
                SpiConstants.AclInheritanceType.PARENT_OVERRIDES.toString(),
                getValue(doc, SpiConstants.PROPNAME_ACLINHERITANCETYPE));
          }
        }
        // TODO: sometimes we get multiple acl records on
        // repeated test runs. Fix the connector so that can't
        // happen.
        //assertEquals(replicaUrl, 2, count);
        assertTrue("Not enough database acls found for " + replicaUrl
            + "\n" + documents, 2 >= count);
        NotesDocument tmp = databaseDocument;
        databaseDocument = databaseView.getNextDocument(tmp);
        tmp.recycle();
      }
    } finally {
      connectorSession.closeNotesSession(session);
    }
  }
View Full Code Here

    assertTrue(databaseDocument.hasItem(NCCONST.NCITM_DBPERMITUSERS));
    assertTrue(databaseDocument.hasItem(NCCONST.NCITM_DBPERMITGROUPS));
    assertTrue(databaseDocument.hasItem(NCCONST.NCITM_DBNOACCESSUSERS));
    assertTrue(databaseDocument.hasItem(NCCONST.NCITM_DBNOACCESSGROUPS));

    NotesDocument aclCrawlDoc =
        getDocumentByUnid(connectorDatabase, "replica_id_16chr");
    if (supportsInheritedAcls) {
      assertNotNull(aclCrawlDoc);
      assertEquals("true",
          aclCrawlDoc.getItemValueString(NCCONST.NCITM_DBACL));
      assertEquals("http://testserver.testdomain/replica_id_16chr/"
          + NCCONST.DB_ACL_INHERIT_TYPE_ANDBOTH,
          aclCrawlDoc.getItemValueString(NCCONST.ITM_DOCID));
    } else {
      assertTrue(poller.calledUpdateGsaPolicyAcl);
      assertNull(aclCrawlDoc);
    }
  }
View Full Code Here

      notesDocManager.releaseDatabaseConnection(conn);
    }
  }
 
  public void testHasIndexedDocument() throws RepositoryException {
    NotesDocument doc = docs.get(NUM_OF_DOCS - 1);
    Connection conn = null;
    try {
      conn = notesDocManager.getDatabaseConnection();
      assertTrue(notesDocManager.hasIndexedDocument(
          doc.getItemValueString(NCCONST.NCITM_UNID),
          doc.getItemValueString(NCCONST.NCITM_REPLICAID),
          conn));
    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      if(conn != null)
View Full Code Here

    Map<String,NotesDocId> docIds =
        notesDocManager.getIndexedDocuments(null, null, NUM_OF_DOCS);
    assertEquals(NUM_OF_DOCS,docIds.size());
   
    //Get a collection equal to batch size which has the first expected unid
    NotesDocument doc = docs.get(NUM_OF_DOCS / 2);
    String unid = doc.getItemValueString(NCCONST.NCITM_UNID);
    String replicaid = doc.getItemValueString(NCCONST.NCITM_REPLICAID);
    docIds = notesDocManager.getIndexedDocuments(unid,
        replicaid, NUM_OF_DOCS/4);
    assertEquals(NUM_OF_DOCS/4, docIds.size());
   
    Set<String> keys = docIds.keySet();
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.notes.client.NotesDocument

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.