Package com.google.enterprise.connector.filenet4.filewrap

Examples of com.google.enterprise.connector.filenet4.filewrap.IDocument


  }

  private void testAccess(AccessType accessType, int accessRights,
      SecurityPrincipalType granteeType, String granteeName, IUser testUser,
      boolean expectedResult) {
    AccessPermissionMock perm =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    perm.set_AccessType(accessType);
    perm.set_AccessMask(accessRights);
    perm.set_GranteeType(granteeType);
    perm.set_GranteeName(granteeName);
    perms.add(perm);

    Permissions testPerms = new Permissions(perms);
    assertEquals(expectedResult, testPerms.authorize(testUser));
  }
View Full Code Here


  public void testUserGroupAccess_HavingBothAllowAndDeny() {
    Set<String> userGroups = user.getGroupNames();
    assertTrue(userGroups.contains("administrators@" + TestConnection.domain));

    AccessPermissionMock permAllow =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    permAllow.set_AccessType(AccessType.ALLOW);
    permAllow.set_AccessMask(VIEW_ACCESS_RIGHTS);
    permAllow.set_GranteeType(SecurityPrincipalType.USER);
    permAllow.set_GranteeName(user.get_Name());
    perms.add(permAllow);

    AccessPermissionMock permDeny =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    permDeny.set_AccessType(AccessType.DENY);
    permDeny.set_AccessMask(VIEW_ACCESS_RIGHTS);
    permDeny.set_GranteeType(SecurityPrincipalType.GROUP);
    permDeny.set_GranteeName("administrators@" + TestConnection.domain);
    perms.add(permDeny);

    Permissions testPermsDenyGroup = new Permissions(perms);
    assertFalse(testPermsDenyGroup.authorize(user));
  }
View Full Code Here

  }

  private void addAce(PermissionSource permSrc,
      SecurityPrincipalType secPrincipalType, AccessType accessType,
      int accessMask, int inheritableDepth, String ace) {
    AccessPermissionMock perm = new AccessPermissionMock(permSrc);
    perm.set_GranteeType(secPrincipalType);
    perm.set_AccessType(accessType);
    perm.set_AccessMask(accessMask);
    perm.set_InheritableDepth(inheritableDepth);
    perm.set_GranteeName(ace);
    perms.add(perm);
  }
View Full Code Here

  }

  private void testMarking(AccessType accessType, int accessMask,
      SecurityPrincipalType secType, String granteeName, IUser testUser,
      boolean expectedResult, int constraintMask) {
    AccessPermissionMock perm1 =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    perm1.set_AccessType(accessType);
    perm1.set_AccessMask(accessMask);
    perm1.set_GranteeType(secType);
    perm1.set_GranteeName(granteeName);
    perms.add(perm1);

    Permissions testPerms = new Permissions(perms);
    assertEquals(expectedResult, testPerms.authorizeMarking(testUser,
        constraintMask));
View Full Code Here

  }

  public void testMarking_NoUseRight_HavingBothAllowAndDeny() {
    IUser user1 = MockUtil.createUserWithDomain("user1", "foo.example.com");

    AccessPermissionMock perm1 =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    perm1.set_AccessType(AccessType.ALLOW);
    perm1.set_AccessMask(AccessRight.NONE_AS_INT);
    perm1.set_GranteeType(SecurityPrincipalType.USER);
    perm1.set_GranteeName(user1.get_Name());
    perms.add(perm1);

    // The access mask can be set to any value for DENY as it does not have any
    // effects.
    AccessPermissionMock perm2 =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    perm2.set_AccessType(AccessType.DENY);
    perm2.set_AccessMask(VIEW_ACCESS_RIGHTS);
    perm2.set_GranteeType(SecurityPrincipalType.USER);
    perm2.set_GranteeName(user1.get_Name());
    perms.add(perm2);

    Permissions testPerms = new Permissions(perms);
    assertEquals(true, testPerms.authorizeMarking(user1,
        constraintMask(AccessRight.VIEW_CONTENT, AccessRight.READ)));
View Full Code Here

  }

  public void testMarking_HavingBothAllowAndDenyUseRights() {
    IUser user1 = MockUtil.createUserWithDomain("user1", "foo.example.com");

    AccessPermissionMock allowUse =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    allowUse.set_AccessType(AccessType.ALLOW);
    allowUse.set_AccessMask(AccessRight.USE_MARKING_AS_INT);
    allowUse.set_GranteeType(SecurityPrincipalType.USER);
    allowUse.set_GranteeName(user1.get_Name());
    perms.add(allowUse);

    AccessPermissionMock denyUse =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    denyUse.set_AccessType(AccessType.DENY);
    denyUse.set_AccessMask(AccessRight.USE_MARKING_AS_INT);
    denyUse.set_GranteeType(SecurityPrincipalType.USER);
    denyUse.set_GranteeName(user1.get_Name());
    perms.add(denyUse);

    Permissions testPerms = new Permissions(perms);
    assertEquals(false, testPerms.authorizeMarking(user1,
        constraintMask(AccessRight.NONE_AS_INT)));
View Full Code Here

    @Override public boolean hasMarkings() { return false; }

    @Override public IUser getUser(AuthenticationIdentity identity) {
      String username = identity.getUsername();
      return new FileUserMock(username, username, username, username,
          ImmutableMap.<String, Group>of());
    }
View Full Code Here

  public static IBaseObject newBaseObject(String guid, String timeStr,
      boolean isReleasedVersion, AccessPermissionList perms)
          throws ParseException, RepositoryException {
    Date createdTime = dateFormatter.parse(timeStr);
    return new MockBaseObject(new FnId(guid), new FnId(guid), createdTime,
        false, isReleasedVersion, perms);
  }
View Full Code Here

  private IBaseObject createObject(String guid, String timeStr,
      boolean isDeletionEvent, boolean isReleasedVersion)
          throws ParseException, RepositoryDocumentException {
    Date createdTime = dateFormatter.parse(timeStr);
    Id id = new Id(guid);
    return new MockBaseObject(new FnId(id), new FnId(id),
        createdTime, isDeletionEvent, isReleasedVersion);
  }
View Full Code Here

    testSorting(new int[]{0, 1, 3, 4, 2, 6, 5}, entries, DatabaseType.MSSQL);
  }

  private void testSorting(int[] expectedOrder, String[][] entries,
      DatabaseType dbType) throws Exception {
    MockObjectStore os = new MockObjectStore("objectstore", dbType,
        generateObjectMap(entries, false, true));
    DocumentList docList =
        getObjectUnderTest(os, getDocuments(os.getObjects()),
            getCustomDeletion(os.getObjects()),
            getDeletionEvents(os.getObjects()));

    // Test the order
    for (int index : expectedOrder) {
      Document doc = docList.nextDocument();
      Property fid = doc.findProperty(SpiConstants.PROPNAME_DOCID);
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.filenet4.filewrap.IDocument

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.