Exemplo n.º 1
0
 /// <summary>
 ///     Constructs a create operation.  Arguments are as for the ZooKeeper method of the same name.
 /// </summary>
 /// <param name="path">
 ///     the path for the node
 /// </param>
 /// <param name="data">
 ///     the initial data for the node
 /// </param>
 /// <param name="acl">
 ///     the acl for the node
 /// </param>
 /// <param name="createMode">
 ///     specifying whether the node to be created is ephemeral
 ///     and/or sequential.
 /// </param>
 public Transaction create(string path, byte[] data, List <ACL> acl, CreateMode createMode)
 {
     if (createMode == null)
     {
         throw new ArgumentNullException(nameof(createMode));
     }
     ops.Add(Op.create(path, data, acl, createMode.toFlag()));
     return(this);
 }
Exemplo n.º 2
0
        public void testRoundTrip()
        {
            MultiTransactionRecord request = new MultiTransactionRecord();

            request.add(Op.check("check", 1));
            request.add(Op.create("create", "create data".getBytes(), ZooDefs.Ids.CREATOR_ALL_ACL, (int)ZooDefs.Perms.ALL));
            request.add(Op.delete("delete", 17));
            request.add(Op.setData("setData", "set data".getBytes(), 19));

            MultiTransactionRecord decodedRequest = codeDecode(request);

            Assert.assertEquals(request, decodedRequest);
        }