use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class ConsolidatedDataStoreStatsTest method binaryNotSyncedAndBinariesSynced.
@Test
public void binaryNotSyncedAndBinariesSynced() throws Exception {
Blob mockBlob2 = mock(Blob.class);
final String id2 = getIdForInputStream(getStream("testContents2"));
when(mockBlob2.getContentIdentity()).thenReturn(id2);
Blob mockBlob3 = mock(Blob.class);
final String id3 = getIdForInputStream(getStream("testContents3"));
when(mockBlob2.getContentIdentity()).thenReturn(id3);
List<Blob> blobPropList = Lists.newArrayList(mockBlob2, mockBlob3);
NodeStore nodeStore = initNodeStore(Optional.of(mockBlob), Optional.<Blob>absent(), Optional.<String>absent(), Optional.<Integer>absent(), Optional.of(blobPropList));
assertSyncedFalse(stats, dataStore, getStream("testContents2"), getStream("testContents3"));
}
use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class ConsolidatedDataStoreStatsTest method binariesPropertyNotAllSynced.
@Test
public void binariesPropertyNotAllSynced() throws Exception {
Blob mockBlob2 = mock(Blob.class);
final String id2 = getIdForInputStream(getStream("testContents2"));
when(mockBlob2.getContentIdentity()).thenReturn(id2);
List<Blob> blobPropList = Lists.newArrayList(mockBlob, mockBlob2);
NodeStore nodeStore = initNodeStore(Optional.<Blob>absent(), Optional.<Blob>absent(), Optional.<String>absent(), Optional.<Integer>absent(), Optional.of(blobPropList));
assertSyncedFalse(stats, dataStore, new FileInputStream(testFile));
}
use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class ConsolidatedDataStoreStatsTest method binaryAndBinariesSynced.
@Test
public void binaryAndBinariesSynced() throws Exception {
Blob mockBlob2 = mock(Blob.class);
final String id2 = getIdForInputStream(getStream("testContents2"));
when(mockBlob2.getContentIdentity()).thenReturn(id2);
Blob mockBlob3 = mock(Blob.class);
final String id3 = getIdForInputStream(getStream("testContents3"));
when(mockBlob3.getContentIdentity()).thenReturn(id3);
List<Blob> blobPropList = Lists.newArrayList(mockBlob2, mockBlob3);
NodeStore nodeStore = initNodeStore(Optional.of(mockBlob), Optional.<Blob>absent(), Optional.<String>absent(), Optional.<Integer>absent(), Optional.of(blobPropList));
assertSyncedFalse(stats, dataStore, new FileInputStream(testFile), getStream("testContents2"), getStream("testContents3"));
}
use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class ConsolidatedDataStoreStatsTest method multiplePropertiesAndBinarySynced.
@Test
public void multiplePropertiesAndBinarySynced() throws Exception {
NodeStore nodeStore = initNodeStore(Optional.of(mockBlob), Optional.<Blob>absent(), Optional.of("abc"), Optional.of(123), Optional.<List<Blob>>absent());
assertSyncedTrue(stats, dataStore, new FileInputStream(testFile));
}
use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class ManyChildNodesTest method manyChildNodes.
@Test
public void manyChildNodes() throws Exception {
TestStore store = new TestStore();
DocumentMK mk = new DocumentMK.Builder().setDocumentStore(store).open();
NodeStore ns = mk.getNodeStore();
NodeBuilder builder = ns.getRoot().builder();
for (int i = 0; i < DocumentNodeState.MAX_FETCH_SIZE * 2; i++) {
builder.child("c-" + i);
}
ns.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
store.queries.clear();
// must fetch in batches
for (ChildNodeEntry entry : ns.getRoot().getChildNodeEntries()) {
entry.getName();
}
// maximum fetch size is MAX_FETCH_SIZE plus one because
// DocumentNodeStore will use this value to find out if there
// are more child nodes than requested
int maxFetchSize = DocumentNodeState.MAX_FETCH_SIZE + 1;
for (Map.Entry<String, Integer> e : store.queries.entrySet()) {
assertTrue(e.getValue() + " > " + maxFetchSize, e.getValue() <= maxFetchSize);
}
mk.dispose();
}
Aggregations