Package gabriel.components.context

Examples of gabriel.components.context.AccessContext


  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


  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

  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

Related Classes of gabriel.components.context.AccessContext

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.