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

Examples of org.apache.jackrabbit.oak.plugins.segment.standby.client.StandbyClient


        final StandbyServer server = new StandbyServer(port, storeS, ipRanges);
        server.start();
        addTestContent(store, "server");
        storeS.flush()// this speeds up the test a little bit...

        StandbyClient cl = new StandbyClient(host, port, storeC);
        cl.run();

        try {
            if (expectedToWork) {
                assertEquals(storeS.getHead(), storeC.getHead());
            }
            else {
                assertFalse("stores are equal but shouldn't!", storeS.getHead().equals(storeC.getHead()));
            }
        } finally {
            server.close();
            cl.close();
        }

    }
View Full Code Here


        int port = PropertiesUtil.toInteger(props.get(PORT), PORT_DEFAULT);
        long interval = PropertiesUtil.toInteger(props.get(INTERVAL), INTERVAL_DEFAULT);
        String host = PropertiesUtil.toString(props.get(PRIMARY_HOST), PRIMARY_HOST_DEFAULT);
        boolean secure = PropertiesUtil.toBoolean(props.get(SECURE), SECURE_DEFAULT);

        sync = new StandbyClient(host, port, segmentStore, secure);
        Dictionary<Object, Object> dictionary = new Hashtable<Object, Object>();
        dictionary.put("scheduler.period", interval);
        dictionary.put("scheduler.concurrent", false);
        dictionary.put("scheduler.runOn", "SINGLE");
View Full Code Here

        final StandbyServer server = new StandbyServer(port, storeS, useSSL);
        server.start();

        System.setProperty(StandbyClient.CLIENT_ID_PROPERTY_NAME, "Bar");
        StandbyClient cl = new StandbyClient("127.0.0.1", port, storeC, useSSL);

        final MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
        ObjectName status = new ObjectName(StandbyStatusMBean.JMX_NAME + ",id=*");
        ObjectName clientStatus = new ObjectName(cl.getMBeanName());
        ObjectName serverStatus = new ObjectName(server.getMBeanName());

        long start = System.currentTimeMillis();
        cl.run();

        try {
            Set<ObjectName> instances = jmxServer.queryNames(status, null);
            assertEquals(3, instances.size());

            ObjectName connectionStatus = null;
            for (ObjectName s : instances) {
                if (!s.equals(clientStatus) && !s.equals(serverStatus)) connectionStatus = s;
            }
            assertNotNull(connectionStatus);

            long segments = ((Long)jmxServer.getAttribute(connectionStatus, "TransferredSegments")).longValue();
            long bytes = ((Long)jmxServer.getAttribute(connectionStatus, "TransferredSegmentBytes")).longValue();

            System.out.println("did transfer " + segments + " segments with " + bytes + " bytes in " + (System.currentTimeMillis() - start) / 1000 + " seconds.");

            assertEquals(storeS.getHead(), storeC.getHead());

            //compare(segments, "segment", minExpectedSegments, maxExpectedSegments);
            //compare(bytes, "byte", minExpectedBytes, maxExpectedBytes);

        } finally {
            server.close();
            cl.close();
        }
    }
View Full Code Here

        final StandbyServer server = new StandbyServer(port, s);
        s.createReadErrors = true;
        server.start();
        addTestContent(store, "server");

        StandbyClient cl = new StandbyClient("127.0.0.1", port, storeC);
        cl.run();

        try {
            assertFalse("store are not expected to be equal", storeS.getHead().equals(storeC.getHead()));
            s.createReadErrors = false;
            cl.run();
            assertEquals(storeS.getHead(), storeC.getHead());
        } finally {
            server.close();
            cl.close();
        }

    }
View Full Code Here

        server.start();
        store = new SegmentNodeStore(storeS);
        addTestContent(store, "server");
        storeS.flush();

        StandbyClient cl = new StandbyClient("127.0.0.1", port, storeC);
        try {
            assertFalse("stores are not expected to be equal", storeS.getHead().equals(storeC.getHead()));
            cl.run();
            assertEquals(storeS.getHead(), storeC.getHead());
        } finally {
            server.close();
            cl.close();
        }

    }
View Full Code Here

        final StandbyServer server = new StandbyServer(port, storeS, ssl);
        server.start();
        addTestContent(store, "server");
        storeS.flush()// this speeds up the test a little bit...

        StandbyClient cl = new StandbyClient(LOCALHOST, PROXY_PORT, storeC, ssl);
        cl.run();

        try {
            if (skipBytes > 0 || flipPosition >= 0) {
                assertFalse("stores are not expected to be equal", storeS.getHead().equals(storeC.getHead()));
                assertEquals(storeC2.getHead(), storeC.getHead());

                p.reset();
                if (intermediateChange) {
                    addTestContent(store, "server2");
                    storeS.flush();
                }
                cl.run();
            }
            assertEquals(storeS.getHead(), storeC.getHead());
        } finally {
            server.close();
            cl.close();
            p.close();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.segment.standby.client.StandbyClient

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.