Package gabriel

Examples of gabriel.Principal


    assertTrue("AclEntry says true to remove.", acl.removeEntry(owner, entry));
    assertTrue("Acl does not contain removed entry.", !acl.entries().contains(entry));
  }

  public void testRemoveEntryWithWrongOwner() {
    Principal principal = new Principal("TestPrincipal");
    AclEntry entry = new AclEntry(principal);
    acl.addEntry(owner, entry);
    try {
      acl.removeEntry(new Principal("Owner"), entry);
      fail("Should raise an SecurityException");
    } catch (SecurityException e) {
    }
  }
View Full Code Here


    } catch (SecurityException e) {
    }
  }

  public void testSetNewOwner() {
    Principal newOwner = new Principal("NewOwner");
    acl.setOwner(owner, newOwner);
    assertTrue("New owner is now owner.", acl.isOwner(newOwner));
  }
View Full Code Here

    acl.setOwner(owner, newOwner);
    assertTrue("New owner is now owner.", acl.isOwner(newOwner));
  }

  public void testSetNewOwnerWithWrongOwner() {
    Principal newOwner = new Principal("NewOwner");
    try {
      acl.setOwner(new Principal("WrongOwner"), newOwner);
      fail("Should raise an SecurityException");
    } catch (SecurityException e) {
    }
  }
View Full Code Here

    }
  }

  public void testCheckPermission() {
    Permission permission = new Permission("TestPermission");
    Principal principal = new Principal("TestPrincipal");
    AclEntry entry = new AclEntry(principal);
    entry.addPermission(permission);
    acl.addEntry(owner, entry);

    Principal checkPrincipal = new Principal("TestPrincipal");
    Permission checkPermission = new Permission("TestPermission");
    assertEquals("Principal has permission from entry", 1, acl.checkPermission(checkPrincipal, checkPermission));
  }
View Full Code Here

    assertEquals("Principal has permission from entry", 1, acl.checkPermission(checkPrincipal, checkPermission));
  }

  public void testNegativePermsissionCancelsPermission() {
    Permission permission = new Permission("TestPermission");
    Principal principal = new Principal("TestPrincipal");
    AclEntry entry = new AclEntry(principal);
    entry.addPermission(permission);
    acl.addEntry(owner, entry);

    AclEntry negativeEntry = new AclEntry(principal);
    negativeEntry.addPermission(permission);
    negativeEntry.setNegativePermissions();
    acl.addEntry(owner, negativeEntry);

    Principal checkPrincipal = new Principal("TestPrincipal");
    Permission checkPermission = new Permission("TestPermission");
    assertEquals("Principal does not have permission because of negative entry", -1, acl.checkPermission(checkPrincipal, checkPermission));
  }
View Full Code Here

TOP

Related Classes of gabriel.Principal

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.