@@ -0,0 +1,2816 @@
+package org.apache.jackrabbit.oak.plugins.document;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport javax.jcr.SimpleCredentials;%0A%0Aimport org.apache.jackrabbit.oak.Oak;%0Aimport org.apache.jackrabbit.oak.api.ContentRepository;%0Aimport org.apache.jackrabbit.oak.api.ContentSession;%0Aimport org.apache.jackrabbit.oak.api.Root;%0Aimport org.apache.jackrabbit.oak.api.Tree;%0Aimport org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;%0Aimport org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0Apublic class MultiplexingDocumentStoreWithNodeStoreTest %7B%0A    %0A    private ContentRepository repo;%0A    private MongoConnection connection;%0A%0A    @Before%0A    public void createContentRepository() throws Exception%7B%0A        %0A        // 1. Connect to MongoDB%0A        connection = new MongoConnection(%22mongodb://localhost:27017/oak%22);%0A        dropMongoDatabase();%0A        %0A        // 2. configure the DocumentNodeStore with a multiplexing document store, with a mount at %22/tmp%22%0A        DocumentMK.Builder builder = new DocumentMK.Builder();%0A        builder.addMongoDbMount(%22/tmp%22, connection, %22private%22);%0A        builder.setMongoDB(connection.getDB(), 1, 16);%0A%0A        DocumentNodeStore store = new DocumentNodeStore(builder);%0A%0A        // 3. Create the Oak instance%0A        repo = new Oak(store).with(new OpenSecurityProvider()).createContentRepository();        %0A    %7D%0A    %0A    @After%0A    public void dropMongoDatabase() %7B%0A        %0A        if ( connection != null ) %7B%0A            connection.getDB().dropDatabase();%0A        %7D%0A    %7D%0A%0A    @Test%0A    @Ignore(%22fails for now%22)%0A    public void mountedNodeCreationIsVisible() throws Exception %7B%0A%0A        // 1. Create a tree at /tmp ( mounted store ) and one at /content ( root store )%0A        ContentSession session = repo.login(new SimpleCredentials(%22admin%22, %22admin%22.toCharArray()), null);%0A        try %7B%0A            Root r = session.getLatestRoot();%0A            Tree root = r.getTree(%22/%22);%0A            root.addChild(%22tmp%22);%0A            root.addChild(%22content%22);%0A            r.commit();%0A        %7D finally %7B%0A            session.close();%0A        %7D%0A        %0A        // 2. validate that the previously created trees are now visible%0A        session = repo.login(new SimpleCredentials(%22admin%22, %22admin%22.toCharArray()), null);%0A        try %7B%0A            Tree root = session.getLatestRoot().getTree(%22/%22);%0A            assertTreeExists(root, %22content%22);%0A            assertTreeExists(root, %22tmp%22);%0A        %7D finally %7B%0A            session.close();%0A        %7D%0A%0A    %7D%0A%0A    private void assertTreeExists(Tree root, String childName) %7B%0A        %0A        Tree content = root.getChild(childName);%0A        assertTrue(%22Tree at %22 + content.getPath() + %22 does not exist%22, content.exists());%0A    %7D%0A%0A%7D%0A

Add a MultiplexingDocumentStoreWithNodeStoreTest