use of org.apache.nifi.documentation.example.FullyDocumentedControllerService in project nifi by apache.
the class HtmlDocumentationWriterTest method testDocumentControllerService.
@Test
public void testDocumentControllerService() throws InitializationException, IOException {
FullyDocumentedControllerService controllerService = new FullyDocumentedControllerService();
ControllerServiceInitializer initializer = new ControllerServiceInitializer();
initializer.initialize(controllerService);
DocumentationWriter writer = new HtmlDocumentationWriter();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
writer.write(controllerService, baos, false);
initializer.teardown(controllerService);
String results = new String(baos.toByteArray());
XmlValidator.assertXmlValid(results);
// description
assertContains(results, "A documented controller service that can help you do things");
// tags
assertContains(results, "one, two, three");
// properties
assertContains(results, "Keystore Filename");
assertContains(results, "The fully-qualified filename of the Keystore");
assertContains(results, "Keystore Type");
assertContains(results, "JKS");
assertContains(results, "PKCS12");
assertContains(results, "Sensitive Property: true");
// restricted
assertContains(results, "controller service restriction description");
// verify system resource considerations
assertContains(results, SystemResource.CPU.name());
assertContains(results, SystemResourceConsideration.DEFAULT_DESCRIPTION);
assertContains(results, SystemResource.DISK.name());
assertContains(results, "Customized disk usage description");
assertContains(results, SystemResource.MEMORY.name());
assertContains(results, "Not Specified");
// verify the right OnRemoved and OnShutdown methods were called
Assert.assertEquals(0, controllerService.getOnRemovedArgs());
Assert.assertEquals(0, controllerService.getOnRemovedNoArgs());
Assert.assertEquals(1, controllerService.getOnShutdownArgs());
Assert.assertEquals(1, controllerService.getOnShutdownNoArgs());
}
Aggregations