Java Code Examples for org.apache.nifi.util.NiFiProperties#getExtensionsWorkingDirectory()
The following examples show how to use
org.apache.nifi.util.NiFiProperties#getExtensionsWorkingDirectory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NarUnpackerTest.java From localization_nifi with Apache License 2.0 | 6 votes |
@Test public void testUnpackNarsFromEmptyDir() throws IOException { final File emptyDir = new File("./target/empty/dir"); emptyDir.delete(); emptyDir.deleteOnExit(); assertTrue(emptyDir.mkdirs()); final Map<String, String> others = new HashMap<>(); others.put("nifi.nar.library.directory.alt", emptyDir.toString()); NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", others); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties); assertEquals(1, extensionMapping.getAllExtensionNames().size()); assertTrue(extensionMapping.getAllExtensionNames().contains( "org.apache.nifi.processors.dummy.one")); final File extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); File[] extensionFiles = extensionsWorkingDir.listFiles(); assertEquals(1, extensionFiles.length); assertEquals("dummy-one.nar-unpacked", extensionFiles[0].getName()); }
Example 2
Source File: NarUnpackerTest.java From localization_nifi with Apache License 2.0 | 6 votes |
@Test public void testUnpackNarsFromNonExistantDir() { final File nonExistantDir = new File("./target/this/dir/should/not/exist/"); nonExistantDir.delete(); nonExistantDir.deleteOnExit(); final Map<String, String> others = new HashMap<>(); others.put("nifi.nar.library.directory.alt", nonExistantDir.toString()); NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", others); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties); assertTrue(extensionMapping.getAllExtensionNames().contains( "org.apache.nifi.processors.dummy.one")); assertEquals(1, extensionMapping.getAllExtensionNames().size()); final File extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); File[] extensionFiles = extensionsWorkingDir.listFiles(); assertEquals(1, extensionFiles.length); assertEquals("dummy-one.nar-unpacked", extensionFiles[0].getName()); }
Example 3
Source File: NarUnpackerTest.java From nifi-minifi with Apache License 2.0 | 6 votes |
@Test public void testUnpackNarsFromEmptyDir() throws IOException { final File emptyDir = new File("./target/empty/dir"); emptyDir.delete(); emptyDir.deleteOnExit(); assertTrue(emptyDir.mkdirs()); final Map<String, String> others = new HashMap<>(); others.put("nifi.nar.library.directory.alt", emptyDir.toString()); NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", others); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties); assertEquals(1, extensionMapping.getAllExtensionNames().size()); assertTrue(extensionMapping.getAllExtensionNames().contains( "org.apache.nifi.processors.dummy.one")); final File extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); File[] extensionFiles = extensionsWorkingDir.listFiles(); assertEquals(1, extensionFiles.length); assertEquals("dummy-one.nar-unpacked", extensionFiles[0].getName()); }
Example 4
Source File: NarUnpackerTest.java From nifi-minifi with Apache License 2.0 | 6 votes |
@Test public void testUnpackNarsFromNonExistantDir() { final File nonExistantDir = new File("./target/this/dir/should/not/exist/"); nonExistantDir.delete(); nonExistantDir.deleteOnExit(); final Map<String, String> others = new HashMap<>(); others.put("nifi.nar.library.directory.alt", nonExistantDir.toString()); NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", others); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties); assertTrue(extensionMapping.getAllExtensionNames().contains( "org.apache.nifi.processors.dummy.one")); assertEquals(1, extensionMapping.getAllExtensionNames().size()); final File extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); File[] extensionFiles = extensionsWorkingDir.listFiles(); assertEquals(1, extensionFiles.length); assertEquals("dummy-one.nar-unpacked", extensionFiles[0].getName()); }
Example 5
Source File: NarUnpackerTest.java From localization_nifi with Apache License 2.0 | 5 votes |
@Test public void testUnpackNars() { NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", Collections.EMPTY_MAP); assertEquals("./target/NarUnpacker/lib/", properties.getProperty("nifi.nar.library.directory")); assertEquals("./target/NarUnpacker/lib2/", properties.getProperty("nifi.nar.library.directory.alt")); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties); assertEquals(2, extensionMapping.getAllExtensionNames().size()); assertTrue(extensionMapping.getAllExtensionNames().contains( "org.apache.nifi.processors.dummy.one")); assertTrue(extensionMapping.getAllExtensionNames().contains( "org.apache.nifi.processors.dummy.two")); final File extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); File[] extensionFiles = extensionsWorkingDir.listFiles(); Set<String> expectedNars = new HashSet<>(); expectedNars.add("dummy-one.nar-unpacked"); expectedNars.add("dummy-two.nar-unpacked"); assertEquals(expectedNars.size(), extensionFiles.length); for (File extensionFile : extensionFiles) { Assert.assertTrue(expectedNars.contains(extensionFile.getName())); } }
Example 6
Source File: NarUnpackerTest.java From nifi-minifi with Apache License 2.0 | 5 votes |
@Test public void testUnpackNars() { NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", Collections.EMPTY_MAP); assertEquals("./target/NarUnpacker/lib/", properties.getProperty("nifi.nar.library.directory")); assertEquals("./target/NarUnpacker/lib2/", properties.getProperty("nifi.nar.library.directory.alt")); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties); assertEquals(2, extensionMapping.getAllExtensionNames().size()); assertTrue(extensionMapping.getAllExtensionNames().contains( "org.apache.nifi.processors.dummy.one")); assertTrue(extensionMapping.getAllExtensionNames().contains( "org.apache.nifi.processors.dummy.two")); final File extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); File[] extensionFiles = extensionsWorkingDir.listFiles(); Set<String> expectedNars = new HashSet<>(); expectedNars.add("dummy-one.nar-unpacked"); expectedNars.add("dummy-two.nar-unpacked"); assertEquals(expectedNars.size(), extensionFiles.length); for (File extensionFile : extensionFiles) { Assert.assertTrue(expectedNars.contains(extensionFile.getName())); } }
Example 7
Source File: NarUnpackerTest.java From nifi with Apache License 2.0 | 5 votes |
@Test public void testUnpackNars() { NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", Collections.EMPTY_MAP); assertEquals("./target/NarUnpacker/lib/", properties.getProperty("nifi.nar.library.directory")); assertEquals("./target/NarUnpacker/lib2/", properties.getProperty("nifi.nar.library.directory.alt")); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties, SystemBundle.create(properties)); assertEquals(2, extensionMapping.getAllExtensionNames().size()); assertTrue(extensionMapping.getAllExtensionNames().keySet().contains("org.apache.nifi.processors.dummy.one")); assertTrue(extensionMapping.getAllExtensionNames().keySet().contains("org.apache.nifi.processors.dummy.two")); final File extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); File[] extensionFiles = extensionsWorkingDir.listFiles(); Set<String> expectedNars = new HashSet<>(); expectedNars.add("dummy-one.nar-unpacked"); expectedNars.add("dummy-two.nar-unpacked"); expectedNars.add("nifi-jetty-bundle.nar-unpacked"); assertEquals(expectedNars.size(), extensionFiles.length); for (File extensionFile : extensionFiles) { Assert.assertTrue(expectedNars.contains(extensionFile.getName())); } }
Example 8
Source File: NarUnpackerTest.java From nifi with Apache License 2.0 | 5 votes |
@Test public void testUnpackNarsFromEmptyDir() throws IOException { final File emptyDir = new File("./target/empty/dir"); emptyDir.delete(); emptyDir.deleteOnExit(); assertTrue(emptyDir.mkdirs()); final Map<String, String> others = new HashMap<>(); others.put("nifi.nar.library.directory.alt", emptyDir.toString()); NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", others); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties, SystemBundle.create(properties)); assertEquals(1, extensionMapping.getAllExtensionNames().size()); assertTrue(extensionMapping.getAllExtensionNames().keySet().contains("org.apache.nifi.processors.dummy.one")); final File extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); File[] extensionFiles = extensionsWorkingDir.listFiles(); assertEquals(2, extensionFiles.length); final Optional<File> foundDummyOne = Stream.of(extensionFiles) .filter(f -> f.getName().equals("dummy-one.nar-unpacked")) .findFirst(); assertTrue(foundDummyOne.isPresent()); }
Example 9
Source File: NarUnpackerTest.java From nifi with Apache License 2.0 | 5 votes |
@Test public void testUnpackNarsFromNonExistantDir() { final File nonExistantDir = new File("./target/this/dir/should/not/exist/"); nonExistantDir.delete(); nonExistantDir.deleteOnExit(); final Map<String, String> others = new HashMap<>(); others.put("nifi.nar.library.directory.alt", nonExistantDir.toString()); NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", others); final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties, SystemBundle.create(properties)); assertTrue(extensionMapping.getAllExtensionNames().keySet().contains("org.apache.nifi.processors.dummy.one")); assertEquals(1, extensionMapping.getAllExtensionNames().size()); final File extensionsWorkingDir = properties.getExtensionsWorkingDirectory(); File[] extensionFiles = extensionsWorkingDir.listFiles(); assertEquals(2, extensionFiles.length); final Optional<File> foundDummyOne = Stream.of(extensionFiles) .filter(f -> f.getName().equals("dummy-one.nar-unpacked")) .findFirst(); assertTrue(foundDummyOne.isPresent()); }