Ejemplo n.º 1
0
        public void TestEphemeralNodeCleanup()
        {
            var zkClient = new ZkClient(ZkConnect, ZkSessionTimeoutMs, ZkConnectionTimeout, new ZkStringSerializer());

            try
            {
                ZkUtils.CreateEphemeralPathExpectConflict(zkClient, "/tmp/zktest", "node created");
            }
            catch
            {
                // ok
            }

            var testData = ZkUtils.ReadData(this.ZkClient, "/tmp/zktest").Item1;

            Assert.NotNull(testData);
            zkClient.Dispose();
            zkClient = new ZkClient(ZkConnect, ZkSessionTimeoutMs, ZkConnectionTimeout, new ZkStringSerializer());
            var nodeExists = ZkUtils.PathExists(zkClient, "/tmp/zktest");

            Assert.False(nodeExists);
        }