Search in sources :

Example 71 with ProceedingJoinPoint

use of org.aspectj.lang.ProceedingJoinPoint in project onebusaway-application-modules by camsys.

the class DefaultCacheableKeyFactoryTest method test01.

@Test
public void test01() throws SecurityException, NoSuchMethodException {
    MockServiceImpl service = new MockServiceImpl();
    Method method = MockService.class.getMethod("evalaute", String.class);
    ProceedingJoinPoint pjp = ProceedingJoinPointFactory.create(service, service, MockService.class, method, "value");
    CacheableObjectKeyFactory[] keyFactories = { new DefaultCacheableObjectKeyFactory() };
    DefaultCacheableKeyFactory factory = new DefaultCacheableKeyFactory(keyFactories);
    CacheKeyInfo keyInfo = factory.createKey(pjp);
    assertEquals("value", keyInfo.getKey());
}
Also used : Method(java.lang.reflect.Method) ProceedingJoinPoint(org.aspectj.lang.ProceedingJoinPoint) Test(org.junit.Test)

Example 72 with ProceedingJoinPoint

use of org.aspectj.lang.ProceedingJoinPoint in project onebusaway-application-modules by camsys.

the class DefaultCacheableKeyFactoryTest method test02.

@Test
public void test02() throws SecurityException, NoSuchMethodException {
    MockServiceImpl service = new MockServiceImpl();
    Method method = MockService.class.getMethod("evalauteMultiArg", String.class, String.class);
    ProceedingJoinPoint pjp = ProceedingJoinPointFactory.create(service, service, MockService.class, method, "valueA", "valueB");
    CacheableObjectKeyFactory[] keyFactories = { new DefaultCacheableObjectKeyFactory(), new DefaultCacheableObjectKeyFactory() };
    DefaultCacheableKeyFactory factory = new DefaultCacheableKeyFactory(keyFactories);
    DefaultCacheableKeyFactory.KeyImpl expected = new DefaultCacheableKeyFactory.KeyImpl(new Serializable[] { "valueA", "valueB" });
    CacheKeyInfo keyInfo = factory.createKey(pjp);
    assertEquals(expected, keyInfo.getKey());
}
Also used : Method(java.lang.reflect.Method) ProceedingJoinPoint(org.aspectj.lang.ProceedingJoinPoint) Test(org.junit.Test)

Example 73 with ProceedingJoinPoint

use of org.aspectj.lang.ProceedingJoinPoint in project spring-framework by spring-projects.

the class ProceedTestingAspect method doubleOrQuits.

public Object doubleOrQuits(ProceedingJoinPoint pjp) throws Throwable {
    int value = ((Integer) pjp.getArgs()[0]).intValue();
    pjp.getArgs()[0] = Integer.valueOf(value * 2);
    return pjp.proceed();
}
Also used : JoinPoint(org.aspectj.lang.JoinPoint) ProceedingJoinPoint(org.aspectj.lang.ProceedingJoinPoint)

Example 74 with ProceedingJoinPoint

use of org.aspectj.lang.ProceedingJoinPoint in project spring-framework by spring-projects.

the class SimpleSpringBeforeAdvice method aroundAdviceTwo.

public int aroundAdviceTwo(ProceedingJoinPoint pjp) {
    int ret = -1;
    this.collaborator.aroundAdviceTwo(this.name);
    try {
        ret = ((Integer) pjp.proceed()).intValue();
    } catch (Throwable t) {
        throw new RuntimeException(t);
    }
    this.collaborator.aroundAdviceTwo(this.name);
    return ret;
}
Also used : ProceedingJoinPoint(org.aspectj.lang.ProceedingJoinPoint)

Example 75 with ProceedingJoinPoint

use of org.aspectj.lang.ProceedingJoinPoint in project page-factory-2 by sbtqa.

the class CriticalStepAspect method argumentOffset.

@Around(value = "argumentOffset(arguments, stepDefinition, featurePath, step)", argNames = "joinPoint,arguments,stepDefinition,featurePath,step")
public Object argumentOffset(ProceedingJoinPoint joinPoint, List<Argument> arguments, StepDefinition stepDefinition, String featurePath, PickleStep step) throws Throwable {
    for (Argument argument : arguments) {
        if (argument instanceof ExpressionArgument && hasReplaceableArgument(step, argument)) {
            int start = ((ExpressionArgument) argument).getGroup().getStart();
            int end = ((ExpressionArgument) argument).getGroup().getEnd();
            int offset = NON_CRITICAL.length();
            FieldUtils.writeField(FieldUtils.readField(FieldUtils.readField(argument, "argument", true), "group", true), "start", start + offset, true);
            FieldUtils.writeField(FieldUtils.readField(FieldUtils.readField(argument, "argument", true), "group", true), "end", end + offset, true);
        }
    }
    return joinPoint.proceed();
}
Also used : Argument(io.cucumber.stepexpression.Argument) ExpressionArgument(io.cucumber.stepexpression.ExpressionArgument) ExpressionArgument(io.cucumber.stepexpression.ExpressionArgument) ProceedingJoinPoint(org.aspectj.lang.ProceedingJoinPoint) Around(org.aspectj.lang.annotation.Around)

Aggregations

ProceedingJoinPoint (org.aspectj.lang.ProceedingJoinPoint)77 Around (org.aspectj.lang.annotation.Around)32 MethodSignature (org.aspectj.lang.reflect.MethodSignature)16 Method (java.lang.reflect.Method)14 Test (org.junit.Test)14 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)10 SimpleDateFormat (java.text.SimpleDateFormat)8 ArrayList (java.util.ArrayList)8 JoinPoint (org.aspectj.lang.JoinPoint)8 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)7 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)7 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)7 MockProceedingJoinPoint (org.finra.herd.core.MockProceedingJoinPoint)7 Annotation (java.lang.annotation.Annotation)5 CancelamentoMatriculaDTO (com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO)4 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)4 Date (java.util.Date)4 AtomicReference (java.util.concurrent.atomic.AtomicReference)4 Action (org.apache.nifi.action.Action)4 MessageHeader (org.finra.herd.model.dto.MessageHeader)4