use of org.springframework.cache.support.SimpleValueWrapper in project CzechIdMng by bcvsolutions.
the class DefaultSysProvisioningBreakConfigService method getCacheProcessedItems.
@Override
public SysProvisioningBreakItems getCacheProcessedItems(UUID systemId) {
SimpleValueWrapper cachedValueWrapper = (SimpleValueWrapper) this.getCache().get(systemId);
if (cachedValueWrapper == null) {
return new SysProvisioningBreakItems();
}
SysProvisioningBreakItems cache = (SysProvisioningBreakItems) cachedValueWrapper.get();
if (cache == null) {
return new SysProvisioningBreakItems();
}
return cache;
}
use of org.springframework.cache.support.SimpleValueWrapper in project spring-framework by spring-projects.
the class CacheErrorHandlerTests method getAndPutFail.
@Test
public void getAndPutFail() {
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on get");
willThrow(exception).given(this.cache).get(0L);
// Update of the cache will fail as well
willThrow(exception).given(this.cache).put(0L, 0L);
Object counter = this.simpleService.get(0L);
willReturn(new SimpleValueWrapper(2L)).given(this.cache).get(0L);
Object counter2 = this.simpleService.get(0L);
Object counter3 = this.simpleService.get(0L);
assertThat(counter2).isNotSameAs(counter);
assertThat(counter3).isEqualTo(counter2);
}
use of org.springframework.cache.support.SimpleValueWrapper in project POC by rajadilipkolli.
the class CustomCacheErrorHandlerTest method getAndPutFail.
@Test
public void getAndPutFail() {
final UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on get");
willThrow(exception).given(this.cache).get(0L);
// Update of the cache will
willThrow(exception).given(this.cache).put(0L, 0L);
// fail as well
final Object counter = this.simpleService.get(0L);
willReturn(new SimpleValueWrapper(2L)).given(this.cache).get(0L);
final Object counter2 = this.simpleService.get(0L);
final Object counter3 = this.simpleService.get(0L);
assertThat(counter2).isEqualTo(counter3);
assertThat(counter).isNotEqualTo(counter2);
}
Aggregations