Search in sources :

Example 1 with MockDataPacket

use of org.apache.apex.malhar.contrib.nifi.mock.MockDataPacket in project apex-malhar by apache.

the class NiFiSinglePortInputOperatorTest method getDataPacket.

@NotNull
private DataPacket getDataPacket(final String id) {
    Map<String, String> attrs = new HashMap<>();
    attrs.put("keyA", "valA");
    attrs.put("keyB", "valB");
    attrs.put("key" + id, "val" + id);
    byte[] content = ("content" + id).getBytes(StandardCharsets.UTF_8);
    ByteArrayInputStream in = new ByteArrayInputStream(content);
    return new MockDataPacket(attrs, in, content.length);
}
Also used : MockDataPacket(org.apache.apex.malhar.contrib.nifi.mock.MockDataPacket) HashMap(java.util.HashMap) ByteArrayInputStream(org.apache.nifi.stream.io.ByteArrayInputStream) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

HashMap (java.util.HashMap)1 MockDataPacket (org.apache.apex.malhar.contrib.nifi.mock.MockDataPacket)1 ByteArrayInputStream (org.apache.nifi.stream.io.ByteArrayInputStream)1 NotNull (org.jetbrains.annotations.NotNull)1