Examples of StandbyServer


Examples of org.apache.jackrabbit.oak.plugins.segment.standby.server.StandbyServer

    private void bootstrapMaster(ComponentContext context) throws CertificateException, SSLException {
        Dictionary<?, ?> props = context.getProperties();
        int port = PropertiesUtil.toInteger(props.get(PORT), PORT_DEFAULT);
        String[] ranges = PropertiesUtil.toStringArray(props.get(ALLOWED_CLIENT_IP_RANGES), ALLOWED_CLIENT_IP_RANGES_DEFAULT);
        boolean secure = PropertiesUtil.toBoolean(props.get(SECURE), SECURE_DEFAULT);
        primary = new StandbyServer(port, segmentStore, ranges, secure);
        primary.start();
        log.info("started primary on port {} with allowed ip ranges {}.", port, ranges);
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.segment.standby.server.StandbyServer

            }
        }
        store.merge(rootbuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
        storeS.flush();

        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

Examples of org.apache.jackrabbit.oak.plugins.segment.standby.server.StandbyServer

    @Test
    public void testBrokenConnection() throws Exception {

        NodeStore store = new SegmentNodeStore(storeS);
        DebugSegmentStore s = new DebugSegmentStore(storeS);
        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

Examples of org.apache.jackrabbit.oak.plugins.segment.standby.server.StandbyServer

    public void testLocalChanges() throws Exception {

        NodeStore store = new SegmentNodeStore(storeC);
        addTestContent(store, "client");

        final StandbyServer server = new StandbyServer(port, storeS);
        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
TOP
Copyright © 2018 www.massapi.com. 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.