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

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


        deleteQuietly(destination);
    }

    @Test
    public void testBackup() throws Exception {
        FileStore source = new FileStore(src, 8, 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, 8, 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, 8, false);
        assertEquals(store.getRoot(), new SegmentNodeStore(backup).getRoot());
        backup.close();
    }
View Full Code Here

        new Oak(store).with(new OpenSecurityProvider())
                .with(new InitialContent()).createContentRepository();
    }

    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

            this.useBlobStore = useBlobStore;
        }

        @Override
        public MicroKernel getMicroKernel() throws Exception {
            FileStore fs = new FileStore(base, maxFileSizeMB, cacheSizeMB, memoryMapping);
            return new NodeStoreKernel(new SegmentNodeStore(fs));
        }
View Full Code Here

            return new NodeStoreKernel(new SegmentNodeStore(fs));
        }

        @Override
        public Oak getOak(int clusterId) throws Exception {
            FileStore fs = new FileStore(base, maxFileSizeMB, cacheSizeMB, memoryMapping);
            return new Oak(new SegmentNodeStore(fs));
        }
View Full Code Here

                if (useBlobStore) {
                    blobStoreFixtures[i] = BlobStoreFixture.create(base, true);
                    blobStore = blobStoreFixtures[i].setUp();
                }

                stores[i] = new FileStore(blobStore,
                        new File(base, unique),
                        EmptyNodeState.EMPTY_NODE,
                        maxFileSizeMB, cacheSizeMB, memoryMapping);
                cluster[i] = new Oak(new SegmentNodeStore(stores[i]));
            }
View Full Code Here

        if (nonOptions.isEmpty()) {
            parser.printHelpOn(System.err);
            System.exit(1);
        }

        FileStore store = null;
        StandbyClient failoverClient = null;
        try {
            store = new FileStore(new File(nonOptions.get(0)), 256);
            failoverClient = new StandbyClient(
                    options.has(host)? options.valueOf(host) : defaultHost,
                    options.has(port)? options.valueOf(port) : defaultPort,
                    store,
                    options.has(secure) && options.valueOf(secure));
            if (!options.has(interval)) {
                failoverClient.run();
            } else {
                ScheduledSyncService syncService = new ScheduledSyncService(failoverClient, options.valueOf(interval));
                syncService.startAsync();
                syncService.awaitTerminated();
            }
        } finally {
            if (store != null) {
                store.close();
            }
            if (failoverClient != null) {
                failoverClient.close();
            }
        }
View Full Code Here

        }


        List<String> admissibleSlaves = options.has(admissible) ? options.valuesOf(admissible) : Collections.EMPTY_LIST;

        FileStore store = null;
        StandbyServer failoverServer = null;
        try {
            store = new FileStore(new File(nonOptions.get(0)), 256);
            failoverServer = new StandbyServer(
                    options.has(port)? options.valueOf(port) : defaultPort,
                    store,
                    admissibleSlaves.toArray(new String[0]),
                    options.has(secure) && options.valueOf(secure));
            failoverServer.startAndWait();
        } finally {
            if (store != null) {
                store.close();
            }
            if (failoverServer != null) {
                failoverServer.close();
            }
        }
View Full Code Here

                    .setMongoDB(mongo.getDB())
                    .setClusterId(clusterId.value(options)).getNodeStore();
            closer.register(asCloseable(store));
            return store;
        }
        FileStore fs = new FileStore(new File(src), 256, TAR_STORAGE_MEMORY_MAPPED);
        closer.register(asCloseable(fs));
        return new SegmentNodeStore(fs);
    }
View Full Code Here

TOP

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

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.