private void DeletePreviousData(string path) { Stat stat = ZkActions.Exists(path, false); if (stat != null) { ZkActions.Delete(path, stat.Version); } }
public void NewZNodeShouldExistsWithTheInsertedDataAfterCreation() { string path = "/TestCreate"; DeletePreviousData(path); byte[] testRawData = TextConvertor.GetBytesFromTextAscii("Test Create"); ZkActions.Create(path, testRawData, Ids.OPEN_ACL_UNSAFE, CreateMode.Ephemeral); Stat stat = ZkActions.Exists(path, false); byte[] returnedRawData = ZkActions.GetData(path, false, stat); Assert.AreEqual("Test Create", TextConvertor.GetSTextFromBytesAscii(returnedRawData)); }
public void StressTestZnodesShouldBeCreatedWhenRunningTest() { MainWindow.ZkActions = ZkActions; string path = "/StressTest"; Assert.Null(ZkActions.Exists(path, false)); StressTestHandler stressTestHandler = new StressTestHandler(2, path, TextConvertor); stressTestHandler.CreateStressTest(); Thread.Sleep(1000); Assert.NotNull(ZkActions.Exists(path + "/0", false)); Assert.NotNull(ZkActions.Exists(path + "/1", false)); stressTestHandler.KeepRunning = false; }
private Stat CreateNodeWithdata(string path, string testData) { byte[] testRawData = TextConvertor.GetBytesFromTextAscii(testData); ZkActions.Create(path, testRawData, Ids.OPEN_ACL_UNSAFE, CreateMode.Persistent); return(ZkActions.Exists(path, false)); }