public string Create(string path, object data, List <ACL> acl, CreateMode mode) { if (path == null) { throw new ArgumentNullException("Missing value for path"); } if (acl == null || acl.Count == 0) { throw new ArgumentNullException("Missing value for ACL"); } byte[] bytes = data == null ? null : Serialize(data); return(RetryUntilConnected(() => { return _connection.Create(path, bytes, acl, mode); })); }
public void TestSequentials() { _connection = EstablishConnection(); string sequentialPath = _connection.Create("/a", new byte[0], CreateMode.EphemeralSequential); int firstSequential = int.Parse(sequentialPath.Substring(2)); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == sequentialPath); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/a", new byte[0], CreateMode.EphemeralSequential)); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/a", new byte[0], CreateMode.EphemeralSequential)); Assert.True("/b" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/b", new byte[0], CreateMode.EphemeralSequential)); Assert.True("/b" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/b", new byte[0], CreateMode.EphemeralSequential)); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/a", new byte[0], CreateMode.EphemeralSequential)); _connection.Close(); _connection = null; }