NIFI-8929 Upgraded Apache POI to 5.0.0

- Upgraded version 4.0.1 to 5.0.0 in nifi-email-processors and nifi-poi-processors
- Removed unnecessary commons-logging dependency in nifi-email-processors

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #5234.
This commit is contained in:
exceptionfactory 2021-07-20 09:13:17 -05:00 committed by Pierre Villard
parent cb020072f7
commit 73ddb43f53
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
3 changed files with 9 additions and 19 deletions

View File

@ -99,15 +99,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>4.0.1</version>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>

View File

@ -27,8 +27,6 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
public class TestExtractTNEFAttachments {
@ -36,7 +34,6 @@ public class TestExtractTNEFAttachments {
public void testValidTNEFWithoutAttachment() throws Exception {
final TestRunner runner = TestRunners.newTestRunner(new ExtractTNEFAttachments());
runner.enqueue(Paths.get("src/test/resources/winmail-simple.dat"));
runner.run();
@ -45,12 +42,11 @@ public class TestExtractTNEFAttachments {
runner.assertTransferCount(ExtractEmailAttachments.REL_ATTACHMENTS, 0);
// Have a look at the attachments...
final List<MockFlowFile> splits = runner.getFlowFilesForRelationship(ExtractEmailAttachments.REL_ATTACHMENTS);
Assert.assertTrue(splits.size() == 0);
Assert.assertEquals(0, splits.size());
}
@Test
public void testValidTNEFWithMultipleAttachments() throws Exception {
Random rnd = new Random() ;
final TestRunner runner = TestRunners.newTestRunner(new ExtractTNEFAttachments());
runner.enqueue(Paths.get("src/test/resources/winmail-with-attachments.dat"));
@ -63,8 +59,8 @@ public class TestExtractTNEFAttachments {
final List<MockFlowFile> splits = runner.getFlowFilesForRelationship(ExtractTNEFAttachments.REL_ATTACHMENTS);
List<String> filenames = new ArrayList<>();
for (int a = 0 ; a < splits.size() ; a++ ) {
filenames.add(splits.get(a).getAttribute("filename").toString());
for (final MockFlowFile flowFile : splits) {
filenames.add(flowFile.getAttribute("filename"));
}
Assert.assertTrue(filenames.containsAll(Arrays.asList("nifiDrop.svg", "MINIFI~1.PNG")));
@ -72,7 +68,6 @@ public class TestExtractTNEFAttachments {
@Test
public void testValidTNEFWithAttachment() throws Exception {
Random rnd = new Random() ;
final TestRunner runner = TestRunners.newTestRunner(new ExtractTNEFAttachments());
runner.enqueue(Paths.get("src/test/resources/winmail-with-attachment.dat"));
@ -85,15 +80,15 @@ public class TestExtractTNEFAttachments {
final List<MockFlowFile> splits = runner.getFlowFilesForRelationship(ExtractTNEFAttachments.REL_ATTACHMENTS);
List<String> filenames = new ArrayList<>();
for (int a = 0 ; a < splits.size() ; a++ ) {
filenames.add(splits.get(a).getAttribute("filename").toString());
for (final MockFlowFile flowFile : splits) {
filenames.add(flowFile.getAttribute("filename"));
}
Assert.assertTrue(filenames.containsAll(Arrays.asList("nifiDrop.svg")));
Assert.assertTrue(filenames.contains("nifiDrop.svg"));
}
@Test
public void testInvalidTNEF() throws Exception {
public void testInvalidTNEF() {
final TestRunner runner = TestRunners.newTestRunner(new ExtractTNEFAttachments());
runner.enqueue("test test test chocolate".getBytes());
runner.run();

View File

@ -17,7 +17,7 @@
<modelVersion>4.0.0</modelVersion>
<properties>
<poi.version>4.0.1</poi.version>
<poi.version>5.0.0</poi.version>
</properties>
<parent>