use of org.apache.nifi.minifi.commons.status.FlowStatusReport in project nifi-minifi by apache.
the class RunMiNiFi method statusReport.
public FlowStatusReport statusReport(String statusRequest) throws IOException {
final Logger logger = cmdLogger;
final Status status = getStatus(logger);
final Properties props = loadProperties(logger);
List<String> problemsGeneratingReport = new LinkedList<>();
if (!status.isProcessRunning()) {
problemsGeneratingReport.add("MiNiFi process is not running");
}
if (!status.isRespondingToPing()) {
problemsGeneratingReport.add("MiNiFi process is not responding to pings");
}
if (!problemsGeneratingReport.isEmpty()) {
FlowStatusReport flowStatusReport = new FlowStatusReport();
flowStatusReport.setErrorsGeneratingReport(problemsGeneratingReport);
return flowStatusReport;
}
return getFlowStatusReport(statusRequest, status.getPort(), props.getProperty("secret.key"), logger);
}
use of org.apache.nifi.minifi.commons.status.FlowStatusReport in project nifi-minifi by apache.
the class BootstrapListener method writeStatusReport.
private void writeStatusReport(String flowStatusRequestString, final OutputStream out) throws IOException, StatusRequestException {
ObjectOutputStream oos = new ObjectOutputStream(out);
FlowStatusReport flowStatusReport = minifi.getMinifiServer().getStatusReport(flowStatusRequestString);
oos.writeObject(flowStatusReport);
oos.close();
}
use of org.apache.nifi.minifi.commons.status.FlowStatusReport in project nifi-minifi by apache.
the class StatusConfigReporterTest method connectionAndProcessorStatusHealth.
@Test
public void connectionAndProcessorStatusHealth() throws Exception {
populateConnection();
populateProcessor(false, false);
String statusRequest = "connection:connectionId:health; processor:UpdateAttributeProcessorId:health";
FlowStatusReport actual = StatusConfigReporter.getStatus(mockFlowController, statusRequest, LoggerFactory.getLogger(StatusConfigReporterTest.class));
FlowStatusReport expected = new FlowStatusReport();
addConnectionStatus(expected, true, false);
addProcessorStatus(expected, true, false, false, false, false);
expected.setErrorsGeneratingReport(Collections.EMPTY_LIST);
assertEquals(expected, actual);
}
use of org.apache.nifi.minifi.commons.status.FlowStatusReport in project nifi-minifi by apache.
the class StatusConfigReporterTest method statusEverything.
@Test
public void statusEverything() throws Exception {
when(bulletinRepo.findBulletins(anyObject())).thenReturn(Collections.emptyList());
populateControllerService(true, false);
populateInstance(true);
populateSystemDiagnostics();
populateReportingTask(false, true);
populateConnection();
populateProcessor(true, false);
populateRemoteProcessGroup(false, true);
String statusRequest = "controllerServices:bulletins,health; processor:all:health,stats,bulletins; instance:bulletins,health,stats ; systemDiagnostics:garbagecollection, heap, " + "processorstats, contentrepositoryusage, flowfilerepositoryusage; connection:all:health,stats; provenanceReporting:health,bulletins; remoteProcessGroup:all:health, " + "bulletins, inputPorts, outputPorts, stats";
FlowStatusReport actual = StatusConfigReporter.getStatus(mockFlowController, statusRequest, LoggerFactory.getLogger(StatusConfigReporterTest.class));
FlowStatusReport expected = new FlowStatusReport();
expected.setErrorsGeneratingReport(Collections.EMPTY_LIST);
addControllerServiceStatus(expected, true, true, true, false);
addInstanceStatus(expected, true, true, true, true);
addSystemDiagnosticStatus(expected, true, true, true, true, true);
addReportingTaskStatus(expected, true, true, true, false);
addConnectionStatus(expected, true, true);
addProcessorStatus(expected, true, true, true, true, false);
addExpectedRemoteProcessGroupStatus(expected, true, true, true, true, true, false);
assertEquals(expected, actual);
}
use of org.apache.nifi.minifi.commons.status.FlowStatusReport in project nifi-minifi by apache.
the class StatusConfigReporterTest method processorStatusWithValidationErrors.
@Test
public void processorStatusWithValidationErrors() throws Exception {
populateProcessor(true, false);
String statusRequest = "processor:all:health";
FlowStatusReport actual = StatusConfigReporter.getStatus(mockFlowController, statusRequest, LoggerFactory.getLogger(StatusConfigReporterTest.class));
FlowStatusReport expected = new FlowStatusReport();
expected.setErrorsGeneratingReport(Collections.EMPTY_LIST);
addProcessorStatus(expected, true, true, false, false, false);
assertEquals(expected, actual);
}
Aggregations