use of org.apache.nifi.util.NiFiProperties in project nifi-minifi by apache.
the class MiNiFi method main.
/**
* Main entry point of the application.
*
* @param args things which are ignored
*/
public static void main(String[] args) {
logger.info("Launching MiNiFi...");
try {
NiFiProperties niFiProperties = NiFiProperties.createBasicNiFiProperties(null, null);
new MiNiFi(niFiProperties);
} catch (final Throwable t) {
logger.error("Failure to launch MiNiFi due to " + t, t);
}
}
use of org.apache.nifi.util.NiFiProperties in project nifi-minifi by apache.
the class MiNiFiPersistentProvenanceRepositoryTest method createTestableRepositoryConfiguration.
private RepositoryConfiguration createTestableRepositoryConfiguration(final NiFiProperties properties) {
Class klass = MiNiFiPersistentProvenanceRepository.class;
Method createRepositoryConfigurationMethod;
RepositoryConfiguration configuration = null;
try {
createRepositoryConfigurationMethod = klass.getDeclaredMethod("createRepositoryConfiguration", NiFiProperties.class);
createRepositoryConfigurationMethod.setAccessible(true);
configuration = (RepositoryConfiguration) createRepositoryConfigurationMethod.invoke(null, properties);
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
e.printStackTrace();
}
return configuration;
}
use of org.apache.nifi.util.NiFiProperties in project nifi-minifi by apache.
the class NarUnpackerTest method testUnpackNarsFromNonDir.
@Test
public void testUnpackNarsFromNonDir() throws IOException {
final File nonDir = new File("./target/file.txt");
nonDir.createNewFile();
nonDir.deleteOnExit();
final Map<String, String> others = new HashMap<>();
others.put("nifi.nar.library.directory.alt", nonDir.toString());
NiFiProperties properties = loadSpecifiedProperties("/NarUnpacker/conf/nifi.properties", others);
final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties);
assertNull(extensionMapping);
}
use of org.apache.nifi.util.NiFiProperties in project nifi-minifi by apache.
the class NarUnpackerTest method testUnpackNarsFromEmptyDir.
@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());
}
use of org.apache.nifi.util.NiFiProperties in project nifi-minifi by apache.
the class NarUnpackerTest method testUnpackNars.
@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()));
}
}
Aggregations