use of org.apache.nifi.mock.MockControllerServiceInitializationContext in project nifi by apache.
the class ControllerServiceInitializer method initialize.
@Override
public void initialize(ConfigurableComponent component) throws InitializationException {
ControllerService controllerService = (ControllerService) component;
ControllerServiceInitializationContext context = new MockControllerServiceInitializationContext();
try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(component.getClass(), context.getIdentifier())) {
controllerService.initialize(context);
}
}
use of org.apache.nifi.mock.MockControllerServiceInitializationContext in project nifi by apache.
the class HtmlDocumentationWriterTest method testControllerServiceWithLogger.
@Test
public void testControllerServiceWithLogger() throws InitializationException, IOException {
ControllerService controllerService = new ControllerServiceWithLogger();
controllerService.initialize(new MockControllerServiceInitializationContext());
DocumentationWriter writer = new HtmlDocumentationWriter();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
writer.write(controllerService, baos, false);
String results = new String(baos.toByteArray());
XmlValidator.assertXmlValid(results);
}
use of org.apache.nifi.mock.MockControllerServiceInitializationContext in project nifi-minifi by apache.
the class ControllerServiceInitializer method initialize.
@Override
public void initialize(ConfigurableComponent component) throws InitializationException {
ControllerService controllerService = (ControllerService) component;
ControllerServiceInitializationContext context = new MockControllerServiceInitializationContext();
try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(component.getClass(), context.getIdentifier())) {
controllerService.initialize(context);
}
}
Aggregations