Search in sources :

Example 1 with ResilientActiveKeyValueStore

use of com.baidu.disconf.core.common.zookeeper.inner.ResilientActiveKeyValueStore in project disconf by knightliao.

the class ZookeeperMgr method initInternal.

/**
     * @return void
     *
     * @throws IOException
     * @throws InterruptedException
     * @Description: 初始化
     * @author liaoqiqi
     * @date 2013-6-14
     */
private void initInternal(String hosts, String defaultPrefixString, boolean debug) throws IOException, InterruptedException {
    curHost = hosts;
    curDefaultPrefixString = defaultPrefixString;
    store = new ResilientActiveKeyValueStore(debug);
    store.connect(hosts);
    LOGGER.info("zoo prefix: " + defaultPrefixString);
    // 新建父目录
    makeDir(defaultPrefixString, ZooUtils.getIp());
}
Also used : ResilientActiveKeyValueStore(com.baidu.disconf.core.common.zookeeper.inner.ResilientActiveKeyValueStore)

Example 2 with ResilientActiveKeyValueStore

use of com.baidu.disconf.core.common.zookeeper.inner.ResilientActiveKeyValueStore in project disconf by knightliao.

the class ZookeeperMgrTest method testGetRootChildren.

/**
     * 测试获取Root子节点
     */
@Test
public final void testGetRootChildren() {
    final ZookeeperMgr obj = ZookeeperMgr.getInstance();
    //
    // 注入
    //
    new NonStrictExpectations(obj) {

        {
            ResilientActiveKeyValueStore store = new ResilientActiveKeyValueStoreMock();
            this.setField(obj, "store", store);
        }
    };
    List<String> list = ZookeeperMgr.getInstance().getRootChildren();
    for (String item : list) {
        System.out.println(item);
    }
    Assert.assertTrue(list.size() > 0);
}
Also used : ZookeeperMgr(com.baidu.disconf.core.common.zookeeper.ZookeeperMgr) ResilientActiveKeyValueStore(com.baidu.disconf.core.common.zookeeper.inner.ResilientActiveKeyValueStore) NonStrictExpectations(mockit.NonStrictExpectations) ResilientActiveKeyValueStoreMock(com.baidu.disconf.core.test.zookeeper.mock.ResilientActiveKeyValueStoreMock) Test(org.junit.Test)

Aggregations

ResilientActiveKeyValueStore (com.baidu.disconf.core.common.zookeeper.inner.ResilientActiveKeyValueStore)2 ZookeeperMgr (com.baidu.disconf.core.common.zookeeper.ZookeeperMgr)1 ResilientActiveKeyValueStoreMock (com.baidu.disconf.core.test.zookeeper.mock.ResilientActiveKeyValueStoreMock)1 NonStrictExpectations (mockit.NonStrictExpectations)1 Test (org.junit.Test)1