@SuppressWarnings("unchecked") @Test public void testSetPolicyEvalResult() throws Exception { PolicyEvaluationRequestV1 request = new PolicyEvaluationRequestV1(); request.setAction(ACTION_GET); request.setSubjectIdentifier(AGENT_MULDER); request.setResourceIdentifier(XFILES_ID); PolicyEvaluationRequestCacheKey key = new PolicyEvaluationRequestCacheKey.Builder().zoneId(ZONE_NAME) .request(request).build(); PolicyEvaluationResult result = new PolicyEvaluationResult(Effect.PERMIT); String value = OBJECT_MAPPER.writeValueAsString(result); this.cache.set(key.toDecisionKey(), value); Map<String, String> evalCache = (Map<String, String>) getInternalState(this.cache, "evalCache"); assertEquals(evalCache.size(), 1); }
@Override void set(final String key, final String value) { if (isPolicySetChangedKey(key) || isResourceChangedKey(key) || isSubjectChangedKey(key) || isPolicyEvalResultKey(key)) { this.evalCache.put(key, value); } else { throw new IllegalArgumentException("Unsupported key format."); } }
InMemoryPolicyEvaluationCache extends AbstractPolicyEvaluationCache { @Override void set(final String key, final String value) { if (isPolicySetChangedKey(key) || isResourceChangedKey(key) || isSubjectChangedKey(key) || isPolicyEvalResultKey(key)) { this.evalCache.put(key, value); } else { throw new IllegalArgumentException("Unsupported key format."); } } }
InMemoryPolicyEvaluationCache extends AbstractPolicyEvaluationCache { @Override void set(final String key, final String value) { if (isPolicySetChangedKey(key) || isResourceChangedKey(key) || isSubjectChangedKey(key) || isPolicyEvalResultKey(key)) { this.evalCache.put(key, value); } else { throw new IllegalArgumentException("Unsupported key format."); } }  }
InMemoryPolicyEvaluationCache extends AbstractPolicyEvaluationCache { @Override void set(final String key, final String value) { if (isPolicySetChangedKey(key) || isResourceChangedKey(key) || isSubjectChangedKey(key) || isPolicyEvalResultKey(key)) { this.evalCache.put(key, value); } else { throw new IllegalArgumentException("Unsupported key format."); } }   }
InMemoryPolicyEvaluationCache extends AbstractPolicyEvaluationCache { @Override void set(final String key, final String value) { if (isPolicySetChangedKey(key) || isResourceChangedKey(key) || isSubjectChangedKey(key) || isPolicyEvalResultKey(key)) { this.evalCache.put(key, value); } else { throw new IllegalArgumentException("Unsupported key format."); } }    }