Search in sources :

Example 1 with BulletinStatus

use of org.apache.nifi.minifi.commons.status.common.BulletinStatus in project nifi-minifi by apache.

the class StatusRequestParser method transformBulletins.

private static List<BulletinStatus> transformBulletins(List<Bulletin> bulletinList) {
    List<BulletinStatus> bulletinStatusList = new LinkedList<>();
    if (!bulletinList.isEmpty()) {
        for (Bulletin bulletin : bulletinList) {
            BulletinStatus bulletinStatus = new BulletinStatus();
            bulletinStatus.setMessage(bulletin.getMessage());
            bulletinStatus.setTimestamp(bulletin.getTimestamp());
            bulletinStatusList.add(bulletinStatus);
        }
    }
    return bulletinStatusList;
}
Also used : Bulletin(org.apache.nifi.reporting.Bulletin) BulletinStatus(org.apache.nifi.minifi.commons.status.common.BulletinStatus) LinkedList(java.util.LinkedList)

Example 2 with BulletinStatus

use of org.apache.nifi.minifi.commons.status.common.BulletinStatus in project nifi-minifi by apache.

the class StatusReportPopulator method addInstanceStatus.

public static void addInstanceStatus(FlowStatusReport flowStatusReport, boolean addHealth, boolean addStats, boolean addBulletins, boolean populateBulletins) {
    InstanceStatus instanceStatus = new InstanceStatus();
    if (addHealth) {
        InstanceHealth instanceHealth = new InstanceHealth();
        instanceHealth.setQueuedContentSize(1L);
        instanceHealth.setQueuedCount(2);
        instanceHealth.setActiveThreads(3);
        instanceHealth.setHasBulletins(populateBulletins);
        instanceStatus.setInstanceHealth(instanceHealth);
    }
    if (addBulletins) {
        if (populateBulletins) {
            BulletinStatus bulletinStatus = new BulletinStatus();
            bulletinStatus.setMessage("Bulletin message");
            bulletinStatus.setTimestamp(new Date(1464019245000L));
            instanceStatus.setBulletinList(Collections.singletonList(bulletinStatus));
        } else {
            instanceStatus.setBulletinList(Collections.EMPTY_LIST);
        }
    }
    if (addStats) {
        InstanceStats instanceStats = new InstanceStats();
        instanceStats.setBytesRead(1L);
        instanceStats.setBytesWritten(2L);
        instanceStats.setBytesSent(3L);
        instanceStats.setFlowfilesSent(4);
        instanceStats.setBytesTransferred(5L);
        instanceStats.setFlowfilesTransferred(6);
        instanceStats.setBytesReceived(7L);
        instanceStats.setFlowfilesReceived(8);
        instanceStatus.setInstanceStats(instanceStats);
    }
    flowStatusReport.setInstanceStatus(instanceStatus);
}
Also used : InstanceStats(org.apache.nifi.minifi.commons.status.instance.InstanceStats) InstanceStatus(org.apache.nifi.minifi.commons.status.instance.InstanceStatus) InstanceHealth(org.apache.nifi.minifi.commons.status.instance.InstanceHealth) BulletinStatus(org.apache.nifi.minifi.commons.status.common.BulletinStatus) Date(java.util.Date)

Example 3 with BulletinStatus

use of org.apache.nifi.minifi.commons.status.common.BulletinStatus in project nifi-minifi by apache.

the class StatusReportPopulator method addExpectedRemoteProcessGroupStatus.

public static void addExpectedRemoteProcessGroupStatus(FlowStatusReport flowStatusReport, boolean addHealth, boolean addInputPort, boolean addOutputPort, boolean addStats, boolean addBulletins, boolean populateBulletins) {
    RemoteProcessGroupStatusBean expectedRemoteProcessGroupStatus = new RemoteProcessGroupStatusBean();
    expectedRemoteProcessGroupStatus.setName("rpg1");
    if (addHealth) {
        RemoteProcessGroupHealth remoteProcessGroupHealth = new RemoteProcessGroupHealth();
        remoteProcessGroupHealth.setTransmissionStatus("Transmitting");
        remoteProcessGroupHealth.setHasBulletins(populateBulletins);
        remoteProcessGroupHealth.setActivePortCount(1);
        remoteProcessGroupHealth.setInactivePortCount(2);
        expectedRemoteProcessGroupStatus.setRemoteProcessGroupHealth(remoteProcessGroupHealth);
    }
    if (addBulletins) {
        if (populateBulletins) {
            BulletinStatus bulletinStatus = new BulletinStatus();
            bulletinStatus.setMessage("Bulletin message");
            bulletinStatus.setTimestamp(new Date(1464019245000L));
            expectedRemoteProcessGroupStatus.setBulletinList(Collections.singletonList(bulletinStatus));
        } else {
            expectedRemoteProcessGroupStatus.setBulletinList(Collections.EMPTY_LIST);
        }
    }
    if (addInputPort) {
        PortStatus expectedInputPortStatus = new PortStatus();
        expectedInputPortStatus.setName("inputPort");
        expectedInputPortStatus.setTargetExists(true);
        expectedInputPortStatus.setTargetRunning(false);
        expectedRemoteProcessGroupStatus.setInputPortStatusList(Collections.singletonList(expectedInputPortStatus));
    }
    if (addOutputPort) {
        PortStatus expectedOutputPortStatus = new PortStatus();
        expectedOutputPortStatus.setName("outputPort");
        expectedOutputPortStatus.setTargetExists(true);
        expectedOutputPortStatus.setTargetRunning(false);
        expectedRemoteProcessGroupStatus.setOutputPortStatusList(Collections.singletonList(expectedOutputPortStatus));
    }
    if (addStats) {
        RemoteProcessGroupStats remoteProcessGroupStats = new RemoteProcessGroupStats();
        remoteProcessGroupStats.setActiveThreads(3);
        remoteProcessGroupStats.setSentContentSize(4L);
        remoteProcessGroupStats.setSentCount(5);
        expectedRemoteProcessGroupStatus.setRemoteProcessGroupStats(remoteProcessGroupStats);
    }
    flowStatusReport.setRemoteProcessGroupStatusList(Collections.singletonList(expectedRemoteProcessGroupStatus));
}
Also used : RemoteProcessGroupStatusBean(org.apache.nifi.minifi.commons.status.rpg.RemoteProcessGroupStatusBean) RemoteProcessGroupStats(org.apache.nifi.minifi.commons.status.rpg.RemoteProcessGroupStats) PortStatus(org.apache.nifi.minifi.commons.status.rpg.PortStatus) RemoteProcessGroupHealth(org.apache.nifi.minifi.commons.status.rpg.RemoteProcessGroupHealth) BulletinStatus(org.apache.nifi.minifi.commons.status.common.BulletinStatus) Date(java.util.Date)

Example 4 with BulletinStatus

use of org.apache.nifi.minifi.commons.status.common.BulletinStatus in project nifi-minifi by apache.

the class StatusReportPopulator method addControllerServiceStatus.

public static void addControllerServiceStatus(FlowStatusReport flowStatusReport, boolean addHealth, boolean addValidationErrors, boolean addBulletins, boolean populateBulletins) {
    ControllerServiceStatus controllerServiceStatus = new ControllerServiceStatus();
    controllerServiceStatus.setName("mockControllerService");
    if (addBulletins) {
        if (populateBulletins) {
            BulletinStatus bulletinStatus = new BulletinStatus();
            bulletinStatus.setMessage("Bulletin message");
            bulletinStatus.setTimestamp(new Date(1464019245000L));
            controllerServiceStatus.setBulletinList(Collections.singletonList(bulletinStatus));
        } else {
            controllerServiceStatus.setBulletinList(Collections.EMPTY_LIST);
        }
    }
    if (addHealth) {
        ControllerServiceHealth controllerServiceHealth = new ControllerServiceHealth();
        controllerServiceHealth.setState("ENABLED");
        controllerServiceHealth.setHasBulletins(populateBulletins);
        controllerServiceStatus.setControllerServiceHealth(controllerServiceHealth);
        if (addValidationErrors) {
            List<ValidationError> validationErrorList = new LinkedList<>();
            ValidationError validationError1 = new ValidationError();
            validationError1.setInput("input");
            validationError1.setSubject("subject");
            validationError1.setReason("is not valid");
            validationErrorList.add(validationError1);
            ValidationError validationError2 = new ValidationError();
            validationError2.setInput("input2");
            validationError2.setSubject("subject2");
            validationError2.setReason("is not valid too");
            validationErrorList.add(validationError2);
            controllerServiceHealth.setValidationErrorList(validationErrorList);
        } else {
            controllerServiceHealth.setValidationErrorList(Collections.EMPTY_LIST);
        }
    }
    flowStatusReport.setControllerServiceStatusList(Collections.singletonList(controllerServiceStatus));
}
Also used : ControllerServiceHealth(org.apache.nifi.minifi.commons.status.controllerservice.ControllerServiceHealth) ControllerServiceStatus(org.apache.nifi.minifi.commons.status.controllerservice.ControllerServiceStatus) ValidationError(org.apache.nifi.minifi.commons.status.common.ValidationError) BulletinStatus(org.apache.nifi.minifi.commons.status.common.BulletinStatus) Date(java.util.Date) LinkedList(java.util.LinkedList)

Example 5 with BulletinStatus

use of org.apache.nifi.minifi.commons.status.common.BulletinStatus in project nifi-minifi by apache.

the class StatusReportPopulator method addProcessorStatus.

public static void addProcessorStatus(FlowStatusReport flowStatusReport, boolean addHealth, boolean validationErrors, boolean addStats, boolean addBulletins, boolean populateBulletins) {
    ProcessorStatusBean expectedProcessorStatus = new ProcessorStatusBean();
    expectedProcessorStatus.setName("UpdateAttributeProcessorId");
    if (addHealth) {
        ProcessorHealth processorHealth = new ProcessorHealth();
        processorHealth.setHasBulletins(populateBulletins);
        processorHealth.setRunStatus("Stopped");
        if (validationErrors) {
            List<ValidationError> validationErrorList = new LinkedList<>();
            ValidationError validationError1 = new ValidationError();
            validationError1.setInput("input");
            validationError1.setSubject("subject");
            validationError1.setReason("is not valid");
            validationErrorList.add(validationError1);
            ValidationError validationError2 = new ValidationError();
            validationError2.setInput("input2");
            validationError2.setSubject("subject2");
            validationError2.setReason("is not valid too");
            validationErrorList.add(validationError2);
            processorHealth.setValidationErrorList(validationErrorList);
        } else {
            processorHealth.setValidationErrorList(Collections.EMPTY_LIST);
        }
        expectedProcessorStatus.setProcessorHealth(processorHealth);
    }
    if (addStats) {
        ProcessorStats expectedProcessorStats = new ProcessorStats();
        expectedProcessorStats.setActiveThreads(1);
        expectedProcessorStats.setFlowfilesReceived(2);
        expectedProcessorStats.setBytesRead(3);
        expectedProcessorStats.setBytesWritten(4);
        expectedProcessorStats.setFlowfilesSent(5);
        expectedProcessorStats.setInvocations(6);
        expectedProcessorStats.setProcessingNanos(7);
        expectedProcessorStatus.setProcessorStats(expectedProcessorStats);
    }
    if (addBulletins) {
        if (populateBulletins) {
            BulletinStatus bulletinStatus = new BulletinStatus();
            bulletinStatus.setMessage("Bulletin message");
            bulletinStatus.setTimestamp(new Date(1464019245000L));
            expectedProcessorStatus.setBulletinList(Collections.singletonList(bulletinStatus));
        } else {
            expectedProcessorStatus.setBulletinList(Collections.EMPTY_LIST);
        }
    }
    flowStatusReport.setProcessorStatusList(Collections.singletonList(expectedProcessorStatus));
}
Also used : ProcessorStatusBean(org.apache.nifi.minifi.commons.status.processor.ProcessorStatusBean) ValidationError(org.apache.nifi.minifi.commons.status.common.ValidationError) BulletinStatus(org.apache.nifi.minifi.commons.status.common.BulletinStatus) ProcessorHealth(org.apache.nifi.minifi.commons.status.processor.ProcessorHealth) LinkedList(java.util.LinkedList) Date(java.util.Date) ProcessorStats(org.apache.nifi.minifi.commons.status.processor.ProcessorStats) SystemProcessorStats(org.apache.nifi.minifi.commons.status.system.SystemProcessorStats)

Aggregations

BulletinStatus (org.apache.nifi.minifi.commons.status.common.BulletinStatus)6 Date (java.util.Date)5 LinkedList (java.util.LinkedList)4 ValidationError (org.apache.nifi.minifi.commons.status.common.ValidationError)3 ControllerServiceHealth (org.apache.nifi.minifi.commons.status.controllerservice.ControllerServiceHealth)1 ControllerServiceStatus (org.apache.nifi.minifi.commons.status.controllerservice.ControllerServiceStatus)1 InstanceHealth (org.apache.nifi.minifi.commons.status.instance.InstanceHealth)1 InstanceStats (org.apache.nifi.minifi.commons.status.instance.InstanceStats)1 InstanceStatus (org.apache.nifi.minifi.commons.status.instance.InstanceStatus)1 ProcessorHealth (org.apache.nifi.minifi.commons.status.processor.ProcessorHealth)1 ProcessorStats (org.apache.nifi.minifi.commons.status.processor.ProcessorStats)1 ProcessorStatusBean (org.apache.nifi.minifi.commons.status.processor.ProcessorStatusBean)1 ReportingTaskHealth (org.apache.nifi.minifi.commons.status.reportingTask.ReportingTaskHealth)1 ReportingTaskStatus (org.apache.nifi.minifi.commons.status.reportingTask.ReportingTaskStatus)1 PortStatus (org.apache.nifi.minifi.commons.status.rpg.PortStatus)1 RemoteProcessGroupHealth (org.apache.nifi.minifi.commons.status.rpg.RemoteProcessGroupHealth)1 RemoteProcessGroupStats (org.apache.nifi.minifi.commons.status.rpg.RemoteProcessGroupStats)1 RemoteProcessGroupStatusBean (org.apache.nifi.minifi.commons.status.rpg.RemoteProcessGroupStatusBean)1 SystemProcessorStats (org.apache.nifi.minifi.commons.status.system.SystemProcessorStats)1 Bulletin (org.apache.nifi.reporting.Bulletin)1