Search in sources :

Example 1 with QueryableStatusAggregator

use of org.apache.nifi.minifi.bootstrap.QueryableStatusAggregator 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

Field (java.lang.reflect.Field)1 QueryableStatusAggregator (org.apache.nifi.minifi.bootstrap.QueryableStatusAggregator)1 FlowStatusReport (org.apache.nifi.minifi.commons.status.FlowStatusReport)1 Before (org.junit.Before)1 Logger (org.slf4j.Logger)1