Package src

Examples of src.Config


    IService iservice = new IService(TestConf.host,null,null,null,"./src/test/tmp");   
    iservice.setEventHandle(Constants.CONNECT_EVENT, th);
    iservice.init();
    connectedSignal.await();
   
    Config config = iservice.createConfig("/iserviceTest/node1");
    DefaultData data = (DefaultData) config.get("node3", 123);
    Assert.assertEquals("node3", data.getData());
   
    this.clearUpZK(zk);
    this.clearUpFiles(TestConf.tmpPath);
  }
View Full Code Here


    IService iservice = new IService(TestConf.host,null,null,null,"./src/test/tmp");   
    iservice.setEventHandle(Constants.CONNECT_EVENT, new TestHandler(connectedSignal));
    iservice.init();
    connectedSignal.await();
   
    Config config = iservice.createConfig("/iserviceTest/node1");
    DefaultData data = (DefaultData) config.get("node3", 123);
    Assert.assertEquals("node3", data.getData());
   
   
    CountDownLatch connectedSignal2 = new CountDownLatch(1);
    config.setEventHandle(Constants.DATA_CHANGE_EVENT, new TestHandler(connectedSignal2));
   
    zk.setData("/iserviceTest/node1/node3", "new-node3".getBytes(), -1);
    zk.setData("/iserviceTest/node1", "new-node1".getBytes(), -1);
    connectedSignal2.await();
    DefaultData data2 = (DefaultData) config.get("node3", 123);
    Assert.assertEquals("new-node3", data2.getData());
   
    this.clearUpZK(zk);
    this.clearUpFiles(TestConf.tmpPath);
  }
View Full Code Here

    IService iservice = new IService(TestConf.host,null,null,null,"./src/test/tmp");   
    iservice.setEventHandle(Constants.CONNECT_EVENT, new TestHandler(connectedSignal));
    iservice.init();
    connectedSignal.await();
   
    Config config = iservice.createConfig("/iserviceTest/node1");
    DefaultData data = (DefaultData) config.get("node3", 123);
    Assert.assertEquals("node3", data.getData());
   
    FS.dump(TestConf.tmpPath + "/" + Extends.getPid() + "/iserviceTest/node1/node4.data", "version:1\r\nnew-node4");
   
    CountDownLatch connectedSignal2 = new CountDownLatch(1);
    config.setEventHandle(Constants.DUMP_FAIL_EVENT, new TestHandler(connectedSignal2));
   
    zk.setData("/iserviceTest/node1/node3", "new-node3".getBytes(), -1);
    zk.setData("/iserviceTest/node1", "new-node1".getBytes(), -1);
    connectedSignal2.await();
    DefaultData data2 = (DefaultData) config.get("node3", 123);
    Assert.assertEquals("node3", data2.getData());
   
    this.clearUpZK(zk);
    this.clearUpFiles(TestConf.tmpPath);
  }
View Full Code Here

    IService iservice = new IService("127.0.0.1:6000",null,null,null,"./src/test/tmp");   
    iservice.setEventHandle(Constants.DISCONNECT_EVENT, th);
    iservice.init();
    connectedSignal.await();
   
    Config config = iservice.createConfig("/root/node1");
    DefaultData data = (DefaultData) config.get("info", 111);
    Assert.assertEquals("i'm in newer node", data.getData());
   
    this.clearUpFiles(TestConf.tmpPath);
  }
View Full Code Here

  public void init(){
    this.store.init();
  }
 
  public Config createConfig(String prefix){
    return new Config(prefix, store);
  }
View Full Code Here

    client.setEventHandle(Constants.DISCONNECT_EVENT, new DisconnectHandler());
    client.setEventHandle(Constants.EXPIRED_EVENT, new ExpiredHandler());
    client.init();
   
    String key = "app2/key1";
    Config config = client.createConfig("/IserviceDemoTest/group1");
    config.setEventHandle(Constants.DATA_CHANGE_EVENT, new DataChangeHandler(config, key));
   
    Timer timer = new Timer();
    TimerTask task = new Main2().new GetDataTask(config);
   
    timer.schedule(task, 0, 10000);
View Full Code Here

    client.setEventHandle(Constants.DISCONNECT_EVENT, new DisconnectHandler());
    client.setEventHandle(Constants.EXPIRED_EVENT, new ExpiredHandler());
    client.init();
   
    String key = "key1";
    Config config = client.createConfig("/IserviceDemoTest/group1/app2");
    config.setEventHandle(Constants.DATA_CHANGE_EVENT, new DataChangeHandler(config, key));
   
    Timer timer = new Timer();
    TimerTask task = new Main().new GetDataTask(config);
   
    timer.schedule(task, 0, 10000);
View Full Code Here

TOP

Related Classes of src.Config

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.