@Test public void testProcessorLoadsNarResources() throws IOException, ClassNotFoundException { TemporaryFolder temporaryFolder = new TemporaryFolder(); temporaryFolder.create(); NiFiProperties properties = loadSpecifiedProperties("/conf/nifi.properties", NiFiProperties.COMPONENT_DOCS_DIRECTORY, temporaryFolder.getRoot().getAbsolutePath()); final Bundle systemBundle = SystemBundle.create(properties); final ExtensionMapping mapping = NarUnpacker.unpackNars(properties, systemBundle); NarClassLoaders.getInstance().init(properties.getFrameworkWorkingDirectory(), properties.getExtensionsWorkingDirectory()); ExtensionManager.discoverExtensions(systemBundle, NarClassLoaders.getInstance().getBundles()); DocGenerator.generate(properties, mapping); final String extensionClassName = "org.apache.nifi.processors.WriteResourceToStream"; final BundleCoordinate coordinate = mapping.getProcessorNames().get(extensionClassName).stream().findFirst().get(); final String path = coordinate.getGroup() + "/" + coordinate.getId() + "/" + coordinate.getVersion() + "/" + extensionClassName; File processorDirectory = new File(temporaryFolder.getRoot(), path); File indexHtml = new File(processorDirectory, "index.html"); Assert.assertTrue(indexHtml + " should have been generated", indexHtml.exists()); String generatedHtml = FileUtils.readFileToString(indexHtml); Assert.assertNotNull(generatedHtml); Assert.assertTrue(generatedHtml.contains("This example processor loads a resource from the nar and writes it to the FlowFile content")); Assert.assertTrue(generatedHtml.contains("files that were successfully processed")); Assert.assertTrue(generatedHtml.contains("files that were not successfully processed")); Assert.assertTrue(generatedHtml.contains("resources")); }
public static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping) { final File explodedNiFiDocsDir = properties.getComponentDocumentationWorkingDirectory(); logger.debug("Generating documentation for: " + extensionMapping.size() + " components in: " + explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(Processor.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ControllerService.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ReportingTask.class), explodedNiFiDocsDir); }
DocGenerator { public static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping) { final File explodedNiFiDocsDir = properties.getComponentDocumentationWorkingDirectory(); logger.debug("Generating documentation for: " + extensionMapping.size() + " components in: " + explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(Processor.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ControllerService.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ReportingTask.class), explodedNiFiDocsDir); } }
DocGenerator { public static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping) { final File explodedNiFiDocsDir = properties.getComponentDocumentationWorkingDirectory(); logger.debug("Generating documentation for: " + extensionMapping.size() + " components in: " + explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(Processor.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ControllerService.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ReportingTask.class), explodedNiFiDocsDir); }  }
DocGenerator { public static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping) { final File explodedNiFiDocsDir = properties.getComponentDocumentationWorkingDirectory(); logger.debug("Generating documentation for: " + extensionMapping.size() + " components in: " + explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(Processor.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ControllerService.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ReportingTask.class), explodedNiFiDocsDir); }  static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping); }
DocGenerator { public static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping) { final File explodedNiFiDocsDir = properties.getComponentDocumentationWorkingDirectory(); logger.debug("Generating documentation for: " + extensionMapping.size() + " components in: " + explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(Processor.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ControllerService.class), explodedNiFiDocsDir); documentConfigurableComponent(ExtensionManager.getExtensions(ReportingTask.class), explodedNiFiDocsDir); }  static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping);  }