use of org.apache.nifi.controller.status.ProcessorStatus in project nifi-minifi by apache.
the class StatusConfigReporterTest method populateProcessor.
private void populateProcessor(boolean validationErrors, boolean addBulletins) {
if (addBulletins) {
addBulletins("Bulletin message", "UpdateAttributeProcessorId");
}
ProcessorStatus processorStatus = new ProcessorStatus();
processorStatus.setType("org.apache.nifi.processors.attributes.UpdateAttribute");
processorStatus.setId("UpdateAttributeProcessorId");
processorStatus.setName("UpdateAttributeProcessorId");
processorStatus.setRunStatus(RunStatus.Stopped);
processorStatus.setActiveThreadCount(1);
processorStatus.setFlowFilesReceived(2);
processorStatus.setBytesRead(3);
processorStatus.setBytesWritten(4);
processorStatus.setFlowFilesSent(5);
processorStatus.setInvocations(6);
processorStatus.setProcessingNanos(7);
Collection<ProcessorStatus> statusCollection = new ArrayList<>();
statusCollection.add(processorStatus);
mockProcessorEmptyValidation(processorStatus.getId(), processGroup);
when(rootGroupStatus.getProcessorStatus()).thenReturn(statusCollection);
ProcessorNode processorNode = mock(ProcessorNode.class);
when(processGroup.getProcessor(processorStatus.getId())).thenReturn(processorNode);
if (validationErrors) {
ValidationResult validationResult = new ValidationResult.Builder().input("input").subject("subject").explanation("is not valid").build();
ValidationResult validationResult2 = new ValidationResult.Builder().input("input2").subject("subject2").explanation("is not valid too").build();
List<ValidationResult> validationResultList = new ArrayList<>();
validationResultList.add(validationResult);
validationResultList.add(validationResult2);
when(processorNode.getValidationErrors()).thenReturn(validationResultList);
} else {
when(processorNode.getValidationErrors()).thenReturn(Collections.EMPTY_LIST);
}
}
Aggregations