use of org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineActionsProto in project ozone by apache.
the class HeartbeatEndpointTask method addPipelineActions.
/**
* Adds all the pending PipelineActions to the heartbeat.
*
* @param requestBuilder builder to which the report has to be added.
*/
private void addPipelineActions(SCMHeartbeatRequestProto.Builder requestBuilder) {
List<PipelineAction> actions = context.getPendingPipelineAction(rpcEndpoint.getAddress(), maxPipelineActionsPerHB);
if (!actions.isEmpty()) {
PipelineActionsProto pap = PipelineActionsProto.newBuilder().addAllPipelineActions(actions).build();
requestBuilder.setPipelineActions(pap);
}
}
use of org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineActionsProto in project ozone by apache.
the class TestPipelineActionHandler method testCloseActionForMissingPipeline.
@Test
public void testCloseActionForMissingPipeline() throws PipelineNotFoundException, NotLeaderException {
final PipelineManager manager = Mockito.mock(PipelineManager.class);
final EventQueue queue = Mockito.mock(EventQueue.class);
Mockito.when(manager.getPipeline(Mockito.any(PipelineID.class))).thenThrow(new PipelineNotFoundException());
final PipelineActionHandler actionHandler = new PipelineActionHandler(manager, SCMContext.emptyContext(), null);
final PipelineActionsProto actionsProto = PipelineActionsProto.newBuilder().addPipelineActions(PipelineAction.newBuilder().setClosePipeline(ClosePipelineInfo.newBuilder().setPipelineID(HddsProtos.PipelineID.newBuilder().setId(UUID.randomUUID().toString()).build()).setReason(ClosePipelineInfo.Reason.PIPELINE_FAILED)).setAction(PipelineAction.Action.CLOSE).build()).build();
final PipelineActionsFromDatanode pipelineActions = new PipelineActionsFromDatanode(MockDatanodeDetails.randomDatanodeDetails(), actionsProto);
actionHandler.onMessage(pipelineActions, queue);
Mockito.verify(queue, Mockito.times(1)).fireEvent(Mockito.any(), Mockito.any(CommandForDatanode.class));
}
Aggregations