Package org.apache.jackrabbit.oak.plugins.mongomk

Examples of org.apache.jackrabbit.oak.plugins.mongomk.MongoMK


    }

    @Test
    public void addNodesConcurrent() throws Exception {
        for (int i = 0; i < NUM_CLUSTER_NODES; i++) {
            MongoMK mk = new MongoMK.Builder()
                    .setMongoDB(createConnection().getDB())
                    .setClusterId(i + 1).open();
            mks.add(mk);
        }
        Map<String, Exception> exceptions = Collections.synchronizedMap(
                new HashMap<String, Exception>());
        for (int i = 0; i < mks.size(); i++) {
            MongoMK mk = mks.get(i);
            Repository repo = new Jcr(mk).createRepository();
            workers.add(new Thread(new Worker(repo, exceptions), "Worker-" + (i + 1)));
        }
        for (Thread t : workers) {
            t.start();
View Full Code Here


    }

    @Test
    public void addNodes() throws Exception {
        for (int i = 0; i < 2; i++) {
            MongoMK mk = new MongoMK.Builder()
                    .setMongoDB(createConnection().getDB())
                    .setAsyncDelay(0)
                    .setClusterId(i + 1).open();
            mks.add(mk);
        }
        final MongoMK mk1 = mks.get(0);
        final MongoMK mk2 = mks.get(1);
        Repository r1 = new Jcr(mk1).createRepository();
        Repository r2 = new Jcr(mk2).createRepository();

        Session s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
        Session s2 = r2.login(new SimpleCredentials("admin", "admin".toCharArray()));
View Full Code Here

    }

    @Test
    public void addNodes2() throws Exception {
        for (int i = 0; i < 3; i++) {
            MongoMK mk = new MongoMK.Builder()
                    .setMongoDB(createConnection().getDB())
                    .setAsyncDelay(0)
                    .setClusterId(i + 1).open();
            mks.add(mk);
        }
        final MongoMK mk1 = mks.get(0);
        final MongoMK mk2 = mks.get(1);
        final MongoMK mk3 = mks.get(2);
        Repository r1 = new Jcr(mk1).createRepository();
        Repository r2 = new Jcr(mk2).createRepository();
        Repository r3 = new Jcr(mk3).createRepository();

        Session s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
View Full Code Here

    }

    @Test
    public void rebaseVisibility() throws Exception {
        for (int i = 0; i < 2; i++) {
            MongoMK mk = new MongoMK.Builder()
                    .setMongoDB(createConnection().getDB())
                    .setAsyncDelay(0)
                    .setClusterId(i + 1).open();
            mks.add(mk);
        }
        final MongoMK mk1 = mks.get(0);
        final MongoMK mk2 = mks.get(1);
        Repository r1 = new Jcr(mk1).createRepository();
        Repository r2 = new Jcr(mk2).createRepository();

        Session s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
        Session s2 = r2.login(new SimpleCredentials("admin", "admin".toCharArray()));
View Full Code Here

        }
    }

    private static void initRepository() throws Exception {
        MongoConnection con = createConnection();
        MongoMK mk = new MongoMK.Builder()
                .setMongoDB(con.getDB())
                .setClusterId(1).open();
        Session session = new Jcr(mk).createRepository().login(
                new SimpleCredentials("admin", "admin".toCharArray()));
        session.logout();
        mk.dispose(); // closes connection as well
    }
View Full Code Here

        super(settings);

        Session session = null;
        try {
            this.connection = new MongoConnection(HOST, PORT, DB);
            MongoMK m = new MongoMK.Builder().setClusterId(1).
                    memoryCacheSize(64 * 1024 * 1024).
                    setMongoDB(connection.getDB()).open();
            Jcr jcr = new Jcr(m);
            this.repository = jcr.createRepository();

View Full Code Here

        Runtime.getRuntime().addShutdownHook(
                new Thread(new ShutdownHook(connection)));
    }

    protected Repository createRepository(MongoConnection connection) {
        MongoMK m = new MongoMK.Builder().setClusterId(1).
                memoryCacheSize(64 * 1024 * 1024).
                setMongoDB(connection.getDB()).open();
        Jcr jcr = new Jcr(m);
        return jcr.createRepository();
    }
View Full Code Here

        MemoryBlobStore bs = new MemoryBlobStore();
        MongoMK.Builder builder;

        builder = new MongoMK.Builder();
        builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(1);
        MongoMK mk1 = builder.setClusterId(1).open();
        builder = new MongoMK.Builder();
        builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(1);
        MongoMK mk2 = builder.setClusterId(2).open();

        Oak oak = new Oak(mk1)
                .with(new InitialContent())
                .with(new ReferenceEditorProvider())
                .with(new ReferenceIndexProvider())
View Full Code Here

        ExecutorService executor = Executors.newFixedThreadPool(numberOfMks);
        for (int i = 0; i < numberOfMks; i++) {
            String diff = buildPyramidDiff("/", 0, numberOfChildren,
                    numberOfNodes, prefixes[i], new StringBuilder()).toString();
            MongoMK mk = new MongoMK.Builder().open();
            GenericWriteTask task = new GenericWriteTask("mk-" + i, mk, diff, 10);
            executor.execute(task);
        }
        executor.shutdown();
        executor.awaitTermination(10, TimeUnit.MINUTES);
View Full Code Here

        MemoryBlobStore bs = new MemoryBlobStore();
        MongoMK.Builder builder;

        builder = new MongoMK.Builder();
        builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(1);
        MongoMK mk1 = builder.setClusterId(1).open();
        builder = new MongoMK.Builder();
        builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(1);
        MongoMK mk2 = builder.setClusterId(2).open();

        Oak oak = new Oak(mk1)
                .with(new InitialContent())
                .with(new ReferenceEditorProvider())
                .with(new ReferenceIndexProvider())
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.mongomk.MongoMK

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.