@Test public void testWriteObjectTags() { runner.setProperty(ListS3.REGION, "eu-west-1"); runner.setProperty(ListS3.BUCKET, "test-bucket"); runner.setProperty(ListS3.WRITE_OBJECT_TAGS, "true"); Date lastModified = new Date(); ObjectListing objectListing = new ObjectListing(); S3ObjectSummary objectSummary1 = new S3ObjectSummary(); objectSummary1.setBucketName("test-bucket"); objectSummary1.setKey("a"); objectSummary1.setLastModified(lastModified); objectListing.getObjectSummaries().add(objectSummary1); Mockito.when(mockS3Client.listObjects(Mockito.any(ListObjectsRequest.class))).thenReturn(objectListing); runner.run(); ArgumentCaptor<GetObjectTaggingRequest> captureRequest = ArgumentCaptor.forClass(GetObjectTaggingRequest.class); Mockito.verify(mockS3Client, Mockito.times(1)).getObjectTagging(captureRequest.capture()); GetObjectTaggingRequest request = captureRequest.getValue(); assertEquals("test-bucket", request.getBucketName()); assertEquals("a", request.getKey()); Mockito.verify(mockS3Client, Mockito.never()).listVersions(Mockito.any()); }
private Map<String, String> writeObjectTags(AmazonS3 client, S3VersionSummary versionSummary) { final GetObjectTaggingResult taggingResult = client.getObjectTagging(new GetObjectTaggingRequest(versionSummary.getBucketName(), versionSummary.getKey())); final Map<String, String> tagMap = new HashMap<>(); if (taggingResult != null) { final List<Tag> tags = taggingResult.getTagSet(); for (final Tag tag : tags) { tagMap.put("s3.tag." + tag.getKey(), tag.getValue()); } } return tagMap; }
ListS3 extends AbstractS3Processor { private Map<String, String> writeObjectTags(AmazonS3 client, S3VersionSummary versionSummary) { final GetObjectTaggingResult taggingResult = client.getObjectTagging(new GetObjectTaggingRequest(versionSummary.getBucketName(), versionSummary.getKey())); final Map<String, String> tagMap = new HashMap<>(); if (taggingResult != null) { final List<Tag> tags = taggingResult.getTagSet(); for (final Tag tag : tags) { tagMap.put("s3.tag." + tag.getKey(), tag.getValue()); } } return tagMap; } }
ListS3 extends AbstractS3Processor { private Map<String, String> writeObjectTags(AmazonS3 client, S3VersionSummary versionSummary) { final GetObjectTaggingResult taggingResult = client.getObjectTagging(new GetObjectTaggingRequest(versionSummary.getBucketName(), versionSummary.getKey())); final Map<String, String> tagMap = new HashMap<>(); if (taggingResult != null) { final List<Tag> tags = taggingResult.getTagSet(); for (final Tag tag : tags) { tagMap.put("s3.tag." + tag.getKey(), tag.getValue()); } } return tagMap; }  }
ListS3 extends AbstractS3Processor { private Map<String, String> writeObjectTags(AmazonS3 client, S3VersionSummary versionSummary) { final GetObjectTaggingResult taggingResult = client.getObjectTagging(new GetObjectTaggingRequest(versionSummary.getBucketName(), versionSummary.getKey())); final Map<String, String> tagMap = new HashMap<>(); if (taggingResult != null) { final List<Tag> tags = taggingResult.getTagSet(); for (final Tag tag : tags) { tagMap.put("s3.tag." + tag.getKey(), tag.getValue()); } } return tagMap; }  @Override Set<Relationship> getRelationships(); @Override void onTrigger(final ProcessContext context, final ProcessSession session); }
ListS3 extends AbstractS3Processor { private Map<String, String> writeObjectTags(AmazonS3 client, S3VersionSummary versionSummary) { final GetObjectTaggingResult taggingResult = client.getObjectTagging(new GetObjectTaggingRequest(versionSummary.getBucketName(), versionSummary.getKey())); final Map<String, String> tagMap = new HashMap<>(); if (taggingResult != null) { final List<Tag> tags = taggingResult.getTagSet(); for (final Tag tag : tags) { tagMap.put("s3.tag." + tag.getKey(), tag.getValue()); } } return tagMap; }  @Override Set<Relationship> getRelationships(); @Override void onTrigger(final ProcessContext context, final ProcessSession session); static final PropertyDescriptor DELIMITER; static final PropertyDescriptor PREFIX; static final PropertyDescriptor USE_VERSIONS; static final PropertyDescriptor LIST_TYPE; static final PropertyDescriptor MIN_AGE; static final PropertyDescriptor WRITE_OBJECT_TAGS; static final List<PropertyDescriptor> properties; static final Set<Relationship> relationships; static final String CURRENT_TIMESTAMP; static final String CURRENT_KEY_PREFIX; }