Package src

Examples of src.Store


    this.root  = (null == root? this.root  : root;
    this.user  = (null == user? this.user  : user;
    this.pass  = (null == pass? this.pass  : pass;
    this.cache = (null == cache) ? this.cache : cache;
   
    store = new Store(this.hosts, this.root, this.user, this.pass, this.cache);
  }
View Full Code Here


  public void setUp(){
    this.clearUpFiles(TestConf.tmpPath);
  }
 
  public void testCreateZkError() throws Exception{   
    Store s = new Store("127.0.0.1:6000", TestConf.root, "", "", TestConf.tmpPath);
    CountDownLatch connectedSignal = new CountDownLatch(1);
    s.setEventHandle(Constants.GLOBAL_PREFIX, Constants.DISCONNECT_EVENT, new TestHandler(connectedSignal));
    s.init();
    connectedSignal.await();
  }
View Full Code Here

  }
 
  public void testDump() throws Exception{
    ZooKeeper zk = this.initZk();
   
    Store s = new Store(TestConf.host, TestConf.root, "", "", TestConf.tmpPath);
    s.init();
    s.dump("/iserviceTest/node1");
   
    int pid = Extends.getPid();
    String content = FS.read(TestConf.tmpPath + "/" + pid + "/iserviceTest/node1/node1.data");
    Assert.assertEquals("version:0\r\nnode1-node1-node1", content);
   
View Full Code Here

    FS.dump(TestConf.tmpPath + "/" + pid + "/iserviceTest/node2/node.data", "version:0\r\ni'm node2/node.data for check");
    FS.dump(TestConf.tmpPath + "/" + pid + "/iserviceTest/node2.data", "version:0\r\ni'm node2.data for check");
    FS.dump(TestConf.tmpPath + "/" + pid + "/iserviceTest/node1/node1.data", "version:-1\r\ni'm node1/node1.data for check");
    FS.dump(TestConf.tmpPath + "/" + pid + "/iserviceTest/node1.data", "version:-1\r\ni'm node1.data for check");
   
    Store s = new Store(TestConf.host, TestConf.root, "", "", TestConf.tmpPath);
    s.init();
    s.dump("/iserviceTest/node1");
   
   
    String content = FS.read(TestConf.tmpPath + "/" + pid + "/iserviceTest/node1/node1.data");
    Assert.assertEquals("version:0\r\nnode1-node1-node1", content);
   
View Full Code Here

    FS.dump(TestConf.tmpPath + "/root.data", "version:0\r\ni'am root");
    FS.dump(TestConf.tmpPath + "/root/node1.data", "version:0\r\ni'am node1");
    FS.dump(TestConf.tmpPath + "/root/node2.data", "version:0\r\ni'am node2");
    FS.dump(TestConf.tmpPath + "/root/node2/node3.data", "version:0\r\ni'am node3");
   
    Store s = new Store(TestConf.host, TestConf.root, "", "", TestConf.tmpPath);
    s.load(TestConf.tmpPath + "/root", "/root");
   
    Assert.assertEquals("i'am node1", s.get("/root/node1"));
    Assert.assertEquals("i'am node2", s.get("/root/node2"));
    Assert.assertEquals("i'am node3", s.get("/root/node2/node3"));
   
    FS.rmdir(TestConf.tmpPath + "/root");
    FS.rmdir(TestConf.tmpPath + "/root.data");
  }
View Full Code Here

    FS.dump(TestConf.tmpPath + "/234/root/node1.data", "version:1\r\ni'm node1(newer)");
    FS.dump(TestConf.tmpPath + "/234/root/node2/node2-node1.data", "version:1\r\ni'm node2-node1(newer)");
    FS.dump(TestConf.tmpPath + "/234/root/node2.data", "version:0\r\ni'm node2(older)");
    FS.dump(TestConf.tmpPath + "/234/root/node3.data", "version:0\r\ni'm node3(older)");
   
    Store s = new Store(TestConf.host, TestConf.root, "", "", TestConf.tmpPath);
    s.totalLoad(TestConf.tmpPath);
   
    Assert.assertEquals("version:1\r\ni'm node1(newer)", FS.read(TestConf.tmpPath + "/" + Extends.getPid() + "/root/node1.data"));
    Assert.assertEquals("version:1\r\ni'm node2(newer)", FS.read(TestConf.tmpPath + "/" + Extends.getPid() + "/root/node2.data"));
    Assert.assertEquals("version:1\r\ni'm node3(newer)", FS.read(TestConf.tmpPath + "/" + Extends.getPid() + "/root/node3.data"));
   
View Full Code Here

  public void testMd5(){
    FS.dump(TestConf.tmpPath + "/group1/file1", "test1");
    FS.dump(TestConf.tmpPath + "/group1/app1/file2", "test2");
    FS.dump(TestConf.tmpPath + "/group1/app1/file3", "test3");
   
    Store s = new Store(TestConf.host, TestConf.root, "", "", TestConf.tmpPath);
   
    String pre = s.calMd5(TestConf.tmpPath + "/group1");
    FS.dump(TestConf.tmpPath + "/group1/app1/file2", "test22");
    String after = s.calMd5(TestConf.tmpPath + "/group1");
   
    Assert.assertFalse(pre.equals(after));
   
    FS.rmdir(TestConf.tmpPath + "/group1");
  }
View Full Code Here

TOP

Related Classes of src.Store

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.