Search in sources :

Example 1 with BlockHeartbeatPResponse

use of alluxio.grpc.BlockHeartbeatPResponse in project alluxio by Alluxio.

the class BlockMasterWorkerServiceHandlerTest method workerHeartbeatFailsOnDuplicateBlockLocation.

@Test
public void workerHeartbeatFailsOnDuplicateBlockLocation() throws Exception {
    long workerId = mBlockMaster.getWorkerId(NET_ADDRESS_1);
    // Prepare LocationBlockIdListEntry objects
    BlockStoreLocation loc = new BlockStoreLocation("MEM", 0);
    BlockStoreLocationProto locationProto = BlockStoreLocationProto.newBuilder().setTierAlias(loc.tierAlias()).setMediumType(loc.mediumType()).build();
    BlockIdList blockIdList1 = BlockIdList.newBuilder().addAllBlockId(ImmutableList.of(1L, 2L)).build();
    LocationBlockIdListEntry listEntry1 = LocationBlockIdListEntry.newBuilder().setKey(locationProto).setValue(blockIdList1).build();
    BlockIdList blockIdList2 = BlockIdList.newBuilder().addAllBlockId(ImmutableList.of(3L, 4L)).build();
    LocationBlockIdListEntry listEntry2 = LocationBlockIdListEntry.newBuilder().setKey(locationProto).setValue(blockIdList2).build();
    BlockHeartbeatPRequest request = BlockHeartbeatPRequest.newBuilder().setWorkerId(workerId).addAddedBlocks(listEntry1).addAddedBlocks(listEntry2).build();
    // Noop response observer
    StreamObserver<BlockHeartbeatPResponse> noopResponseObserver = new StreamObserver<BlockHeartbeatPResponse>() {

        @Override
        public void onNext(BlockHeartbeatPResponse response) {
        }

        @Override
        public void onError(Throwable t) {
        }

        @Override
        public void onCompleted() {
        }
    };
    assertThrows(AssertionError.class, () -> {
        mHandler.blockHeartbeat(request, noopResponseObserver);
    });
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) BlockIdList(alluxio.grpc.BlockIdList) BlockHeartbeatPRequest(alluxio.grpc.BlockHeartbeatPRequest) BlockHeartbeatPResponse(alluxio.grpc.BlockHeartbeatPResponse) BlockStoreLocation(alluxio.worker.block.BlockStoreLocation) BlockStoreLocationProto(alluxio.grpc.BlockStoreLocationProto) LocationBlockIdListEntry(alluxio.grpc.LocationBlockIdListEntry) Test(org.junit.Test)

Aggregations

BlockHeartbeatPRequest (alluxio.grpc.BlockHeartbeatPRequest)1 BlockHeartbeatPResponse (alluxio.grpc.BlockHeartbeatPResponse)1 BlockIdList (alluxio.grpc.BlockIdList)1 BlockStoreLocationProto (alluxio.grpc.BlockStoreLocationProto)1 LocationBlockIdListEntry (alluxio.grpc.LocationBlockIdListEntry)1 BlockStoreLocation (alluxio.worker.block.BlockStoreLocation)1 StreamObserver (io.grpc.stub.StreamObserver)1 Test (org.junit.Test)1