Package org.aspectj.lang

Examples of org.aspectj.lang.ProceedingJoinPoint


  public Object invoke(MethodInvocation mi) throws Throwable {
    if (!(mi instanceof ProxyMethodInvocation)) {
      throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
    }
    ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi;
    ProceedingJoinPoint pjp = lazyGetProceedingJoinPoint(pmi);
    JoinPointMatch jpm = getJoinPointMatch(pmi);
    return invokeAdviceMethod(pjp, jpm, null, null);
  }
View Full Code Here


  public Object invoke(MethodInvocation mi) throws Throwable {
    if (!(mi instanceof ProxyMethodInvocation)) {
      throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
    }
    ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi;
    ProceedingJoinPoint pjp = lazyGetProceedingJoinPoint(pmi);
    JoinPointMatch jpm = getJoinPointMatch(pmi);
    return invokeAdviceMethod(pjp, jpm, null, null);
  }
View Full Code Here

  public Object invoke(MethodInvocation mi) throws Throwable {
    if (!(mi instanceof ProxyMethodInvocation)) {
      throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
    }
    ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi;
    ProceedingJoinPoint pjp = lazyGetProceedingJoinPoint(pmi);
    JoinPointMatch jpm = getJoinPointMatch(pmi);
    return invokeAdviceMethod(pjp, jpm, null, null);
  }
View Full Code Here

        Method expectedMethod = service.getClass().getDeclaredMethod("testStaticDiscriminatorStaticIdEmptyCondition",
                TestObject.class);
        TestObject argument = new TestObject(1L, "Jesse");
        Object[] joinPointArgs = {argument};

        ProceedingJoinPoint joinPoint = prepareJoinPoint(expectedDiscriminator, expectedId, service,
                expectedMethod, argument, joinPointArgs);

        String result = (String) aspect.synchronizeInvocation(joinPoint);
        assertThat(result, is(expectedResult));
    }
View Full Code Here

        Method expectedMethod = service.getClass().getDeclaredMethod("testStaticDiscriminatorStaticIdEmptyCondition",
                TestObject.class);
        TestObject argument = new TestObject(1L, "Jesse");
        Object[] joinPointArgs = {argument};

        ProceedingJoinPoint joinPoint = prepareJoinPoint(expectedDiscriminator, expectedId, service,
                expectedMethod, argument, joinPointArgs);

        String result = (String) aspect.synchronizeInvocation(joinPoint);
        assertThat(result, is(expectedResult));
    }
View Full Code Here

        Method expectedMethod = service.getClass().getDeclaredMethod("testStaticDiscriminatorDynamicIdDynamicCondition",
                TestObject.class);
        TestObject argument = new TestObject(1L, "Jesse");
        Object[] joinPointArgs = {argument};

        ProceedingJoinPoint joinPoint = prepareJoinPoint(expectedDiscriminator, expectedId, service,
                expectedMethod, argument, joinPointArgs);

        String result = (String) aspect.synchronizeInvocation(joinPoint);
        assertThat(result, is(expectedResult));
    }
View Full Code Here

        Method expectedMethod = service.getClass().getDeclaredMethod("testStaticDiscriminatorDynamicIdDynamicCondition",
                TestObject.class);
        TestObject argument = new TestObject(-1L, "Jesse");
        Object[] joinPointArgs = {argument};

        ProceedingJoinPoint joinPoint = prepareJoinPoint(expectedDiscriminator, expectedId, service,
                expectedMethod, argument, joinPointArgs);

        String result = (String) aspect.synchronizeInvocation(joinPoint);
        assertThat(result, is(expectedResult));
    }
View Full Code Here

            throws Throwable {
        MethodSignature methodSignature = createMock(MethodSignature.class);
        expect(methodSignature.getMethod()).andReturn(expectedMethod);
        replay(methodSignature);

        ProceedingJoinPoint joinPoint = createMock(ProceedingJoinPoint.class);
        expect(joinPoint.getSignature()).andReturn(methodSignature);
        expect(joinPoint.getTarget()).andReturn(service);
        expect(joinPoint.getArgs()).andReturn(joinPointArgs);
        expect(joinPoint.proceed()).andReturn(expectedMethod.invoke(service, argument));
        replay(joinPoint);

        Lock lock = new ReentrantLock();
        expect(lockService.borrowLock(expectedDiscriminator, expectedId)).andReturn(lock);
        lockService.returnLock(lock);
View Full Code Here

        replay(mockSignature);
    }

    @Test
    public void testMonitor() throws Throwable {
        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 2);
        expect(mockPjp.proceed()).andReturn(null).times(2);
        replay(mockPjp);

        // Test monitor without pre-existing circuit breaker.
        aspect.monitor(mockPjp, mockAnnotation);

        // Test monitor with pre-existing circuit breaker.
        aspect.monitor(mockPjp, mockAnnotation);

        String otherName = "OtherMonitor";
        ProceedingJoinPoint otherMockPjp = createPjpMock(mockSignature, 1);
        expect(otherMockPjp.proceed()).andReturn(null).times(1);
        replay(otherMockPjp);

        CircuitBreaker otherMockAnnotation = createMock(CircuitBreaker.class);
        expect(otherMockAnnotation.name()).andReturn(otherName).anyTimes();
        expect(otherMockAnnotation.limit()).andReturn(5).anyTimes();
View Full Code Here

        verify(otherMockAnnotation);
    }

    @Test
    public void testSetCircuitBreakerFactory() throws Throwable {
        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andReturn(null);
        replay(mockPjp);

        CircuitBreakerFactory factory = new CircuitBreakerFactory();
        aspect.setCircuitBreakerFactory(factory);
View Full Code Here

TOP

Related Classes of org.aspectj.lang.ProceedingJoinPoint

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.