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));
}
Aggregations