Search in sources :

Example 46 with BinaryOutputArchive

use of org.apache.jute.BinaryOutputArchive in project zookeeper by apache.

the class MultiOpSessionUpgradeTest method makeGetDataRequest.

private Request makeGetDataRequest(String path, long sessionId) throws IOException {
    ByteArrayOutputStream boas = new ByteArrayOutputStream();
    BinaryOutputArchive boa = BinaryOutputArchive.getArchive(boas);
    GetDataRequest getDataRequest = new GetDataRequest(path, false);
    getDataRequest.serialize(boa, "request");
    ByteBuffer bb = ByteBuffer.wrap(boas.toByteArray());
    return new Request(null, sessionId, 1, ZooDefs.OpCode.getData, bb, new ArrayList<Id>());
}
Also used : BinaryOutputArchive(org.apache.jute.BinaryOutputArchive) GetDataRequest(org.apache.zookeeper.proto.GetDataRequest) CreateRequest(org.apache.zookeeper.proto.CreateRequest) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Id(org.apache.zookeeper.data.Id) GetDataRequest(org.apache.zookeeper.proto.GetDataRequest) ByteBuffer(java.nio.ByteBuffer)

Example 47 with BinaryOutputArchive

use of org.apache.jute.BinaryOutputArchive in project zookeeper by apache.

the class MultiOpSessionUpgradeTest method makeCreateRequest.

private Request makeCreateRequest(String path, long sessionId) throws IOException {
    ByteArrayOutputStream boas = new ByteArrayOutputStream();
    BinaryOutputArchive boa = BinaryOutputArchive.getArchive(boas);
    CreateRequest createRequest = new CreateRequest(path, "data".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL.toFlag());
    createRequest.serialize(boa, "request");
    ByteBuffer bb = ByteBuffer.wrap(boas.toByteArray());
    return new Request(null, sessionId, 1, ZooDefs.OpCode.create2, bb, new ArrayList<Id>());
}
Also used : BinaryOutputArchive(org.apache.jute.BinaryOutputArchive) CreateRequest(org.apache.zookeeper.proto.CreateRequest) GetDataRequest(org.apache.zookeeper.proto.GetDataRequest) CreateRequest(org.apache.zookeeper.proto.CreateRequest) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Id(org.apache.zookeeper.data.Id) ByteBuffer(java.nio.ByteBuffer)

Aggregations

BinaryOutputArchive (org.apache.jute.BinaryOutputArchive)47 ByteArrayOutputStream (java.io.ByteArrayOutputStream)41 ByteBuffer (java.nio.ByteBuffer)18 Test (org.junit.jupiter.api.Test)16 BinaryInputArchive (org.apache.jute.BinaryInputArchive)12 CreateRequest (org.apache.zookeeper.proto.CreateRequest)11 ByteArrayInputStream (java.io.ByteArrayInputStream)10 IOException (java.io.IOException)10 TxnHeader (org.apache.zookeeper.txn.TxnHeader)10 Id (org.apache.zookeeper.data.Id)9 Record (org.apache.jute.Record)8 SetDataRequest (org.apache.zookeeper.proto.SetDataRequest)7 CreateTxn (org.apache.zookeeper.txn.CreateTxn)7 Request (org.apache.zookeeper.server.Request)6 ArrayList (java.util.ArrayList)5 DeleteTxn (org.apache.zookeeper.txn.DeleteTxn)5 MultiTxn (org.apache.zookeeper.txn.MultiTxn)5 Txn (org.apache.zookeeper.txn.Txn)5 BufferedOutputStream (java.io.BufferedOutputStream)4 KeeperException (org.apache.zookeeper.KeeperException)4