use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.
the class CopyVersionHistorySidegradeTest method upgradeRepository.
@Before
@Override
public void upgradeRepository() throws Exception {
if (sourceNodeStore == null) {
sourceNodeStore = new MemoryNodeStore();
RepositoryImpl repository = (RepositoryImpl) new Jcr(new Oak(sourceNodeStore)).createRepository();
Session session = repository.login(CREDENTIALS);
try {
createSourceContent(session);
} finally {
session.logout();
repository.shutdown();
}
}
}
use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project sling by apache.
the class OakVirtualInstanceBuilder method createNewRepository.
@Override
public VirtualInstanceBuilder createNewRepository() throws Exception {
nodeStore = new MemoryNodeStore();
SlingRepository repository = RepositoryTestHelper.newOakRepository(nodeStore);
factory = MockFactory.mockResourceResolverFactory(repository);
leaseCollection = new SimulatedLeaseCollection();
return this;
}
use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.
the class InitialContent method initialize.
@Override
public void initialize(@Nonnull NodeBuilder builder) {
builder.setProperty(JCR_PRIMARYTYPE, NT_REP_ROOT, Type.NAME);
if (!builder.hasChildNode(JCR_SYSTEM)) {
NodeBuilder system = builder.child(JCR_SYSTEM);
system.setProperty(JCR_PRIMARYTYPE, NT_REP_SYSTEM, Type.NAME);
system.child(JCR_VERSIONSTORAGE).setProperty(JCR_PRIMARYTYPE, REP_VERSIONSTORAGE, Type.NAME);
system.child(JCR_NODE_TYPES).setProperty(JCR_PRIMARYTYPE, NT_REP_NODE_TYPES, Type.NAME);
system.child(VersionConstants.JCR_ACTIVITIES).setProperty(JCR_PRIMARYTYPE, VersionConstants.REP_ACTIVITIES, Type.NAME);
Namespaces.setupNamespaces(system);
}
NodeBuilder versionStorage = builder.child(JCR_SYSTEM).child(JCR_VERSIONSTORAGE);
if (prePopulateVS && !isInitialized(versionStorage)) {
createIntermediateNodes(versionStorage);
}
if (!builder.hasChildNode(IndexConstants.INDEX_DEFINITIONS_NAME)) {
NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
NodeBuilder uuid = IndexUtils.createIndexDefinition(index, "uuid", true, true, ImmutableList.<String>of(JCR_UUID), null);
uuid.setProperty("info", "Oak index for UUID lookup (direct lookup of nodes with the mixin 'mix:referenceable').");
NodeBuilder nodetype = IndexUtils.createIndexDefinition(index, "nodetype", true, false, ImmutableList.of(JCR_PRIMARYTYPE, JCR_MIXINTYPES), null);
nodetype.setProperty("info", "Oak index for queries with node type, and possibly path restrictions, " + "for example \"/jcr:root/content//element(*, mix:language)\".");
IndexUtils.createReferenceIndex(index);
index.child("counter").setProperty(JCR_PRIMARYTYPE, INDEX_DEFINITIONS_NODE_TYPE, NAME).setProperty(TYPE_PROPERTY_NAME, NodeCounterEditorProvider.TYPE).setProperty(IndexConstants.ASYNC_PROPERTY_NAME, IndexConstants.ASYNC_PROPERTY_NAME).setProperty("info", "Oak index that allows to estimate " + "how many nodes are stored below a given path, " + "to decide whether traversing or using an index is faster.");
}
// squeeze node state before it is passed to store (OAK-2411)
NodeState base = squeeze(builder.getNodeState());
NodeStore store = new MemoryNodeStore(base);
registerBuiltIn(RootFactory.createSystemRoot(store, new EditorHook(new CompositeEditorProvider(new NamespaceEditorProvider(), new TypeEditorProvider())), null, null, null));
NodeState target = store.getRoot();
target.compareAgainstBaseState(base, new ApplyDiff(builder));
}
use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.
the class TraversalAvoidanceTest method createRepository.
@Override
protected ContentRepository createRepository() {
nodeStore = new MemoryNodeStore();
Oak oak = new Oak(nodeStore).with(new OpenSecurityProvider()).with(new InitialContent()).with(new NodeCounterEditorProvider()).with(testIndexProvider).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
wb = oak.getWhiteboard();
return oak.createContentRepository();
}
use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.
the class SessionImplCapabilityWithMountInfoProviderTest method prepare.
@Before
public void prepare() throws Exception {
MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("ro", "/private").build();
MemoryNodeStore roStore = new MemoryNodeStore();
{
NodeBuilder builder = roStore.getRoot().builder();
builder.child("private").setProperty(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED).setProperty("prop", "value").child("foo").setProperty(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED);
roStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
}
MemoryNodeStore globalStore = new MemoryNodeStore();
{
NodeBuilder builder = globalStore.getRoot().builder();
builder.child("foo").setProperty(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED).setProperty("prop", "value").child("bar").setProperty(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED);
globalStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
}
CompositeNodeStore store = new CompositeNodeStore.Builder(mip, globalStore).addMount("ro", roStore).build();
Whiteboard whiteboard = new DefaultWhiteboard();
whiteboard.register(MountInfoProvider.class, mip, Collections.emptyMap());
Jcr jcr = new Jcr(store).with(whiteboard);
jcr.createContentRepository();
Repository repository = jcr.createRepository();
adminSession = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
}
Aggregations