use of com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy in project Hystrix by Netflix.
the class HystrixRequestCacheTest method testClearCache.
@Test
public void testClearCache() {
HystrixConcurrencyStrategy strategy = HystrixConcurrencyStrategyDefault.getInstance();
HystrixRequestContext context = HystrixRequestContext.initializeContext();
try {
HystrixRequestCache cache1 = HystrixRequestCache.getInstance(HystrixCommandKey.Factory.asKey("command1"), strategy);
cache1.putIfAbsent("valueA", new TestObservable("a1"));
assertEquals("a1", cache1.get("valueA").toObservable().toBlocking().last());
cache1.clear("valueA");
assertNull(cache1.get("valueA"));
} catch (Exception e) {
fail("Exception: " + e.getMessage());
e.printStackTrace();
} finally {
context.shutdown();
}
}
Aggregations