NIFI-632 Using newly generated example.nar in test code

This commit is contained in:
danbress 2015-05-30 11:56:39 -04:00
parent b4ee97c771
commit 6f36c7939b
6 changed files with 12 additions and 6 deletions

View File

@ -76,7 +76,7 @@ public class DocGenerator {
logger.debug("Documenting: " + componentClass); logger.debug("Documenting: " + componentClass);
document(explodedNiFiDocsDir, componentClass); document(explodedNiFiDocsDir, componentClass);
} catch (Exception e) { } catch (Exception e) {
logger.warn("Unable to document: " + componentClass); logger.warn("Unable to document: " + componentClass, e);
} }
} }
} }

View File

@ -7,7 +7,9 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.nifi.nar.ExtensionManager;
import org.apache.nifi.nar.ExtensionMapping; import org.apache.nifi.nar.ExtensionMapping;
import org.apache.nifi.nar.NarClassLoaders;
import org.apache.nifi.nar.NarUnpacker; import org.apache.nifi.nar.NarUnpacker;
import org.apache.nifi.stream.io.StreamUtils; import org.apache.nifi.stream.io.StreamUtils;
import org.apache.nifi.util.NiFiProperties; import org.apache.nifi.util.NiFiProperties;
@ -19,7 +21,7 @@ import org.mockito.internal.util.io.IOUtil;
public class DocGeneratorTest { public class DocGeneratorTest {
@Test @Test
public void testProcessorLoadsNarResources() throws IOException { public void testProcessorLoadsNarResources() throws IOException, ClassNotFoundException {
TemporaryFolder temporaryFolder = new TemporaryFolder(); TemporaryFolder temporaryFolder = new TemporaryFolder();
temporaryFolder.create(); temporaryFolder.create();
@ -30,11 +32,15 @@ public class DocGeneratorTest {
final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties);
NarClassLoaders.load(properties);
ExtensionManager.discoverExtensions();
DocGenerator.generate(properties); DocGenerator.generate(properties);
File processorDirectory = new File(temporaryFolder.getRoot(), "org.apache.nifi.TestProcessor"); File processorDirectory = new File(temporaryFolder.getRoot(), "org.apache.nifi.processors.WriteResourceToStream");
File indexHtml = new File(processorDirectory, "index.html"); File indexHtml = new File(processorDirectory, "index.html");
Assert.assertTrue(indexHtml + " should have been generated", indexHtml.exists());
String generatedHtml = FileUtils.readFileToString(indexHtml); String generatedHtml = FileUtils.readFileToString(indexHtml);
Assert.assertNotNull(generatedHtml); Assert.assertNotNull(generatedHtml);
} }

View File

@ -27,8 +27,8 @@ nifi.controller.service.configuration.file=./target/controller-services.xml
nifi.templates.directory=./target/templates nifi.templates.directory=./target/templates
nifi.ui.banner.text=UI Banner Text nifi.ui.banner.text=UI Banner Text
nifi.ui.autorefresh.interval=30 sec nifi.ui.autorefresh.interval=30 sec
nifi.nar.library.directory=./target/NarUnpacker/lib/ nifi.nar.library.directory=./target/test-classes/lib/
nifi.nar.library.directory.alt=./target/NarUnpacker/lib2/ nifi.nar.library.directory.alt=./target/test-classes/lib2/
nifi.nar.working.directory=./target/work/nar/ nifi.nar.working.directory=./target/work/nar/