@Test(timeout = 5000) public void testCachedAuthKeyIsInvalid() throws Exception { CachingKeyConfImpl.invalidateCaches(); AtomicInteger callsToGetAuthKeyInfo = new AtomicInteger(0); ToggleableBooleanSupplier keyValidity = new ToggleableBooleanSupplier(true); int expectedCacheHits = 0; doConcurrentAuthKeyReads(callsToGetAuthKeyInfo, UNCHANGED_KEY_CONF, keyValidity, VALID_SIGNING_INFO, 5, NO_LOOPING, NO_DELAY); expectedCacheHits = expectedCacheHits + 1; assertEquals(expectedCacheHits, callsToGetAuthKeyInfo.get()); keyValidity.setValue(false); doConcurrentAuthKeyReads(callsToGetAuthKeyInfo, UNCHANGED_KEY_CONF, keyValidity, VALID_SIGNING_INFO, 1, NO_LOOPING, NO_DELAY); expectedCacheHits = expectedCacheHits + 1; assertEquals(expectedCacheHits, callsToGetAuthKeyInfo.get()); doConcurrentAuthKeyReads(callsToGetAuthKeyInfo, UNCHANGED_KEY_CONF, keyValidity, VALID_SIGNING_INFO, 5, NO_LOOPING, 500); int expectedMinimumCacheHits = expectedCacheHits + 1; int expectedMaximumCacheHits = expectedCacheHits + 5; log.debug("total cache hits: {}", callsToGetAuthKeyInfo.get()); assertThat(callsToGetAuthKeyInfo.get(), allOf( greaterThanOrEqualTo(expectedMinimumCacheHits), lessThanOrEqualTo(expectedMaximumCacheHits))); }
protected static void invalidateCaches() { AUTH_KEY_CACHE.invalidateAll(); SIGNING_INFO_CACHE.invalidateAll(); }
CachingKeyConfImpl extends KeyConfImpl { protected static void invalidateCaches() { AUTH_KEY_CACHE.invalidateAll(); SIGNING_INFO_CACHE.invalidateAll(); } }
CachingKeyConfImpl extends KeyConfImpl { protected static void invalidateCaches() { AUTH_KEY_CACHE.invalidateAll(); SIGNING_INFO_CACHE.invalidateAll(); } CachingKeyConfImpl(); }
CachingKeyConfImpl extends KeyConfImpl { protected static void invalidateCaches() { AUTH_KEY_CACHE.invalidateAll(); SIGNING_INFO_CACHE.invalidateAll(); } CachingKeyConfImpl(); @Override SigningCtx getSigningCtx(ClientId clientId); @Override AuthKey getAuthKey(); }
CachingKeyConfImpl extends KeyConfImpl { protected static void invalidateCaches() { AUTH_KEY_CACHE.invalidateAll(); SIGNING_INFO_CACHE.invalidateAll(); } CachingKeyConfImpl(); @Override SigningCtx getSigningCtx(ClientId clientId); @Override AuthKey getAuthKey();  }