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));
}
Aggregations