mirror of https://github.com/apache/nifi.git
NIFI-1776 Allowed application/x-gzip as Gzip mime type
This closes #358
This commit is contained in:
parent
678d64d1d4
commit
ad56f1f853
|
@ -154,6 +154,7 @@ public class CompressContent extends AbstractProcessor {
|
||||||
|
|
||||||
final Map<String, String> mimeTypeMap = new HashMap<>();
|
final Map<String, String> mimeTypeMap = new HashMap<>();
|
||||||
mimeTypeMap.put("application/gzip", COMPRESSION_FORMAT_GZIP);
|
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/bzip2", COMPRESSION_FORMAT_BZIP2);
|
||||||
mimeTypeMap.put("application/x-bzip2", COMPRESSION_FORMAT_BZIP2);
|
mimeTypeMap.put("application/x-bzip2", COMPRESSION_FORMAT_BZIP2);
|
||||||
mimeTypeMap.put("application/x-lzma", COMPRESSION_FORMAT_LZMA);
|
mimeTypeMap.put("application/x-lzma", COMPRESSION_FORMAT_LZMA);
|
||||||
|
|
|
@ -207,6 +207,18 @@ public class TestCompressContent {
|
||||||
flowFile = runner.getFlowFilesForRelationship(CompressContent.REL_SUCCESS).get(0);
|
flowFile = runner.getFlowFilesForRelationship(CompressContent.REL_SUCCESS).get(0);
|
||||||
flowFile.assertContentEquals(Paths.get("src/test/resources/CompressedData/SampleFile.txt"));
|
flowFile.assertContentEquals(Paths.get("src/test/resources/CompressedData/SampleFile.txt"));
|
||||||
flowFile.assertAttributeEquals("filename", "SampleFile1.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
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue