S3InternalEvent extends InternalEvent { @Override public LinkedHashMap<String, String> getPartitions() { LinkedHashMap<String, String> partitions = super.getPartitions(); if (partitions == null) { partitions = new LinkedHashMap<String, String>(1); super.setPartitions(partitions); } partitions.put(FILENAME_PARTITION, DigestUtils.sha1Hex(this.s3Key)); return partitions; } S3InternalEvent(String eventString, LambdaContext context, long arrivalTime, String s3Key,
      String s3Bucket, String s3KeyVersion); @Override LinkedHashMap<String, String> getPartitions(); String getS3Key(); String getS3Bucket(); String getS3KeyVersion(); static final String FILENAME_PARTITION; }
@Test public void testAppendFilename() { TestContext context = new TestContext(); context.setAwsRequestId("req_id"); S3InternalEvent ievent = new S3InternalEvent("foo", new LambdaContext(context), 0, "file", "bucket", "v1"); ievent.setEventObj(null); Map<String, String> expected = new HashMap<String, String>(1); expected.put(S3InternalEvent.FILENAME_PARTITION, DigestUtils.sha1Hex("file")); assertEquals(expected, ievent.getPartitions()); }