[NIFI-2810] Allow Content Type to be set in PutS3Object processor#1034
[NIFI-2810] Allow Content Type to be set in PutS3Object processor#1034vegaed wants to merge 3 commits intoapache:masterfrom
Conversation
|
@trixpan moved it out of this PR |
|
@vegaed LGTM. Do you have an associated JIRA for this? If not, could you create one and link it to this PR? |
|
@pvillard31 I think I did it right should be good to go now. |
pvillard31
left a comment
There was a problem hiding this comment.
@vegaed I made a couple of comments, let me know your thoughts.
| .build(); | ||
|
|
||
| public static final PropertyDescriptor CONTENT_TYPE = new PropertyDescriptor.Builder() | ||
| .name("Content Type") |
There was a problem hiding this comment.
Could you use the combination of .name() and .displayName()? name ensures backward compatibility when displayName allows to be more flexible on what is displayed to users. We are trying to ensure every new processor properties is using both.
| "AWS S3 Java client will attempt to determine the correct content type if one hasn't been set" + | ||
| " yet. Users are responsible for ensuring a suitable content type is set when uploading streams. If " + | ||
| "no content type is provided and cannot be determined by the filename, the default content type " + | ||
| "\"application/octet-stream\" will be used.") |
There was a problem hiding this comment.
Could you set "application/octet-stream" as default value of the property? It's more user-friendly because user will know what is the default value which is used without looking at the description.
There was a problem hiding this comment.
Well if I do that then the default behavior will not kick in. This is an optional property. In our case the client couldn't figure out the type so we needed to tell it.
|
|
||
| runner.assertAllFlowFilesTransferred(PutS3Object.REL_SUCCESS, 1); | ||
| List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutS3Object.REL_SUCCESS); | ||
| MockFlowFile ff1 = flowFiles.get(0); |
There was a problem hiding this comment.
If I understand the unit test correctly, there will be a new attribute written into the flow file (s3.contenttype). Could you add the corresponding @WritesAttribute annotation at the top of the PutS3Object class?
Jira Issue https://issues.apache.org/jira/browse/NIFI-2810