use of cn.taketoday.context.expression.AnnotatedElementKey in project today-infrastructure by TAKETODAY.
the class ExpressionEvaluatorTests method testMultipleCachingEval.
@Test
public void testMultipleCachingEval() {
AnnotatedClass target = new AnnotatedClass();
Method method = ReflectionUtils.findMethod(AnnotatedClass.class, "multipleCaching", Object.class, Object.class);
Object[] args = new Object[] { new Object(), new Object() };
Collection<ConcurrentMapCache> caches = Collections.singleton(new ConcurrentMapCache("test"));
EvaluationContext evalCtx = this.eval.createEvaluationContext(caches, method, args, target, target.getClass(), method, CacheOperationExpressionEvaluator.NO_RESULT, null);
Collection<CacheOperation> ops = getOps("multipleCaching");
Iterator<CacheOperation> it = ops.iterator();
AnnotatedElementKey key = new AnnotatedElementKey(method, AnnotatedClass.class);
Object keyA = this.eval.key(it.next().getKey(), key, evalCtx);
Object keyB = this.eval.key(it.next().getKey(), key, evalCtx);
assertThat(keyA).isEqualTo(args[0]);
assertThat(keyB).isEqualTo(args[1]);
}
use of cn.taketoday.context.expression.AnnotatedElementKey in project today-framework by TAKETODAY.
the class ExpressionEvaluatorTests method testMultipleCachingEval.
@Test
public void testMultipleCachingEval() {
AnnotatedClass target = new AnnotatedClass();
Method method = ReflectionUtils.findMethod(AnnotatedClass.class, "multipleCaching", Object.class, Object.class);
Object[] args = new Object[] { new Object(), new Object() };
Collection<ConcurrentMapCache> caches = Collections.singleton(new ConcurrentMapCache("test"));
EvaluationContext evalCtx = this.eval.createEvaluationContext(caches, method, args, target, target.getClass(), method, CacheOperationExpressionEvaluator.NO_RESULT, null);
Collection<CacheOperation> ops = getOps("multipleCaching");
Iterator<CacheOperation> it = ops.iterator();
AnnotatedElementKey key = new AnnotatedElementKey(method, AnnotatedClass.class);
Object keyA = this.eval.key(it.next().getKey(), key, evalCtx);
Object keyB = this.eval.key(it.next().getKey(), key, evalCtx);
assertThat(keyA).isEqualTo(args[0]);
assertThat(keyB).isEqualTo(args[1]);
}
Aggregations