@Test public void objectIsStoredInCache() { TestObject model = new TestObject("ID1"); new ArrangeBuilder().withCachedObjectList(Collections.singletonList(model)); reactiveStore.storeSingular(model); Mockito.verify(cache).putSingular(model); }
public void storeSingular(@NonNull final Value model) { final Key key = extractKeyFromModel.call(model); cache.putSingular(model); getOrCreateSubjectForKey(key).onNext(ofObj(model)); final Option<List<Value>> allValues = cache.getAll().map(Option::ofObj).blockingGet(none()); allSubject.onNext(allValues); }
MemoryReactiveStore implements ReactiveStore<Key, Value> { public void storeSingular(@NonNull final Value model) { final Key key = extractKeyFromModel.call(model); cache.putSingular(model); getOrCreateSubjectForKey(key).onNext(ofObj(model)); final Option<List<Value>> allValues = cache.getAll().map(Option::ofObj).blockingGet(none()); allSubject.onNext(allValues); } }
MemoryReactiveStore implements ReactiveStore<Key, Value> { public void storeSingular(@NonNull final Value model) { final Key key = extractKeyFromModel.call(model); cache.putSingular(model); getOrCreateSubjectForKey(key).onNext(ofObj(model)); final Option<List<Value>> allValues = cache.getAll().map(Option::ofObj).blockingGet(none()); allSubject.onNext(allValues); } MemoryReactiveStore(@NonNull final Func1<Value, Key> extractKeyFromModel,
                               @NonNull final Store.MemoryStore<Key, Value> cache); }
MemoryReactiveStore implements ReactiveStore<Key, Value> { public void storeSingular(@NonNull final Value model) { final Key key = extractKeyFromModel.call(model); cache.putSingular(model); getOrCreateSubjectForKey(key).onNext(ofObj(model)); final Option<List<Value>> allValues = cache.getAll().map(Option::ofObj).blockingGet(none()); allSubject.onNext(allValues); } MemoryReactiveStore(@NonNull final Func1<Value, Key> extractKeyFromModel,
                               @NonNull final Store.MemoryStore<Key, Value> cache); void storeSingular(@NonNull final Value model); void storeAll(@NonNull final List<Value> modelList); void replaceAll(@NonNull final List<Value> modelList); @NonNull Observable<Option<Value>> getSingular(@NonNull final Key key); @NonNull Observable<Option<List<Value>>> getAll(); }
MemoryReactiveStore implements ReactiveStore<Key, Value> { public void storeSingular(@NonNull final Value model) { final Key key = extractKeyFromModel.call(model); cache.putSingular(model); getOrCreateSubjectForKey(key).onNext(ofObj(model)); final Option<List<Value>> allValues = cache.getAll().map(Option::ofObj).blockingGet(none()); allSubject.onNext(allValues); } MemoryReactiveStore(@NonNull final Func1<Value, Key> extractKeyFromModel,
                               @NonNull final Store.MemoryStore<Key, Value> cache); void storeSingular(@NonNull final Value model); void storeAll(@NonNull final List<Value> modelList); void replaceAll(@NonNull final List<Value> modelList); @NonNull Observable<Option<Value>> getSingular(@NonNull final Key key); @NonNull Observable<Option<List<Value>>> getAll();  }