Skip to content

Commit

Permalink
feat: add ztdf mime type (#13)
Browse files Browse the repository at this point in the history
address issue #12
  • Loading branch information
ttschampel authored Jul 19, 2024
1 parent bd6ecbb commit eee6403
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void processFlowFiles(ProcessContext processContext, ProcessSession processSessi
}
}
);
updatedFlowFile = processSession.putAttribute(updatedFlowFile, "mime.type", "application/ztdf+zip");
processSession.transfer(updatedFlowFile, REL_SUCCESS);
} catch (Exception e) {
getLogger().error(flowFile.getId() + ": error converting plain text to ZTDF", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;

import static io.opentdf.nifi.AbstractTDFProcessor.OPENTDF_CONFIG_SERVICE;
import static io.opentdf.nifi.SimpleOpenTDFControllerService.*;
Expand Down Expand Up @@ -87,6 +85,7 @@ public void testToTDF() throws Exception {
runner.run(1);
List<MockFlowFile> flowFileList =
runner.getFlowFilesForRelationship(ConvertFromZTDF.REL_SUCCESS);
assertEquals(Set.of("application/ztdf+zip"), flowFileList.stream().map(x->x.getAttribute("mime.type")).collect(Collectors.toSet()));
assertEquals(2, flowFileList.size(), "Two flowfiles for success relationship");
assertEquals(1, flowFileList.stream().filter(x -> x.getAttribute("filename").equals(messageTwo.getAttribute("filename")))
.filter(x -> x.getContent().equals("TDF:message two")).count());
Expand Down

0 comments on commit eee6403

Please sign in to comment.