@Test void testSagaNotAddedToCacheWhenLoadReturnsNull() { ehCache.removeAll(); reset(sagaCache, associationsCache); SagaStore.Entry<StubSaga> actual = testSubject.loadSaga(StubSaga.class, "id"); assertNull(actual); verify(sagaCache).get("id"); verify(sagaCache, never()).put(eq("id"), any()); verify(associationsCache, never()).put(any(), any()); }
@Override public <S extends T> Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier) { Entry<S> saga = sagaCache.get(sagaIdentifier); if (saga == null) { saga = delegate.loadSaga(sagaType, sagaIdentifier); if (saga != null) { sagaCache.put(sagaIdentifier, new CacheEntry<T>(saga)); } } return saga; }
CachingSagaStore implements SagaStore<T> { @Override public <S extends T> Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier) { Entry<S> saga = sagaCache.get(sagaIdentifier); if (saga == null) { saga = delegate.loadSaga(sagaType, sagaIdentifier); if (saga != null) { sagaCache.put(sagaIdentifier, new CacheEntry<T>(saga)); } } return saga; } }
CachingSagaStore implements SagaStore<T> { @Override public <S extends T> Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier) { Entry<S> saga = sagaCache.get(sagaIdentifier); if (saga == null) { saga = delegate.loadSaga(sagaType, sagaIdentifier); if (saga != null) { sagaCache.put(sagaIdentifier, new CacheEntry<T>(saga)); } } return saga; } protected  CachingSagaStore(Builder<T> builder); }
CachingSagaStore implements SagaStore<T> { @Override public <S extends T> Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier) { Entry<S> saga = sagaCache.get(sagaIdentifier); if (saga == null) { saga = delegate.loadSaga(sagaType, sagaIdentifier); if (saga != null) { sagaCache.put(sagaIdentifier, new CacheEntry<T>(saga)); } } return saga; } protected  CachingSagaStore(Builder<T> builder); static Builder<T> builder(); @Override Set<String> findSagas(Class<? extends T> sagaType, AssociationValue associationValue); @Override Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier); @Override void insertSaga(Class<? extends T> sagaType, String sagaIdentifier, T saga,
                           Set<AssociationValue> associationValues); @Override void deleteSaga(Class<? extends T> sagaType, String sagaIdentifier,
                           Set<AssociationValue> associationValues); @Override void updateSaga(Class<? extends T> sagaType, String sagaIdentifier, T saga,
                           AssociationValues associationValues); }
CachingSagaStore implements SagaStore<T> { @Override public <S extends T> Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier) { Entry<S> saga = sagaCache.get(sagaIdentifier); if (saga == null) { saga = delegate.loadSaga(sagaType, sagaIdentifier); if (saga != null) { sagaCache.put(sagaIdentifier, new CacheEntry<T>(saga)); } } return saga; } protected  CachingSagaStore(Builder<T> builder); static Builder<T> builder(); @Override Set<String> findSagas(Class<? extends T> sagaType, AssociationValue associationValue); @Override Entry<S> loadSaga(Class<S> sagaType, String sagaIdentifier); @Override void insertSaga(Class<? extends T> sagaType, String sagaIdentifier, T saga,
                           Set<AssociationValue> associationValues); @Override void deleteSaga(Class<? extends T> sagaType, String sagaIdentifier,
                           Set<AssociationValue> associationValues); @Override void updateSaga(Class<? extends T> sagaType, String sagaIdentifier, T saga,
                           AssociationValues associationValues);  }