NIFI-1776 Allowed application/x-gzip as Gzip mime type

This closes #358
This commit is contained in:
Pierre Villard 2016-04-15 18:27:28 +02:00 committed by Oleg Zhurakousky
parent 678d64d1d4
commit ad56f1f853
2 changed files with 13 additions and 0 deletions

View File

@ -154,6 +154,7 @@ public class CompressContent extends AbstractProcessor {
final Map<String, String> mimeTypeMap = new HashMap<>();
mimeTypeMap.put("application/gzip", COMPRESSION_FORMAT_GZIP);
mimeTypeMap.put("application/x-gzip", COMPRESSION_FORMAT_GZIP);
mimeTypeMap.put("application/bzip2", COMPRESSION_FORMAT_BZIP2);
mimeTypeMap.put("application/x-bzip2", COMPRESSION_FORMAT_BZIP2);
mimeTypeMap.put("application/x-lzma", COMPRESSION_FORMAT_LZMA);

View File

@ -207,6 +207,18 @@ public class TestCompressContent {
flowFile = runner.getFlowFilesForRelationship(CompressContent.REL_SUCCESS).get(0);
flowFile.assertContentEquals(Paths.get("src/test/resources/CompressedData/SampleFile.txt"));
flowFile.assertAttributeEquals("filename", "SampleFile1.txt");
runner.clearTransferState();
runner.setProperty(CompressContent.COMPRESSION_FORMAT, CompressContent.COMPRESSION_FORMAT_ATTRIBUTE);
Map<String,String> attributes = new HashMap<String,String>();
attributes.put(CoreAttributes.MIME_TYPE.key(), "application/x-gzip");
runner.enqueue(Paths.get("src/test/resources/CompressedData/SampleFile.txt.gz"), attributes);
runner.run();
runner.assertAllFlowFilesTransferred(CompressContent.REL_SUCCESS, 1);
flowFile = runner.getFlowFilesForRelationship(CompressContent.REL_SUCCESS).get(0);
flowFile.assertContentEquals(Paths.get("src/test/resources/CompressedData/SampleFile.txt"));
flowFile.assertAttributeEquals("filename", "SampleFile.txt");
}
@Test