Package org.apache.wicket.security.hive.authorization

Examples of org.apache.wicket.security.hive.authorization.TestPermission


    Hive hive = factory.createHive();
    assertTrue(hive.containsPrincipal(new EverybodyPrincipal()));
    assertTrue(hive.containsPrincipal(new SimplePrincipal("test1")));
    assertTrue(hive.containsPrincipal(new SimplePrincipal("test2")));
    assertTrue(hive.containsPrincipal(new SimplePrincipal("test6")));
    assertTrue(hive.containsPermission(new TestPermission("A", "inherit, render")));
    assertTrue(hive.containsPermission(new TestPermission("A", "enable")));
    assertTrue(hive.containsPermission(new TestPermission("1.A", "inherit, render")));
    assertTrue(hive.containsPermission(new TestPermission("1.A", "enable")));
    assertFalse(hive.containsPermission(new TestPermission("2.A", "inherit, render")));
    assertFalse(hive.containsPermission(new TestPermission("2.A", "enable")));
    assertTrue(hive.containsPermission(new TestPermission("2.B", "inherit, render, enable")));
    assertTrue(hive.containsPermission(new TestPermission("2.B", "enable")));
    assertTrue(hive.containsPermission(new TestPermission("2.C", "render, enable")));
    assertTrue(hive.containsPermission(new TestPermission("2.C.1", "enable")));
    assertTrue(hive.containsPermission(new TestPermission("7.A", "inherit, render")));
    assertTrue(hive.containsPermission(new TestPermission("7.A", "enable")));
    assertTrue(hive.containsPermission(new TestPermission("7.B", "inherit, render, enable")));
    assertTrue(hive.containsPermission(new TestPermission("7.B", "enable")));
    assertTrue(hive.containsPermission(new TestPermission("7.C", "render, enable")));
    assertTrue(hive.containsPermission(new TestPermission("7.C.1", "enable")));
    assertFalse(hive.containsPermission(new TestPermission("6.A", "inherit, render")));
    assertFalse(hive.containsPermission(new TestPermission("6.A", "enable")));
    assertFalse(hive.containsPermission(new TestPermission("6.B", "inherit, render, enable")));
    assertFalse(hive.containsPermission(new TestPermission("6.B", "enable")));
    assertFalse(hive.containsPermission(new TestPermission("6.C", "render, enable")));
    assertFalse(hive.containsPermission(new TestPermission("6.C.1", "enable")));
    assertTrue(hive.containsPrincipal(new SimplePrincipal("test8")));
    assertTrue(hive.containsPermission(new TestPermission("8.A")));
    assertTrue(hive.containsPermission(new TestPermission("8.B")));
    assertFalse(hive.containsPermission(new FaultyPermission()));
    assertTrue(hive.containsPrincipal(new SimplePrincipal("test9")));
    assertTrue(hive.containsPermission(new TestPermission("9.A")));
    assertTrue(hive.containsPermission(new TestPermission("9.B", "test")));
    assertTrue(hive.containsPrincipal(new SimplePrincipal("test9B")));
    assertTrue(hive.containsPermission(new TestPermission(
      "test.ContainerPage2:test.ContainerPage2$SecureMarkupContainer", "inherit, render")));
    assertTrue(hive.containsPermission(new TestPermission(
      "test2.ContainerPage2:test.ContainerPage2$SecureMarkupContainer", "inherit, render")));
    assertTrue(hive.containsPrincipal(new SimplePrincipal("test10")));
    assertTrue(hive.containsPermission(new TestPermission("10.B")));
  }
View Full Code Here


    {
      assertNotNull(e);
    }
    assertFalse(hive.containsPrincipal(new EverybodyPrincipal()));
    List<Permission> permissions = new ArrayList<Permission>();
    permissions.add(new TestPermission("foo.bar"));
    permissions.add(new TestPermission("test"));
    hive.addPrincipal(new EverybodyPrincipal(), permissions);
    assertTrue(hive.containsPrincipal(new EverybodyPrincipal()));
    assertFalse(hive.isLocked());
    hive.lock();
    assertTrue(hive.isLocked());
View Full Code Here

    catch (IllegalArgumentException e)
    {
      assertNotNull(e);
    }
    assertFalse(hive.containsPrincipal(new EverybodyPrincipal()));
    hive.addPermission(new EverybodyPrincipal(), new TestPermission("foobar"));
    assertTrue(hive.containsPrincipal(new EverybodyPrincipal()));
    assertFalse(hive.isLocked());
    hive.lock();
    assertTrue(hive.isLocked());
    try
    {
      hive.addPermission(new EverybodyPrincipal(), new TestPermission("foobar"));
      fail("hive should be locked");
    }
    catch (IllegalStateException e)
    {
    }
View Full Code Here

   */
  public void testHasPermision()
  {
    BasicHive hive = new BasicHive();
    assertFalse(hive.containsPrincipal(new EverybodyPrincipal()));
    hive.addPermission(new EverybodyPrincipal(), new TestPermission("foobar"));
    assertTrue(hive.containsPrincipal(new EverybodyPrincipal()));
    assertTrue(hive.hasPermission(null, new TestPermission("foobar")));
    assertFalse(hive.hasPermission(null, new TestPermission("foo.bar")));

    hive.addPermission(new EverybodyPrincipal(), new TestPermission("test", "read, write"));
    assertTrue(hive.hasPermission(null, new TestPermission("test", "read")));
    assertTrue(hive.hasPermission(null, new TestPermission("test")));
  }
View Full Code Here

   * @see BasicHive#getPrincipals(org.apache.wicket.security.hive.authorization.Permission)
   */
  public void testGetPrincipals()
  {
    BasicHive hive = new BasicHive();
    hive.addPermission(new EverybodyPrincipal(), new TestPermission("foobar"));
    hive.addPermission(new SimplePrincipal("foo.bar"), new TestPermission("foobar"));
    hive.addPermission(new EverybodyPrincipal(), new TestPermission("test", "read, write"));
    assertEquals(Collections.EMPTY_SET, hive.getPrincipals(new TestPermission("foo")));
    Set<Principal> principals = hive.getPrincipals(new TestPermission("foobar"));
    assertEquals(2, principals.size());
    assertTrue(principals.contains(new EverybodyPrincipal()));
    assertTrue(principals.contains(new SimplePrincipal("foo.bar")));
    principals = hive.getPrincipals(new TestPermission("test", "read, write"));
    assertEquals(1, principals.size());
    assertTrue(principals.contains(new EverybodyPrincipal()));

  }
View Full Code Here

   * @see BasicHive#getPermissions(org.apache.wicket.security.hive.authorization.Principal)
   */
  public void testGetPermissions()
  {
    BasicHive hive = new BasicHive();
    hive.addPermission(new EverybodyPrincipal(), new TestPermission("foobar"));
    hive.addPermission(new SimplePrincipal("foo.bar"), new TestPermission("foobar"));
    hive.addPermission(new EverybodyPrincipal(), new TestPermission("test", "read, write"));
    assertEquals(Collections.EMPTY_SET, hive.getPermissions(new SimplePrincipal("foobar")));
    Set<Permission> permissions = hive.getPermissions(new EverybodyPrincipal());
    assertEquals(2, permissions.size());
    assertTrue(permissions.contains(new TestPermission("foobar")));
    assertTrue(permissions.contains(new TestPermission("test", "read, write")));
    permissions = hive.getPermissions(new SimplePrincipal("foo.bar"));
    assertEquals(1, permissions.size());
    assertTrue(permissions.contains(new TestPermission("foobar")));

  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.security.hive.authorization.TestPermission

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.