TimingDocumentStoreWrapper implements DocumentStore { @Override @Nullable public <T extends Document> T createOrUpdate(Collection<T> collection, UpdateOp update) { try { long start = now(); T result = base.createOrUpdate(collection, update); updateAndLogTimes("createOrUpdate", start, 0, size(result)); if (logCommonCall()) { logCommonCall(start, "createOrUpdate " + collection + " " + update.getId()); } return result; } catch (Exception e) { throw convert(e); } } TimingDocumentStoreWrapper(DocumentStore base); @Override @Nullable T find(Collection<T> collection, String key); @Override @Nullable T find(Collection<T> collection, String key, int maxCacheAge); @Override @NotNull List<T> query(Collection<T> collection,
                                                String fromKey,
                                                String toKey,
                                                int limit); @Override @NotNull List<T> query(Collection<T> collection,
                                              String fromKey,
                                              String toKey,
                                              String indexedProperty,
                                              long startValue,
                                              int limit); @Override void remove(Collection<T> collection, String key); @Override void remove(Collection<T> collection, List<String> keys); @Override int remove(Collection<T> collection,
                                           Map<String, Long> toRemove); @Override int remove(Collection<T> collection,
                                               String indexedProperty, long startValue, long endValue); @Override boolean create(Collection<T> collection, List<UpdateOp> updateOps); @Override @Nullable T createOrUpdate(Collection<T> collection, UpdateOp update); @Override List<T> createOrUpdate(Collection<T> collection, List<UpdateOp> updateOps); @Override @Nullable T findAndUpdate(Collection<T> collection, UpdateOp update); @Override CacheInvalidationStats invalidateCache(); @Override CacheInvalidationStats invalidateCache(Iterable<String> keys); @Override void invalidateCache(Collection<T> collection, String key); @Override void dispose(); @Override T getIfCached(Collection<T> collection, String key); @Override void setReadWriteMode(String readWriteMode); @Override Iterable<CacheStats> getCacheStats(); @Override Map<String, String> getMetadata(); @NotNull @Override Map<String, String> getStats(); @Override long determineServerTimeDifferenceMillis();  }
@Test public void createOrUpdate() { DocumentStore store = new TimingDocumentStoreWrapper(new MemoryDocumentStore()); UpdateOp op = new UpdateOp("foo", true); store.createOrUpdate(Collection.NODES, Collections.singletonList(op)); }