Search in sources :

Example 1 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.

the class AsyncPropertyIndexTest method testAsyncPropertyNoChanges.

@Test
public void testAsyncPropertyNoChanges() throws Exception {
    NodeStore store = new MemoryNodeStore();
    assertTrue(Iterables.isEmpty(store.checkpoints()));
    AsyncIndexUpdate async = new AsyncIndexUpdate(ASYNC_REINDEX_VALUE, store, provider, true);
    async.run();
    async.run();
    async.close();
    assertTrue(Iterables.isEmpty(store.checkpoints()));
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) AsyncIndexUpdate(org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate) Test(org.junit.Test)

Example 2 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.

the class S3DataStoreStatsTest method testIsFileSyncedBinaryNotSyncedAndBinariesSyncedReturnsFalse.

@Test
public void testIsFileSyncedBinaryNotSyncedAndBinariesSyncedReturnsFalse() 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));
    stats = new S3DataStoreStats();
    stats.nodeStore = nodeStore;
    stats.s3ds = autoSyncMockS3ds;
    assertSyncedFalse(stats, autoSyncMockS3ds, getStream("testContents2"), getStream("testContents3"));
}
Also used : Blob(org.apache.jackrabbit.oak.api.Blob) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Hex.encodeHexString(org.apache.commons.codec.binary.Hex.encodeHexString) Test(org.junit.Test)

Example 3 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.

the class S3DataStoreStatsTest method testIsFileSyncedBinarySyncedAndBinariesNotSyncedReturnsFalse.

@Test
public void testIsFileSyncedBinarySyncedAndBinariesNotSyncedReturnsFalse() 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));
    stats = new S3DataStoreStats();
    stats.nodeStore = nodeStore;
    stats.s3ds = autoSyncMockS3ds;
    assertSyncedFalse(stats, autoSyncMockS3ds, new FileInputStream(testFile), getStream("testContents2"));
}
Also used : Blob(org.apache.jackrabbit.oak.api.Blob) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Hex.encodeHexString(org.apache.commons.codec.binary.Hex.encodeHexString) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Example 4 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.

the class S3DataStoreStatsTest method testIsFileSyncedBinaryAndBinariesSyncedReturnsTrue.

@Test
public void testIsFileSyncedBinaryAndBinariesSyncedReturnsTrue() 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));
    stats = new S3DataStoreStats();
    stats.nodeStore = nodeStore;
    stats.s3ds = autoSyncMockS3ds;
    assertSyncedFalse(stats, autoSyncMockS3ds, new FileInputStream(testFile), getStream("testContents2"), getStream("testContents3"));
}
Also used : Blob(org.apache.jackrabbit.oak.api.Blob) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Hex.encodeHexString(org.apache.commons.codec.binary.Hex.encodeHexString) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Example 5 with NodeStore

use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.

the class S3DataStoreStatsTest method testIsFileSyncedMultipleBinaryPropertiesNotAllSyncedReturnsFalse.

@Test
public void testIsFileSyncedMultipleBinaryPropertiesNotAllSyncedReturnsFalse() throws Exception {
    Blob mockBlob2 = mock(Blob.class);
    final String id2 = getIdForInputStream(getStream("testContents2"));
    when(mockBlob2.getContentIdentity()).thenReturn(id2);
    NodeStore nodeStore = initNodeStore(Optional.of(mockBlob), Optional.of(mockBlob2), Optional.<String>absent(), Optional.<Integer>absent(), Optional.<List<Blob>>absent());
    stats = new S3DataStoreStats();
    stats.nodeStore = nodeStore;
    stats.s3ds = autoSyncMockS3ds;
    assertSyncedFalse(stats, autoSyncMockS3ds, new FileInputStream(testFile));
}
Also used : Blob(org.apache.jackrabbit.oak.api.Blob) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Hex.encodeHexString(org.apache.commons.codec.binary.Hex.encodeHexString) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Aggregations

NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)179 Test (org.junit.Test)106 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)68 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)62 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)39 Blob (org.apache.jackrabbit.oak.api.Blob)26 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)23 File (java.io.File)22 Before (org.junit.Before)19 FileInputStream (java.io.FileInputStream)16 Hex.encodeHexString (org.apache.commons.codec.binary.Hex.encodeHexString)16 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)16 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)15 StandbyClientSync (org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync)15 StandbyServerSync (org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync)15 Oak (org.apache.jackrabbit.oak.Oak)14 DocumentNodeStore (org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore)14 ProxyNodeStore (org.apache.jackrabbit.oak.spi.state.ProxyNodeStore)13 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)11 MemoryStore (org.apache.jackrabbit.oak.segment.memory.MemoryStore)10