Search in sources :

Example 1 with PortStatus

use of org.apache.nifi.minifi.commons.status.rpg.PortStatus 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)

Aggregations

Date (java.util.Date)1 BulletinStatus (org.apache.nifi.minifi.commons.status.common.BulletinStatus)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