Search in sources :

Example 1 with ReadRequest

use of org.apache.bookkeeper.proto.BookkeeperProtocol.ReadRequest in project bookkeeper by apache.

the class TestBookieRequestProcessor method testFlagsV3.

@Test
public void testFlagsV3() {
    ReadRequest read = ReadRequest.newBuilder().setLedgerId(10).setEntryId(1).setFlag(ReadRequest.Flag.FENCE_LEDGER).build();
    assertTrue(RequestUtils.hasFlag(read, ReadRequest.Flag.FENCE_LEDGER));
    assertFalse(RequestUtils.hasFlag(read, ReadRequest.Flag.ENTRY_PIGGYBACK));
    read = ReadRequest.newBuilder().setLedgerId(10).setEntryId(1).setFlag(ReadRequest.Flag.ENTRY_PIGGYBACK).build();
    assertFalse(RequestUtils.hasFlag(read, ReadRequest.Flag.FENCE_LEDGER));
    assertTrue(RequestUtils.hasFlag(read, ReadRequest.Flag.ENTRY_PIGGYBACK));
    read = ReadRequest.newBuilder().setLedgerId(10).setEntryId(1).build();
    assertFalse(RequestUtils.hasFlag(read, ReadRequest.Flag.FENCE_LEDGER));
    assertFalse(RequestUtils.hasFlag(read, ReadRequest.Flag.ENTRY_PIGGYBACK));
    AddRequest add = AddRequest.newBuilder().setLedgerId(10).setEntryId(1).setFlag(AddRequest.Flag.RECOVERY_ADD).setMasterKey(ByteString.EMPTY).setBody(ByteString.EMPTY).build();
    assertTrue(RequestUtils.hasFlag(add, AddRequest.Flag.RECOVERY_ADD));
    add = AddRequest.newBuilder().setLedgerId(10).setEntryId(1).setMasterKey(ByteString.EMPTY).setBody(ByteString.EMPTY).build();
    assertFalse(RequestUtils.hasFlag(add, AddRequest.Flag.RECOVERY_ADD));
    add = AddRequest.newBuilder().setLedgerId(10).setEntryId(1).setFlag(AddRequest.Flag.RECOVERY_ADD).setMasterKey(ByteString.EMPTY).setBody(ByteString.EMPTY).build();
    assertTrue(RequestUtils.hasFlag(add, AddRequest.Flag.RECOVERY_ADD));
}
Also used : AddRequest(org.apache.bookkeeper.proto.BookkeeperProtocol.AddRequest) ReadRequest(org.apache.bookkeeper.proto.BookkeeperProtocol.ReadRequest) Test(org.junit.Test)

Aggregations

AddRequest (org.apache.bookkeeper.proto.BookkeeperProtocol.AddRequest)1 ReadRequest (org.apache.bookkeeper.proto.BookkeeperProtocol.ReadRequest)1 Test (org.junit.Test)1