|
35 | 35 | import com.emc.object.s3.jersey.FaultInjectionFilter;
|
36 | 36 | import com.emc.object.s3.jersey.S3EncryptionClient;
|
37 | 37 | import com.emc.object.s3.jersey.S3JerseyClient;
|
| 38 | +import com.emc.object.s3.request.DeleteObjectRequest; |
| 39 | +import com.emc.object.s3.request.GetObjectRequest; |
| 40 | +import com.emc.object.s3.request.GetObjectTaggingRequest; |
38 | 41 | import com.emc.object.s3.request.PutObjectRequest;
|
39 | 42 | import com.emc.util.RandomInputStream;
|
40 | 43 | import org.apache.commons.codec.digest.DigestUtils;
|
|
52 | 55 | import java.security.KeyPair;
|
53 | 56 | import java.security.interfaces.RSAPrivateKey;
|
54 | 57 | import java.security.interfaces.RSAPublicKey;
|
| 58 | +import java.util.Arrays; |
| 59 | +import java.util.List; |
55 | 60 | import java.util.Properties;
|
56 | 61 |
|
57 | 62 | import static org.junit.Assert.assertEquals;
|
@@ -557,6 +562,69 @@ public void testExtendObjectRetentionPeriod() {
|
557 | 562 | public void testPreSignedUrlHeaderOverrides() throws Exception {
|
558 | 563 | }
|
559 | 564 |
|
| 565 | + @Ignore |
| 566 | + @Override |
| 567 | + public void testSingleMultipartUploadWithRetention() { |
| 568 | + } |
| 569 | + |
| 570 | + @Ignore |
| 571 | + @Override |
| 572 | + public void testCopyObjectWithLegalHoldON() { |
| 573 | + } |
| 574 | + |
| 575 | + @Override |
| 576 | + public void testGetPutDeleteObjectWithTagging() { |
| 577 | + // set up env |
| 578 | + String bucketName = getTestBucket(), key = "test-object-tagging"; |
| 579 | + client.setBucketVersioning(bucketName, new VersioningConfiguration().withStatus(VersioningConfiguration.Status.Enabled)); |
| 580 | + |
| 581 | + // write version 1 |
| 582 | + client.putObject(new PutObjectRequest(bucketName, key, "Hello Version 1 !") |
| 583 | + .withObjectTagging(new ObjectTagging().withTagSet(Arrays.asList(new ObjectTag("k11", "v11"), new ObjectTag("k12", "v12"))))); |
| 584 | + // write version 2 |
| 585 | + client.putObject(new PutObjectRequest(bucketName, key, "Hello Version 2 !")); |
| 586 | + |
| 587 | + // NOTE: encryption client creates 2 versions per PUT, due to secondary metadata update operation |
| 588 | + List<AbstractVersion> versions = client.listVersions(bucketName, key).getVersions(); |
| 589 | + String versionId1a = versions.get(3).getVersionId(); |
| 590 | + String versionId1b = versions.get(2).getVersionId(); |
| 591 | + String versionId2a = versions.get(1).getVersionId(); |
| 592 | + String versionId2b = versions.get(0).getVersionId(); |
| 593 | + |
| 594 | + // Only the particular version of the object should get deleted and no other versions of object should be affected |
| 595 | + // NOTE: have to delete both versions created by the encryption client |
| 596 | + client.deleteObject(new DeleteObjectRequest(bucketName, key).withVersionId(versionId2a)); |
| 597 | + client.deleteObject(new DeleteObjectRequest(bucketName, key).withVersionId(versionId2b)); |
| 598 | + // NOTE: actually both versions that the encryption client creates should have tagging set |
| 599 | + // but to test, we must use rclient (raw client) because encryption client cannot read the intermediate version |
| 600 | + Assert.assertEquals(2, |
| 601 | + rclient.getObject(new GetObjectRequest(bucketName, key).withVersionId(versionId1a), String.class).getObjectMetadata().getTaggingCount()); |
| 602 | + Assert.assertEquals(2, |
| 603 | + client.getObject(new GetObjectRequest(bucketName, key).withVersionId(versionId1b), String.class).getObjectMetadata().getTaggingCount()); |
| 604 | + |
| 605 | + // Object and associated multiple tags should get deleted |
| 606 | + // NOTE: have to delete both versions created by the encryption client |
| 607 | + client.deleteObject(new DeleteObjectRequest(bucketName, key).withVersionId(versionId1a)); |
| 608 | + client.deleteObject(new DeleteObjectRequest(bucketName, key).withVersionId(versionId1b)); |
| 609 | + try { |
| 610 | + client.getObjectTagging(new GetObjectTaggingRequest(bucketName, key).withVersionId(versionId1b)); |
| 611 | + Assert.fail("Fail was expected. Can NOT get tags from a deleted object"); |
| 612 | + } catch (S3Exception e) { |
| 613 | + Assert.assertEquals(404, e.getHttpCode()); |
| 614 | + Assert.assertEquals("NoSuchKey", e.getErrorCode()); |
| 615 | + } |
| 616 | + } |
| 617 | + |
| 618 | + @Ignore |
| 619 | + @Override |
| 620 | + public void testCopyObjectWithTaggingAndMeta() { |
| 621 | + } |
| 622 | + |
| 623 | + @Ignore |
| 624 | + @Override |
| 625 | + public void testMultipartUploadWithTagging() { |
| 626 | + } |
| 627 | + |
560 | 628 | private class ErrorStream extends FilterInputStream {
|
561 | 629 | private int callCount = 0;
|
562 | 630 |
|
|
0 commit comments