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

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


  public void testUserDeletions() throws Exception {
    setUpRoles();

    // Find the Notes doc for the user to be deleted. Use a
    // user with a role.
    NotesView nameView = namesDatabase.getView("notesnamelookup");
    NotesDocumentMock doc = (NotesDocumentMock) nameView.getDocumentByKey(
        "cn=Yoda/ou=Tests/o=Tests");
    assertNotNull("No yoda", doc);
    try {
      Long id = assertUserExists("yoda");
      assertUserHasGroup("yoda", "jedi");
View Full Code Here


    userGroupManager.updateGroups(groupUnids);
    userGroupManager.updateUsers(userUnids);

    // Find the Notes doc for the group to be deleted.
    // Use a group with children.
    NotesView nameView = namesDatabase.getView("grouplookup");
    NotesDocumentMock doc = (NotesDocumentMock) nameView.getDocumentByKey(
        "jedi");
    assertNotNull("No jedi", doc);

    // Test group with canonical name
    NotesDocumentMock doc2 = (NotesDocumentMock) nameView.getDocumentByKey(
        "cn=west coast/ou=west/o=test");
    assertNotNull("cn=west coast/ou=west/o=test", doc2);

    try {
      // Get the current user/group data and verify that the group is there.
View Full Code Here

  public void testUserNoLongerSelected() throws Exception {
    userGroupManager.updateGroups(groupUnids);
    userGroupManager.updateUsers(userUnids);

    // Find the Notes doc for the user to be deleted.
    NotesView nameView = namesDatabase.getView("notesnamelookup");
    NotesDocumentMock doc = (NotesDocumentMock) nameView.getDocumentByKey(
        "cn=Anakin Skywalker/ou=Tests/o=Tests");
    assertNotNull("No anakin", doc);
    try {
      // Get the current user/group data and verify that the user is there.
      getGroupData();
View Full Code Here

  public void testChangeUserGsaName() throws Exception {
    setUpRoles();

    // Find the Notes doc for the user to be changed.
    NotesView nameView = namesDatabase.getView("notesnamelookup");
    NotesDocumentMock doc = (NotesDocumentMock) nameView.getDocumentByKey(
        "cn=Obi-Wan Kenobi/ou=Tests/o=Tests");
    assertNotNull("No kenobi", doc);
    try {
      assertUserExists("kenobi");
      assertUserDoesNotExist("ben");
View Full Code Here

    NotesConnectorSession connectorSession =
        (NotesConnectorSession) connector.login();
    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

    NotesConnector nc = createNiceMock(NotesConnector.class);
    NotesConnectorSession ncs = createNiceMock(NotesConnectorSession.class);
    NotesSession ns = createMock(NotesSession.class);
    NotesDatabase cdb = createNiceMock(NotesDatabase.class);
    NotesView crawlQ = createNiceMock(NotesView.class);
    expect(ncs.getServer()).andReturn("domino1");
    expect(ncs.getDatabase()).andReturn("gsaconfig.nsf");
    expect(ncs.getSpoolDir()).andReturn("spooldir");
    expect(ncs.createNotesSession()).andReturn(ns);
    expect(ns.getDatabase(isA(String.class), isA(String.class))).andReturn(cdb);
View Full Code Here

      // Give the worker threads a chance to pre-fetch documents
      Thread.sleep(2000);

      // Get list of pre-fetched documents and put these in the doclist
      NotesView submitQ = cdb.getView(NCCONST.VIEWSUBMITQ);
      NotesViewNavigator submitQNav = submitQ.createViewNav();
      NotesViewEntry ve = submitQNav.getFirst();
      int batchSize = 0;
      while (( ve != null) && (batchSize < batchHint)) {
        batchSize++;
        String unid = ve.getColumnValues().elementAt(1).toString();
        LOGGER.logp(Level.FINEST, CLASS_NAME, METHOD,
            "Adding document to list: " + unid);
        unidList.add(unid);
        NotesViewEntry prevVe = ve;
        ve = submitQNav.getNext(prevVe);
        prevVe.recycle();
      }
      submitQNav.recycle();
      submitQ.recycle();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      ncs.closeNotesSession(ns);
      ns = null;
View Full Code Here

    NotesSession session = connectorSession.createNotesSession();
    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

    return srcDb;
  }

  public static NotesDocumentMock getSrcDbDocument(NotesDatabaseMock configDb,
      NotesDatabaseMock srcDb) throws RepositoryException {
    NotesView vwSrcDbs = configDb.getView(NCCONST.VIEWDATABASES);
    NotesDocumentMock doc = (NotesDocumentMock) vwSrcDbs.getFirstDocument();
    while (doc != null) {
      if (srcDb.getReplicaID().equals(
          doc.getItemValueString(NCCONST.DITM_REPLICAID))) {
        return doc;
      }
      doc = (NotesDocumentMock) vwSrcDbs.getNextDocument(doc);
    }
    return null;
  }
View Full Code Here

        NotesSession ns = null;
        try {
          ns = ncs.createNotesSession();
          NotesDatabase cdb =
              ns.getDatabase(ncs.getServer(), ncs.getDatabase());
          NotesView securityView = cdb.getView(NCCONST.VIEWSECURITY);
          for (String docId : docIds) {
            NotesViewNavigator secVN = null;
            NotesDocument dbdoc = null;
            try {
              // Extract the database and UNID from the URL
              String repId = getRepIdFromDocId(docId);
              String unid = getUNIDFromDocId(docId);
              LOGGER.logp(Level.FINER, CLASS_NAME, METHOD,
                  "Authorizing document: " + repId + " : " + unid);

              // Get the category from the security view for this
              // database. The first document in the category is
              // ALWAYS the database document.
              secVN = securityView.createViewNavFromCategory(repId);
              dbdoc = secVN.getFirstDocument().getDocument();
              boolean dballow =
                  checkDatabaseAccess(dbdoc, user);

              // Only check document level security if we are
View Full Code Here

TOP

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

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.