mirror of https://github.com/apache/nifi.git
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/incubator-nifi into develop
This commit is contained in:
commit
e1aa4890a0
|
@ -16,16 +16,19 @@
|
|||
*/
|
||||
package org.apache.nifi.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class NiFiPropertiesTest {
|
||||
|
||||
|
@ -36,13 +39,19 @@ public class NiFiPropertiesTest {
|
|||
|
||||
assertEquals("UI Banner Text", properties.getBannerText());
|
||||
|
||||
List<Path> directories = properties.getNarLibraryDirectories();
|
||||
Set<File> expectedDirectories = new HashSet<>();
|
||||
expectedDirectories.add(new File("./target/resources/NiFiProperties/lib/"));
|
||||
expectedDirectories.add(new File("./target/resources/NiFiProperties/lib2/"));
|
||||
|
||||
assertEquals(new File("./target/resources/NiFiProperties/lib/").getPath(),
|
||||
directories.get(0).toString());
|
||||
assertEquals(new File("./target/resources/NiFiProperties/lib2/").getPath(), directories
|
||||
.get(1).toString());
|
||||
Set<String> directories = new HashSet<>();
|
||||
for (Path narLibDir : properties.getNarLibraryDirectories()) {
|
||||
directories.add(narLibDir.toString());
|
||||
}
|
||||
|
||||
Assert.assertEquals("Did not have the anticipated number of directories", expectedDirectories.size(), directories.size());
|
||||
for (File expectedDirectory : expectedDirectories) {
|
||||
Assert.assertTrue("Listed directories did not contain expected directory", directories.contains(expectedDirectory.getPath()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
*/
|
||||
package org.apache.nifi.nar;
|
||||
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.apache.nifi.util.NiFiProperties;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
|
@ -32,10 +32,13 @@ import java.nio.file.Path;
|
|||
import java.nio.file.Paths;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.nifi.util.NiFiProperties;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class NarUnpackerTest {
|
||||
|
||||
|
@ -92,13 +95,17 @@ public class NarUnpackerTest {
|
|||
"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();
|
||||
|
||||
assertEquals(2, extensionFiles.length);
|
||||
assertEquals("dummy-one.nar-unpacked", extensionFiles[0].getName());
|
||||
assertEquals("dummy-two.nar-unpacked", extensionFiles[1].getName());
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue