Examples of OwnerAccessContext


Examples of gabriel.components.context.OwnerAccessContext

  public Object intercept(Invocation invocation) throws Throwable {
    Object result;

    Ownable ownable = (Ownable) invocation.getProxy();
    AccessContext context = new OwnerAccessContext(ownable);

    Set principals = Subject.get().getPrincipals();

    String className = invocation.getMethod().getDeclaringClass().getName();
    String methodName = invocation.getMethod().getName();
View Full Code Here

Examples of gabriel.components.context.OwnerAccessContext

  public void testDoNotModifyPrincipalsIfNotOwner() {
    Mock ownable = mock(Ownable.class);
    ownable.expects(once()).method("getOwner").will(returnValue(new Principal("NotOwner")));

    AccessContext context = new OwnerAccessContext((Ownable) ownable.proxy());
    Set principals = new HashSet();
    principals.add(new Principal("TestOwner"));
    context.modifyPrincipals(principals);
    assertTrue("Owner principal was not added to list.",
        !principals.contains(new Principal("Owner")));
  }
View Full Code Here

Examples of gabriel.components.context.OwnerAccessContext

  public void testModifyPrincipalsIfOwner() {
    Mock ownable = mock(Ownable.class);
    ownable.expects(once()).method("getOwner").will(returnValue(new Principal("TestOwner")));


    AccessContext context = new OwnerAccessContext((Ownable) ownable.proxy());
    Set principals = new HashSet();
    principals.add(new Principal("TestOwner"));
    context.modifyPrincipals(principals);
    assertTrue("Owner principal was added to list.",
        principals.contains(new Principal("Owner")));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.