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

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


  private NotesDocumentMock createNotesDocument(String server, String replicaid,
      String unid, ActionType actionType) throws Exception {
    String docid = "http://" + server + "/" + replicaid + "/0/" + unid;
    NotesDocumentMock doc = new NotesDocumentMock();
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_ACTION, "type",
            NotesItem.TEXT, "values", actionType));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_DOCID, "type",
            NotesItem.TEXT, "values", docid));
    doc.addItem(new NotesItemMock("name", NCCONST.NCITM_REPLICAID,
            "type", NotesItem.TEXT, "values", replicaid));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_MIMETYPE,
            "type", NotesItem.TEXT, "values", "text/plain"));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_ISPUBLIC,
            "type", NotesItem.TEXT, "values", "false"));
    doc.addItem(new NotesItemMock("name", NCCONST.NCITM_DOCAUTHORREADERS,
            "type", NotesItem.READERS, "values", "[reader]"));
    doc.addItem(new NotesItemMock("name", NCCONST.NCITM_AUTHTYPE,
            "type", NotesItem.TEXT, "values", NCCONST.AUTH_ACL));

    doc.addItem(new NotesItemMock("name", NCCONST.ITM_TITLE,
            "type", NotesItem.TEXT, "values", "Test document with readers"));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_GMETADESCRIPTION,
            "type", NotesItem.TEXT, "values",
            "Test parent groups with [reader] role"));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_CONTENT,
            "type", NotesItem.TEXT, "values",
            "Test parent groups with [reader] role where [reader] is in the readers field"));

    doc.addItem(new NotesItemMock("name", NCCONST.ITM_GMETADATABASE,
            "type", NotesItem.TEXT, "values", "Database Title"));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_GMETACATEGORIES,
            "type", NotesItem.TEXT, "values", "Category 1"));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_GMETAREPLICASERVERS,
            "type", NotesItem.TEXT, "values", server));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_GMETANOTESLINK,
            "type", NotesItem.TEXT, "values",
            "notes://" + server + "/" + replicaid));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_GMETAWRITERNAME,
            "type", NotesItem.TEXT, "values", "Walt Disney"));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_GMETAFORM,
            "type", NotesItem.TEXT, "values", "Discussion"));

    Date d = new Date();
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_GMETALASTUPDATE,
            "type", NotesItem.TEXT, "values", d));
    doc.addItem(new NotesItemMock("name", NCCONST.ITM_GMETACREATEDATE,
            "type", NotesItem.TEXT, "values", d));
    return doc;
  }
View Full Code Here


        NotesDatabaseMock configDatabase = (NotesDatabaseMock) session
            .getDatabase(connectorSession.getServer(),
            connectorSession.getDatabase());

        NotesDocumentMock databaseDocument = new NotesDocumentMock();
        databaseDocument.addItem(new NotesItemMock("name", NCCONST.DITM_DBNAME,
            "type", NotesItem.TEXT, "values", "JediTrainingManuals.nsf"));
        databaseDocument.addItem(new NotesItemMock("name",
            NCCONST.DITM_REPLICAID, "type", NotesItem.TEXT,
            "values", "jtmreplicaid0123"));
        databaseDocument.addItem(new NotesItemMock("name", NCCONST.DITM_SERVER,
            "type", NotesItem.TEXT, "values", "JediServer"));
        configDatabase.addDocument(databaseDocument, NCCONST.VIEWDATABASES);
        databaseDocument = new NotesDocumentMock();
        databaseDocument.addItem(new NotesItemMock("name", NCCONST.DITM_DBNAME,
            "type", NotesItem.TEXT, "values", "SenateExpenseReports.nsf"));
        databaseDocument.addItem(new NotesItemMock("name",
            NCCONST.DITM_REPLICAID, "type", NotesItem.TEXT,
            "values", "serreplicaid0123"));
        databaseDocument.addItem(new NotesItemMock("name", NCCONST.DITM_SERVER,
            "type", NotesItem.TEXT, "values", "SenateServer"));
        configDatabase.addDocument(databaseDocument, NCCONST.VIEWDATABASES);
        databaseDocument = new NotesDocumentMock();
        databaseDocument.addItem(new NotesItemMock("name", NCCONST.DITM_DBNAME,
            "type", NotesItem.TEXT, "values", "EvilSeparatistPlots.nsf"));
        databaseDocument.addItem(new NotesItemMock("name",
            NCCONST.DITM_REPLICAID, "type", NotesItem.TEXT,
            "values", "espreplicaid0123"));
        databaseDocument.addItem(new NotesItemMock("name", NCCONST.DITM_SERVER,
            "type", NotesItem.TEXT, "values", "SenateServer"));
        configDatabase.addDocument(databaseDocument, NCCONST.VIEWDATABASES);

        NotesDatabaseMock notesDatabase = new NotesDatabaseMock(
            "JediServer", "JediTrainingManuals.nsf", "jtmreplicaid0123");
View Full Code Here

  // Used by other test classes.
  static NotesDocumentMock addNotesUser(NotesConnectorSession connectorSession,
      NotesDatabaseMock namesDatabase, String notesname, String gsaname)
      throws Exception {
    NotesDocumentMock notesPerson = new NotesDocumentMock();
    notesPerson.addItem(new NotesItemMock("name", "unid",
            "type", NotesItem.TEXT, "values", gsaname));
    notesPerson.addItem(new NotesItemMock("name", NCCONST.NCITM_UNID,
            "type", NotesItem.TEXT, "values", gsaname));
    notesPerson.addItem(new NotesItemMock("name", NCCONST.PITM_FULLNAME,
            "type", NotesItem.TEXT, "values", notesname));
    notesPerson.addItem(new NotesItemMock("name", "HTTPPassword",
            "type", NotesItem.TEXT, "values", "password"));
    notesPerson.addItem(new NotesItemMock("name", NCCONST.ITMFORM,
            "type", NotesItem.TEXT, "values", NCCONST.DIRFORM_PERSON));
    notesPerson.addItem(new NotesItemMock("name",
            "evaluate_" + connectorSession.getUserNameFormula(),
            "type", NotesItem.TEXT, "values", gsaname));
    notesPerson.addItem(new NotesItemMock("name",
            "evaluate_" + connectorSession.getUserSelectionFormula(),
            "type", NotesItem.TEXT, "values", 1.0));
    namesDatabase.addDocument(notesPerson, NCCONST.DIRVIEW_USERS,
        NCCONST.DIRVIEW_PEOPLEGROUPFLAT, NCCONST.DIRVIEW_SERVERACCESS,
        NCCONST.DIRVIEW_VIMUSERS, "notesnamelookup");
View Full Code Here

  static NotesDocumentMock addNotesGroup(
      NotesDatabaseMock namesDatabase, String groupName,
      String... members) throws Exception {
    NotesDocumentMock notesGroup = new NotesDocumentMock();
    notesGroup.addItem(new NotesItemMock("name", "unid",
            "type", NotesItem.TEXT, "values", groupName));
    notesGroup.addItem(new NotesItemMock("name", NCCONST.NCITM_UNID,
            "type", NotesItem.TEXT, "values", groupName));
    notesGroup.addItem(new NotesItemMock("name", NCCONST.GITM_LISTNAME,
            "type", NotesItem.TEXT, "values", groupName));
    notesGroup.addItem(new NotesItemMock("name", NCCONST.ITMFORM,
            "type", NotesItem.TEXT, "values", NCCONST.DIRFORM_GROUP));
    notesGroup.addItem(new NotesItemMock("name", NCCONST.GITM_GROUPTYPE,
            "type", NotesItem.TEXT, "values",
            NCCONST.DIR_ACCESSCONTROLGROUPTYPES));
    if (members != null && members.length > 0) {
      notesGroup.addItem(new NotesItemMock("name", NCCONST.GITM_MEMBERS,
              "type", NotesItem.TEXT, "values", members));
    }
    namesDatabase.addDocument(notesGroup,
        NCCONST.DIRVIEW_PEOPLEGROUPFLAT, NCCONST.DIRVIEW_SERVERACCESS,
        NCCONST.DIRVIEW_VIMGROUPS, "grouplookup");
View Full Code Here

      // Change the result of the user selection formula. Call
      // checkUserDeletions and verify that the user was removed
      // from the user cache.
      doc.replaceItemValue(
          "evaluate_" + connectorSession.getUserSelectionFormula(),
          new NotesItemMock("name",
              "evaluate_" + connectorSession.getUserSelectionFormula(),
              "type", NotesItem.TEXT, "values", 0.0));

      userGroupManager.checkUserDeletions();
      getGroupData();
      getUserData();
      assertUserDoesNotExist("anakin");
      assertNull("user still has groups", userGroups.get(id));
    } finally {
      doc.replaceItemValue(
          "evaluate_" + connectorSession.getUserSelectionFormula(),
          new NotesItemMock("name",
              "evaluate_" + connectorSession.getUserSelectionFormula(),
              "type", NotesItem.TEXT, "values", 1.0));
    }
  }
View Full Code Here

      assertUserDoesNotExist("ben");

      // Change the user name.
      doc.replaceItemValue(
          "evaluate_" + connectorSession.getUserNameFormula(),
          new NotesItemMock("name",
            "evaluate_" + connectorSession.getUserNameFormula(),
            "type", NotesItem.TEXT, "values", "ben"));

      setUpRoles();
      assertUserExists("ben");
      assertUserDoesNotExist("kenobi");
    } finally {
      doc.replaceItemValue(
          "evaluate_" + connectorSession.getUserNameFormula(),
          new NotesItemMock("name",
            "evaluate_" + connectorSession.getUserNameFormula(),
            "type", NotesItem.TEXT, "values", "kenobi"));
    }
  }
View Full Code Here

      }
    };
  }

  private static NotesItemMock getTextItem(String name, String... values) {
    return new NotesItemMock("name", name, "type", NotesItem.TEXT, "values",
        values);
  }
View Full Code Here

  public void testDatabaseWildcardAccess() throws Exception {
    // TODO: create the database document using
    // NotesDatabasePoller.getPermitDeny instead of manually
    // recreating the data.
    hogwartsDatabaseDocument.addItem(new NotesItemMock("name",
        NCCONST.NCITM_DBPERMITGROUPS, "type", NotesItem.TEXT, "values",
        "*/o=Hogwarts/c=UK"));
    hasDatabaseAccess(hogwartsDatabaseDocument, true, "harry", "hermione",
        "ron", "luna", "cho", "draco", "cedric", "albusdumbledore");
    hasDatabaseAccess(hogwartsDatabaseDocument, false, "arthur", "fleur",
View Full Code Here

  public void testDatabaseGroupAccess() throws Exception {
    // TODO: create the database document using
    // NotesDatabasePoller.getPermitDeny instead of manually
    // recreating the data.
    hogwartsDatabaseDocument.addItem(new NotesItemMock("name",
        NCCONST.NCITM_DBPERMITGROUPS, "type", NotesItem.TEXT, "values",
        "Gryffindor_Group"));
    hasDatabaseAccess(hogwartsDatabaseDocument, true, "harry", "hermione",
        "ron");
    hasDatabaseAccess(hogwartsDatabaseDocument, false, "fleur", "viktor");
View Full Code Here

    // NotesDatabasePoller.getPermitDeny instead of manually
    // recreating the data.
   
    // The Gryffindor_Group group is nested inside the
    // parent_group; therefore, all members should be mapped to parent_group.
    hogwartsDatabaseDocument.addItem(new NotesItemMock("name",
        NCCONST.NCITM_DBPERMITGROUPS, "type", NotesItem.TEXT, "values",
        "parent_group"));
    hasDatabaseAccess(hogwartsDatabaseDocument, true, "harry", "hermione",
        "ron");
    hasDatabaseAccess(hogwartsDatabaseDocument, false, "fleur", "viktor");
   
    // Since nested_group group is nested inside Gryffindor_Group group, all
    // members should not be mapped to nested_group
    hogwartsDatabaseDocument.addItem(new NotesItemMock("name",
        NCCONST.NCITM_DBPERMITGROUPS, "type", NotesItem.TEXT, "values",
        "nested_group"));
    hasDatabaseAccess(hogwartsDatabaseDocument, false, "harry", "hermione",
        "ron");
  }
View Full Code Here

TOP

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

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.