Search in sources :

Example 31 with FlowStatusReport

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

the class StatusConfigReporterTest method controllerServiceStatusAll.

@Test
public void controllerServiceStatusAll() throws Exception {
    populateControllerService(true, true);
    String statusRequest = "controllerServices:bulletins, health";
    FlowStatusReport actual = StatusConfigReporter.getStatus(mockFlowController, statusRequest, LoggerFactory.getLogger(StatusConfigReporterTest.class));
    FlowStatusReport expected = new FlowStatusReport();
    expected.setErrorsGeneratingReport(Collections.EMPTY_LIST);
    addControllerServiceStatus(expected, true, true, true, true);
    assertEquals(expected, actual);
}
Also used : FlowStatusReport(org.apache.nifi.minifi.commons.status.FlowStatusReport) Test(org.junit.Test)

Example 32 with FlowStatusReport

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

the class StatusConfigReporterTest method systemDiagnosticGarbageCollection.

@Test
public void systemDiagnosticGarbageCollection() throws Exception {
    populateSystemDiagnostics();
    String statusRequest = "systemDiagnostics:garbagecollection";
    FlowStatusReport actual = StatusConfigReporter.getStatus(mockFlowController, statusRequest, LoggerFactory.getLogger(StatusConfigReporterTest.class));
    FlowStatusReport expected = new FlowStatusReport();
    expected.setErrorsGeneratingReport(Collections.EMPTY_LIST);
    addSystemDiagnosticStatus(expected, false, false, false, false, true);
    assertEquals(expected, actual);
}
Also used : FlowStatusReport(org.apache.nifi.minifi.commons.status.FlowStatusReport) Test(org.junit.Test)

Example 33 with FlowStatusReport

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

the class StatusConfigReporterTest method remoteProcessGroupStatusOutputPorts.

@Test
public void remoteProcessGroupStatusOutputPorts() throws Exception {
    populateRemoteProcessGroup(false, false);
    String statusRequest = "remoteProcessGroup:all:outputPorts";
    FlowStatusReport actual = StatusConfigReporter.getStatus(mockFlowController, statusRequest, LoggerFactory.getLogger(StatusConfigReporterTest.class));
    FlowStatusReport expected = new FlowStatusReport();
    expected.setErrorsGeneratingReport(Collections.EMPTY_LIST);
    addExpectedRemoteProcessGroupStatus(expected, false, false, true, false, false, false);
    assertEquals(expected, actual);
}
Also used : FlowStatusReport(org.apache.nifi.minifi.commons.status.FlowStatusReport) Test(org.junit.Test)

Example 34 with FlowStatusReport

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

the class StatusLoggerTest method init.

@Before
public void init() throws IOException, NoSuchFieldException, IllegalAccessException {
    statusLogger = Mockito.spy(new StatusLogger());
    logger = Mockito.mock(Logger.class);
    queryableStatusAggregator = Mockito.mock(QueryableStatusAggregator.class);
    flowStatusReport = Mockito.mock(FlowStatusReport.class);
    Mockito.when(flowStatusReport.toString()).thenReturn(MOCK_STATUS);
    Field field = StatusLogger.class.getDeclaredField("logger");
    field.setAccessible(true);
    Field modifiersField = Field.class.getDeclaredField("modifiers");
    modifiersField.setAccessible(true);
    modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
    field.set(null, logger);
    Mockito.when(queryableStatusAggregator.statusReport(MOCK_QUERY)).thenReturn(flowStatusReport);
}
Also used : Field(java.lang.reflect.Field) FlowStatusReport(org.apache.nifi.minifi.commons.status.FlowStatusReport) Logger(org.slf4j.Logger) QueryableStatusAggregator(org.apache.nifi.minifi.bootstrap.QueryableStatusAggregator) Before(org.junit.Before)

Aggregations

FlowStatusReport (org.apache.nifi.minifi.commons.status.FlowStatusReport)34 Test (org.junit.Test)29 LinkedList (java.util.LinkedList)2 Logger (org.slf4j.Logger)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 EOFException (java.io.EOFException)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 OutputStream (java.io.OutputStream)1 Field (java.lang.reflect.Field)1 Socket (java.net.Socket)1 SocketTimeoutException (java.net.SocketTimeoutException)1 Properties (java.util.Properties)1 TeeInputStream (org.apache.commons.io.input.TeeInputStream)1 ConnectionStatus (org.apache.nifi.controller.status.ConnectionStatus)1 ProcessGroupStatus (org.apache.nifi.controller.status.ProcessGroupStatus)1