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());
}
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());
}
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();
}
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;
}
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();
}
Aggregations