Search in sources :

Example 16 with OutputArchive

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

the class TxnLogCountTest method mockTxnRequest.

private Request mockTxnRequest() throws IOException {
    TxnHeader header = mock(TxnHeader.class);
    doAnswer(new Answer() {

        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            Object[] args = invocation.getArguments();
            OutputArchive oa = (OutputArchive) args[0];
            oa.writeString("header", "test");
            return null;
        }
    }).when(header).serialize(any(OutputArchive.class), anyString());
    Request request = new Request(1, 2, 3, header, null, 4);
    return request;
}
Also used : Answer(org.mockito.stubbing.Answer) Mockito.doAnswer(org.mockito.Mockito.doAnswer) OutputArchive(org.apache.jute.OutputArchive) InvocationOnMock(org.mockito.invocation.InvocationOnMock) TxnHeader(org.apache.zookeeper.txn.TxnHeader)

Aggregations

OutputArchive (org.apache.jute.OutputArchive)16 BinaryOutputArchive (org.apache.jute.BinaryOutputArchive)14 BinaryInputArchive (org.apache.jute.BinaryInputArchive)7 File (java.io.File)6 InputArchive (org.apache.jute.InputArchive)6 TxnHeader (org.apache.zookeeper.txn.TxnHeader)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 ServerSocket (java.net.ServerSocket)4 Socket (java.net.Socket)4 CheckedOutputStream (java.util.zip.CheckedOutputStream)4 ZabUtils.createQuorumPeer (org.apache.zookeeper.server.quorum.ZabUtils.createQuorumPeer)4 Test (org.junit.jupiter.api.Test)4 Mockito.doAnswer (org.mockito.Mockito.doAnswer)4 InvocationOnMock (org.mockito.invocation.InvocationOnMock)4 Answer (org.mockito.stubbing.Answer)4 IOException (java.io.IOException)3 Record (org.apache.jute.Record)3 Request (org.apache.zookeeper.server.Request)3 BufferedInputStream (java.io.BufferedInputStream)2 EOFException (java.io.EOFException)2