Package zk

Examples of zk.ZkCtl


  public void testConnectOk() throws InterruptedException{
    CountDownLatch connectedSignal = new CountDownLatch(1);
    TestStore ts = new TestStore("","","","","");
    ts.setSignal(connectedSignal);
   
    new ZkCtl(TestConf.host, TestConf.root, "", "", ts);
    connectedSignal.await();
    Assert.assertEquals(Constants.ZK_OK, ts.type);
  }
View Full Code Here


  public void testConnectToWrongAddress() throws InterruptedException{   
    CountDownLatch connectedSignal = new CountDownLatch(1);
    TestStore ts = new TestStore("","","","","");
    ts.setSignal(connectedSignal);
   
    new ZkCtl("127.0.0.1:6000", "/", "", "", ts);
    connectedSignal.await();
    Assert.assertEquals(Constants.ZK_NOT_CONNECT, ts.type);
  }
View Full Code Here

    for(int i = 0; i < times; i++){
      CountDownLatch connectedSignal = new CountDownLatch(1);
      TestStore ts = new TestStore("","","","","");
      ts.setSignal(connectedSignal);
     
      new ZkCtl("127.0.0.1:6000," + TestConf.host, TestConf.root, "", "", ts);
      connectedSignal.await();
      Assert.assertEquals(Constants.ZK_OK, ts.type);
    }
  }
View Full Code Here

  }
 
  public void testGetTree() throws Exception {
    ZooKeeper zk = this.initZk();
   
    ZkCtl zkCtl = new ZkCtl(TestConf.host, TestConf.root, "", "", null);
    HashMap<String, String> map = zkCtl.getTree("/iserviceTest/node1");
    Assert.assertEquals("version:0\r\nnode1-node1", map.get("/iserviceTest/node1"));
    Assert.assertEquals("version:0\r\nnode1-node1-node1", map.get("/iserviceTest/node1/node1"));
   
    this.clearUpZk(zk);
  }
View Full Code Here

    ZooKeeper zk = this.initZk();
   
    CountDownLatch connectedSignal = new CountDownLatch(1);
    TestStore ts = new TestStore("","","","","");
    ts.setSignal(connectedSignal);
    ZkCtl zkCtl = new ZkCtl(TestConf.host, TestConf.root, "", "", ts);
    zkCtl.watch("/iserviceTest/node1");
    zk.setData("/iserviceTest/node1", "node1-node1-new".getBytes(), 0);

    connectedSignal.await();
    this.clearUpZk(zk);
  }
View Full Code Here

    this.cache = cache;
    this.stack = new Stack<String>();
  }
 
  public void init(){
    this.zkCtl = new ZkCtl(this.hosts, this.root, this.user, this.pass, this);
  }
View Full Code Here

TOP

Related Classes of zk.ZkCtl

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.