Search in sources :

Example 31 with ProcessorStatus

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);
    }
}
Also used : ProcessorNode(org.apache.nifi.controller.ProcessorNode) ArrayList(java.util.ArrayList) ValidationResult(org.apache.nifi.components.ValidationResult) StatusReportPopulator.addProcessorStatus(org.apache.nifi.minifi.commons.status.util.StatusReportPopulator.addProcessorStatus) ProcessorStatus(org.apache.nifi.controller.status.ProcessorStatus)

Aggregations

ProcessorStatus (org.apache.nifi.controller.status.ProcessorStatus)31 ProcessGroupStatus (org.apache.nifi.controller.status.ProcessGroupStatus)21 ArrayList (java.util.ArrayList)18 ConnectionStatus (org.apache.nifi.controller.status.ConnectionStatus)12 PortStatus (org.apache.nifi.controller.status.PortStatus)9 RemoteProcessGroupStatus (org.apache.nifi.controller.status.RemoteProcessGroupStatus)9 Test (org.junit.Test)9 List (java.util.List)6 Map (java.util.Map)6 ProcessorNode (org.apache.nifi.controller.ProcessorNode)6 ProcessGroup (org.apache.nifi.groups.ProcessGroup)6 RemoteProcessGroup (org.apache.nifi.groups.RemoteProcessGroup)6 HashMap (java.util.HashMap)5 Set (java.util.Set)5 ValidationResult (org.apache.nifi.components.ValidationResult)5 Collection (java.util.Collection)4 Collections (java.util.Collections)4 Date (java.util.Date)4 LinkedHashMap (java.util.LinkedHashMap)4 LinkedHashSet (java.util.LinkedHashSet)4