Package org.aspectj.lang

Examples of org.aspectj.lang.ProceedingJoinPoint.proceed()


        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


    }

    @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);
View Full Code Here

        // 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

    }

    @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

    @Test
    public void testMonitorWithError() throws Throwable {
        Error e = new Error();
        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andThrow(e);
        replay(mockPjp);

        callMonitorCatchThrowable(mockPjp, e);
        verifyBreakerExists(TEST_CIRCUIT_BREAKER);
View Full Code Here

    }

    @Test
    public void testMonitorWithRunTimeException() throws Throwable {
        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andThrow(new Throwable());
        replay(mockPjp);

        callMonitorCatchThrowable(mockPjp, new RuntimeException());
        verifyBreakerExists(TEST_CIRCUIT_BREAKER);
View Full Code Here

    @Test
    public void testMonitorWithException() throws Throwable {
        Exception e = new Exception();
        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andThrow(e);
        replay(mockPjp);

        callMonitorCatchThrowable(mockPjp, e);
        verifyBreakerExists(TEST_CIRCUIT_BREAKER);
View Full Code Here

    @Test
    public void testGetCircuitBreakerFactory() throws Throwable {

        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, 1);
        expect(mockPjp.proceed()).andReturn(null);
        replay(mockPjp);

        aspect.monitor(mockPjp, mockAnnotation);
        CircuitBreakerFactory circuitBreakerFactory =
                aspect.getCircuitBreakerFactory();
View Full Code Here

        int pjpCallCount = 7;
        int callCount = pjpCallCount - 1;

        ProceedingJoinPoint mockPjp = createPjpMock(mockSignature, pjpCallCount);

        expect(mockPjp.proceed()).andThrow(new Exception()).times(callCount);
        replay(mockPjp);

        Exception e = new Exception();

        for (int i = 0; i < callCount; i++) {
View Full Code Here

    }

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

        aspect.call(mockPjp, mockAnnotation);

        verify(mockPjp);
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.