use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.
the class SolrBaseTest method setUp.
@Before
public void setUp() throws Exception {
store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
provider = new TestUtils();
server = provider.getSolrServer();
configuration = provider.getConfiguration();
hook = new EditorHook(new IndexUpdateProvider(new SolrIndexEditorProvider(provider, provider)));
Oak oak = new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(// synchronous
new SolrIndexInitializer(false)).with(new SolrQueryIndexProvider(provider, provider)).with(new NodeStateSolrServersObserver()).with(new SolrIndexEditorProvider(provider, provider));
repository = oak.createContentRepository();
}
use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.
the class RecordTest method testBinaryPropertyFromExternalSegmentStore.
@Test
public void testBinaryPropertyFromExternalSegmentStore() throws IOException, CommitFailedException {
byte[] data = new byte[Segment.MEDIUM_LIMIT + 1];
random.nextBytes(data);
SegmentNodeStore extStore = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
NodeBuilder extRootBuilder = extStore.getRoot().builder();
Blob extBlob = extRootBuilder.createBlob(new ByteArrayInputStream(data));
extRootBuilder.setProperty("binary", extBlob, BINARY);
extStore.merge(extRootBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
PropertyState extPropertyState = extStore.getRoot().getProperty("binary");
NodeBuilder builder = EMPTY_NODE.builder();
builder.setProperty(extPropertyState);
NodeState state = writer.writeNode(builder.getNodeState());
try {
InputStream is = state.getProperty("binary").getValue(BINARY).getNewStream();
is.read();
is.close();
} catch (SegmentNotFoundException e) {
fail("OAK-4307 SegmentWriter saves references to external blobs");
}
}
use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.
the class MutableSegmentReferencesTest method referencesShouldBeGreaterThanZero.
@Test
public void referencesShouldBeGreaterThanZero() throws Exception {
MemoryStore store = new MemoryStore();
SegmentId id = store.getSegmentIdProvider().newDataSegmentId();
MutableSegmentReferences table = new MutableSegmentReferences();
int reference = table.addOrReference(id);
assertEquals(1, reference);
}
use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.
the class InitializerTest method testInitializerSegment.
@Test
public void testInitializerSegment() throws CommitFailedException, IOException {
NodeStore store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
NodeBuilder builder = store.getRoot().builder();
new InitialContent().initialize(builder);
SecurityProviderImpl provider = new SecurityProviderImpl(ConfigurationParameters.of(ImmutableMap.of(UserConfiguration.NAME, ConfigurationParameters.of(ImmutableMap.of("anonymousId", "anonymous", "adminId", "admin", "usersPath", "/home/users", "groupsPath", "/home/groups", "defaultDepth", "1")))));
provider.getConfiguration(UserConfiguration.class).getWorkspaceInitializer().initialize(builder, "default");
builder.getNodeState();
}
use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.
the class MutableSegmentReferencesTest method shouldAddNewSegmentReference.
@Test
public void shouldAddNewSegmentReference() throws Exception {
MemoryStore store = new MemoryStore();
SegmentId id = store.getSegmentIdProvider().newDataSegmentId();
MutableSegmentReferences table = new MutableSegmentReferences();
int reference = table.addOrReference(id);
assertEquals(id, table.getSegmentId(reference));
}
Aggregations