Package org.apache.jackrabbit.oak.plugins.segment

Examples of org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore


    private Session session;
    private VersionManager vMgr;

    @Before
    public void before() throws Exception {
        store = new SegmentNodeStore(new MemoryStore());
        repo = new Jcr(store).createRepository();
        session = repo.login(new SimpleCredentials("admin", "admin".toCharArray()));
        vMgr = session.getWorkspace().getVersionManager();
    }
View Full Code Here


    @Test
    public void testBackup() throws Exception {
        FileStore source = new FileStore(src, 256, false);

        NodeStore store = new SegmentNodeStore(source);
        init(store);

        // initial content
        FileStoreBackup.backup(store, destination);
View Full Code Here

    }

    private static void compare(NodeStore store, File destination)
            throws IOException {
        FileStore backup = new FileStore(destination, 256, false);
        assertEquals(store.getRoot(), new SegmentNodeStore(backup).getRoot());
        backup.close();
    }
View Full Code Here

    @Test @Ignore("OAK-1159 duplicate content")
    public void testSharedContent() throws Exception {
        FileStore source = new FileStore(src, 256, false);

        NodeStore store = new SegmentNodeStore(source);

        // ~100k
        Blob blob = store.createBlob(new ByteArrayInputStream(new byte[100000]));

        NodeBuilder builder = store.getRoot().builder();
        NodeBuilder c1 = builder.child("test-backup");
        c1.setProperty("blob", blob);
        NodeBuilder c2 = builder.child("test-backup2");
        c2.setProperty("blob", blob);
        store.merge(builder, EmptyHook.INSTANCE, null);

        FileStoreBackup.backup(store, destination);
        compare(store, destination);
        source.close();
View Full Code Here

        super(settings);

        Session session = null;
        try {
            this.connection = new MongoClient(HOST, PORT);
            Jcr jcr = new Jcr(new Oak(new SegmentNodeStore(
                    new MongoStore(connection.getDB(DB), 4))));
            this.repository = jcr.createRepository();

            session = getRepository().login(superuser);
            TestContentLoader loader = new TestContentLoader();
View Full Code Here

                Repository[] cluster = new Repository[n];
                stores = new SegmentStore[cluster.length];
                mongo = new MongoClient(host, port);
                for (int i = 0; i < cluster.length; i++) {
                    stores[i] = new MongoStore(mongo.getDB(unique), cacheSizeMB);
                    Oak oak = new Oak(new SegmentNodeStore(stores[i]));
                    cluster[i] = new Jcr(oak).createRepository();
                }
                return cluster;
            }
            @Override
View Full Code Here

                stores = new FileStore[cluster.length];
                for (int i = 0; i < cluster.length; i++) {
                    stores[i] = new FileStore(
                            new File(base, unique),
                            maxFileSizeMB, cacheSizeMB, memoryMapping);
                    Oak oak = new Oak(new SegmentNodeStore(stores[i]));
                    cluster[i] = new Jcr(oak).createRepository();
                }
                return cluster;
            }
            @Override
View Full Code Here

            this.store = store;
        }

        @Override
        public NodeStore createNodeStore() {
            return new SegmentNodeStore(store == null ? new MemoryStore() : store);
        }
View Full Code Here

    private SegmentNodeStore nodeStore;
    private FileBlob fileBlob;

    @Test
    public void testCreateAndRead() throws Exception {
        SegmentNodeStore nodeStore = getNodeStore();

        NodeState state = nodeStore.getRoot().getChildNode("hello");
        if (!state.exists()) {
            NodeBuilder builder = nodeStore.getRoot().builder();
            builder.child("hello");
            nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
        }

        Blob blob = getFileBlob();
        NodeBuilder builder = nodeStore.getRoot().builder();
        builder.getChildNode("hello").setProperty("world", blob);
        nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);

        state = nodeStore.getRoot().getChildNode("hello");
        blob = state.getProperty("world").getValue(Type.BINARY);

        assertTrue("Blob written and read must be equal",
                AbstractBlob.equal(blob, getFileBlob()));
    }
View Full Code Here

    }

    protected SegmentNodeStore getNodeStore() throws IOException {
        if (nodeStore == null) {
            store = new FileStore(new File("target", "ExternalBlobTest"), 256, false);
            nodeStore = new SegmentNodeStore(store);
        }
        return nodeStore;
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.