Package org.aopalliance.intercept

Examples of org.aopalliance.intercept.MethodInvocation


    }

    //~ Methods ========================================================================================================

    public boolean matches(Method m, Class targetClass) {
        MethodInvocation methodInvocation = new InternalMethodInvocation(m);

        return (this.transactionAttributeSource.getAttributes(methodInvocation) != null);
    }
View Full Code Here


                    logger.debug("Adding " + userLabel + " to <<<" + authentication.getName()
                        + "'s>>> authorized label list");
                }
            }

            MethodInvocation invocation = (MethodInvocation) object;

            int matches = 0;
            int misses = 0;
            int labeledArguments = 0;

            for (int j = 0; j < invocation.getArguments().length; j++) {
                if (invocation.getArguments()[j] instanceof LabeledData) {
                    labeledArguments++;

                    boolean matched = false;

                    String argumentDataLabel = ((LabeledData) invocation.getArguments()[j]).getLabel();
                    logger.debug("Argument[" + j + "/" + invocation.getArguments()[j].getClass().getName()
                        + "] has a data label of " + argumentDataLabel);

                    List validDataLabels = new Vector();

                    for (int i = 0; i < userLabels.size(); i++) {
View Full Code Here

    protected Object getDomainObjectInstance(Object secureObject) {
        Object[] args;
        Class[] params;

        if (secureObject instanceof MethodInvocation) {
            MethodInvocation invocation = (MethodInvocation) secureObject;
            params = invocation.getMethod().getParameterTypes();
            args = invocation.getArguments();
        } else {
            JoinPoint jp = (JoinPoint) secureObject;
            params = ((CodeSignature) jp.getStaticPart().getSignature()).getParameterTypes();
            args = jp.getArgs();
        }
View Full Code Here

        capturedAndNamedToo,
        capturedInteger,
        notCapturedInteger
    };

    MethodInvocation methodInvocation =
        mockMethodInvocation(scopedMethod, methodArguments);

    mocks.replayAll();
    BindingFrame bindingFrame = new BindingFrame();
View Full Code Here

  public void testScopedMethodThrowsException() throws Throwable {
    Method scopedMethod =
        getClass().getMethod("simpleScopedMethod", String.class);
    Object[] methodArguments = { "simpleScopedMethodArgument" };

    MethodInvocation methodInvocation =
        mocks.createMock(MethodInvocation.class);
    expect(methodInvocation.getMethod()).andStubReturn(scopedMethod);
    expect(methodInvocation.getArguments()).andStubReturn(methodArguments);
    expect(methodInvocation.proceed()).andThrow(new RuntimeException());

    mocks.replayAll();
    BindingFrame bindingFrame = new BindingFrame();

    nestedScopeInterceptor.scopeMethodArguments(methodInvocation, bindingFrame);
View Full Code Here

        String.class,
        String.class);

    Object[] methodArguments = { "captured1", "captured2" };

    MethodInvocation methodInvocation =
        mockMethodInvocation(illegallyScopedMethod, methodArguments);

    mocks.replayAll();
    BindingFrame bindingFrame = new BindingFrame();
View Full Code Here

    Method notAnnotatedMethod = getClass().getMethod(
        "notAnnotatedMethod", String.class);

    Object[] methodArguments = { "captured1" };

    MethodInvocation methodInvocation =
        mockMethodInvocation(notAnnotatedMethod, methodArguments);

    mocks.replayAll();
    BindingFrame bindingFrame = new BindingFrame();
View Full Code Here

    Method tooManyAnnotationsMethod = getClass().getMethod(
        "tooManyBindingAnnotations", String.class);

    Object[] methodArguments = { "captured1" };

    MethodInvocation methodInvocation =
        mockMethodInvocation(tooManyAnnotationsMethod, methodArguments);

    mocks.replayAll();
    BindingFrame bindingFrame = new BindingFrame();
View Full Code Here

   * Uses the given {@link Method} and array of arguments to create a mock
   * {@link MethodInvocation}.
   */
  private MethodInvocation mockMethodInvocation(
      Method method, Object[] methodArguments) {
    MethodInvocation methodInvocation =
        mocks.createMock(MethodInvocation.class);
    expect(methodInvocation.getMethod()).andStubReturn(method);
    expect(methodInvocation.getArguments()).andStubReturn(methodArguments);
    return methodInvocation;
  }
View Full Code Here

public class FinderIntroductionInterceptorTest {
  private final Mockery mockery = new Mockery();
  private final FinderExecutor executor = mockery.mock(FinderExecutor.class);

  private MethodInvocation createMI(final Class<?> klass, final Object[] args, final Object obj) {
    return new MethodInvocation() {

      public Method getMethod() {
        return klass.getDeclaredMethods()[0];
      }
View Full Code Here

TOP

Related Classes of org.aopalliance.intercept.MethodInvocation

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.