public DefaultCacheKeyInvocationContext(AbstractJCacheKeyOperation<A> operation, Object target, Object[] args) { super(operation, target, args); this.keyParameters = operation.getKeyParameters(args); if (operation instanceof CachePutOperation) { this.valueParameter = ((CachePutOperation) operation).getValueParameter(args); } else { this.valueParameter = null; } }
public DefaultCacheKeyInvocationContext(AbstractJCacheKeyOperation<A> operation, Object target, Object[] args) { super(operation, target, args); this.keyParameters = operation.getKeyParameters(args); if (operation instanceof CachePutOperation) { this.valueParameter = ((CachePutOperation) operation).getValueParameter(args); } else { this.valueParameter = null; } }
@Test public void invokeWithWrongParameters() { CachePutOperation operation = createSimpleOperation(); thrown.expect(IllegalStateException.class); operation.getValueParameter(2L); }
@Test public void simplePut() { CachePutOperation operation = createSimpleOperation(); CacheInvocationParameter[] allParameters = operation.getAllParameters(2L, sampleInstance); assertEquals(2, allParameters.length); assertCacheInvocationParameter(allParameters[0], Long.class, 2L, 0); assertCacheInvocationParameter(allParameters[1], SampleObject.class, sampleInstance, 1); CacheInvocationParameter valueParameter = operation.getValueParameter(2L, sampleInstance); assertNotNull(valueParameter); assertCacheInvocationParameter(valueParameter, SampleObject.class, sampleInstance, 1); }
public DefaultCacheKeyInvocationContext(AbstractJCacheKeyOperation<A> operation, Object target, Object[] args) { super(operation, target, args); this.keyParameters = operation.getKeyParameters(args); if (operation instanceof CachePutOperation) { this.valueParameter = ((CachePutOperation) operation).getValueParameter(args); } else { this.valueParameter = null; } }