Package com.trendmicro.codi

Examples of com.trendmicro.codi.ZNode.create()


    private boolean createAndSetNode(String path, byte[] data) {
        ZNode node = new ZNode(path);
        try {
            if(!node.exists()) {
                node.create(false, data);
                return true;
            }
            else {
                node.setContent(data);
                return true;
View Full Code Here


         */
        ZNode refRootNode = new ZNode(refRoot);
        for(;;) {
            try {
                if(!refRootNode.exists())
                    refRootNode.create(false, xchgMsg.toString().getBytes());
                else if(new String(refRootNode.getContent()).compareTo(xchgMsg.toString()) != 0)
                    refRootNode.setContent(xchgMsg.toString().getBytes());
                break;
            }
            catch(Exception e) {
View Full Code Here

        /**
         * Create an empty graph called foo
         */
        ZNode fooNode = new ZNode(RouteFarm.graphRoot + "/foo");
        fooNode.create(false, "".getBytes());
        waitForUpdate(routeFarm);
        assertTrue(routeFarm.getRouteTable().isEmpty());

        /**
         * Insert a forwarding rule in foo
View Full Code Here

        /**
         * Add another graph
         */
        ZNode barNode = new ZNode(RouteFarm.graphRoot + "/bar");
        barNode.create(false, "bar.out-");
        waitForUpdate(routeFarm);
        assertNotNull(routeFarm.getDestList("foo.out"));
        assertNotNull(routeFarm.getDestList("bar.out"));
        assertTrue(routeFarm.getDestList("bar.out").contains(""));
        assertTrue(routeFarm.getDestList("foo.out").contains("log.in"));
View Full Code Here

        /**
         * Test add 1 broker node
         */
        ZooKeeperInfo.Broker brk = genBrokerInfo("127.0.0.1", 7676, true, "OpenMQ", false);
        ZNode broker1Node = new ZNode("/broker" + "/127.0.0.1");
        broker1Node.create(false, brk.toString().getBytes());
        waitForUpdate(brokerFarm);
        assertEquals(brk, brokerFarm.getAllBrokers().get("127.0.0.1"));
        assertEquals(1, brokerFarm.getBrokerCount());

        /**
 
View Full Code Here

        /**
         * Test add another broker node
         */
        ZooKeeperInfo.Broker brk2 = genBrokerInfo("127.0.0.2", 7676, true, "OpenMQ", false);
        ZNode broker2Node = new ZNode("/broker" + "/127.0.0.2");
        broker2Node.create(false, brk2.toString().getBytes());
        waitForUpdate(brokerFarm);
        assertEquals(brk2, brokerFarm.getAllBrokers().get("127.0.0.2"));
        assertEquals(2, brokerFarm.getBrokerCount());

        /**
 
View Full Code Here

        /**
         * Test add loading node
         */
        ZooKeeperInfo.Loading loading = genBrokerLoading(10);
        ZNode loading1Node = new ZNode("/broker" + "/127.0.0.1/loading");
        loading1Node.create(false, loading.toString().getBytes());
        waitForUpdate(brokerFarm);
        assertEquals(loading, brokerFarm.getAllLoading().get("127.0.0.1"));

        /**
         * Test add another loading node
View Full Code Here

        /**
         * Test add another loading node
         */
        ZooKeeperInfo.Loading loading2 = genBrokerLoading(10);
        ZNode loading2Node = new ZNode("/broker" + "/127.0.0.2/loading");
        loading2Node.create(false, loading.toString().getBytes());
        waitForUpdate(brokerFarm);
        assertEquals(loading2, brokerFarm.getAllLoading().get("127.0.0.2"));

        /**
         * Test remove broker1
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.