Search in sources :

Example 6 with MockComponentLogger

use of org.apache.nifi.mock.MockComponentLogger in project nifi by apache.

the class ReportingTaskingInitializer method teardown.

@Override
public void teardown(ConfigurableComponent component) {
    ReportingTask reportingTask = (ReportingTask) component;
    try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(component.getClass(), component.getIdentifier())) {
        final MockConfigurationContext context = new MockConfigurationContext();
        ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, reportingTask, new MockComponentLogger(), context);
    } finally {
        ExtensionManager.removeInstanceClassLoader(component.getIdentifier());
    }
}
Also used : NarCloseable(org.apache.nifi.nar.NarCloseable) MockConfigurationContext(org.apache.nifi.mock.MockConfigurationContext) MockComponentLogger(org.apache.nifi.mock.MockComponentLogger) ReportingTask(org.apache.nifi.reporting.ReportingTask)

Aggregations

MockComponentLogger (org.apache.nifi.mock.MockComponentLogger)6 NarCloseable (org.apache.nifi.nar.NarCloseable)6 ComponentLog (org.apache.nifi.logging.ComponentLog)4 MockConfigurationContext (org.apache.nifi.mock.MockConfigurationContext)4 ControllerService (org.apache.nifi.controller.ControllerService)2 MockProcessContext (org.apache.nifi.mock.MockProcessContext)2 Processor (org.apache.nifi.processor.Processor)2 ReportingTask (org.apache.nifi.reporting.ReportingTask)2