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

Examples of org.apache.jackrabbit.oak.plugins.segment.file.FileStore$SegmentReference


                .with(new InitialContent()).createContentRepository();
    }

    @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();

        Map<String, Long> expected = new HashMap<String, Long>();
        for (File f : src.listFiles()) {
            if (f.getName().endsWith(".tar")) {
                expected.put(f.getName(), f.length());
View Full Code Here


            throw new IOException("Folder " + source
                    + " is not a valid FileStore directory");
        }

        // 2. init filestore
        FileStore restore = new FileStore(source, MAX_FILE_SIZE, false);
        try {
            Journal journal = restore.getJournal("root");
            SegmentNodeState state = new SegmentNodeState(restore.getWriter()
                    .getDummySegment(), journal.getHead());
            restore(state.getChildNode("root"), store);
        } finally {
            restore.close();
        }
    }
View Full Code Here

    }

    @Parameterized.Parameters
    public static Collection<Object[]> fixtures() throws IOException {
        File file = new File(new File("target"), "tar." + System.nanoTime());
        SegmentStore segmentStore = new FileStore(file, 266, true);

        List<Object[]> fixtures = Lists.newArrayList();
        SegmentFixture segmentFixture = new SegmentFixture(segmentStore);
        if (segmentFixture.isAvailable()) {
            fixtures.add(new Object[] {segmentFixture, SEGMENT_SCALES});
View Full Code Here

            @Override
            protected Repository[] internalSetUpCluster(int n) throws Exception {
                Repository[] cluster = new Repository[n];
                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();
                }
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

        deleteQuietly(destination);
    }

    @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);

        compare(store, destination);

        addTestContent(store);
        FileStoreBackup.backup(store, destination);
        compare(store, destination);

        source.close();
    }
View Full Code Here

        source.close();
    }

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

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

        // initial content
        FileStoreBackup.backup(store, destination);

        addTestContent(store);

        FileStoreRestore.restore(destination, store);

        compare(store, destination);

        source.close();
    }
View Full Code Here

        store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    }

    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

                .with(new InitialContent()).createContentRepository();
    }

    @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, CommitInfo.EMPTY);

        FileStoreBackup.backup(store, destination);
        compare(store, destination);
        source.close();

        Map<String, Long> expected = new HashMap<String, Long>();
        for (File f : src.listFiles()) {
            if (f.getName().endsWith(".tar")) {
                expected.put(f.getName(), f.length());
View Full Code Here

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

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.segment.file.FileStore$SegmentReference

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.