|
5 | 5 | import static com.eucalyptus.tests.awssdk.N4j.initS3ClientWithNewAccount; |
6 | 6 | import static com.eucalyptus.tests.awssdk.N4j.print; |
7 | 7 | import static com.eucalyptus.tests.awssdk.N4j.testInfo; |
| 8 | +import static org.testng.AssertJUnit.assertEquals; |
8 | 9 | import static org.testng.AssertJUnit.assertTrue; |
9 | 10 |
|
10 | 11 | import java.util.ArrayList; |
|
19 | 20 | import org.testng.annotations.Test; |
20 | 21 |
|
21 | 22 | import com.amazonaws.AmazonServiceException; |
| 23 | +import com.amazonaws.Request; |
| 24 | +import com.amazonaws.Response; |
| 25 | +import com.amazonaws.handlers.RequestHandler2; |
22 | 26 | import com.amazonaws.services.s3.AmazonS3; |
| 27 | +import com.amazonaws.services.s3.AmazonS3Client; |
23 | 28 | import com.amazonaws.services.s3.model.AccessControlList; |
24 | 29 | import com.amazonaws.services.s3.model.AmazonS3Exception; |
25 | 30 | import com.amazonaws.services.s3.model.Bucket; |
@@ -350,7 +355,16 @@ public void testBucketTagging() throws Exception { |
350 | 355 | List<TagSet> tagSetList = new ArrayList<TagSet>(); |
351 | 356 | tagSetList.add(tagSet1); |
352 | 357 | bucketTaggingConfiguration.setTagSets(tagSetList); |
| 358 | + final RequestHandler2 statusCodeCheckingHandler = new RequestHandler2( ) { |
| 359 | + @Override |
| 360 | + public void afterResponse( final Request<?> request, final Response<?> response ) { |
| 361 | + print(account + ": Got response status code " + response.getHttpResponse( ).getStatusCode( )); |
| 362 | + assertEquals( "Status code", 204, response.getHttpResponse( ).getStatusCode( ) ); |
| 363 | + } |
| 364 | + }; |
| 365 | + ((AmazonS3Client)s3).addRequestHandler( statusCodeCheckingHandler ); |
353 | 366 | s3.setBucketTaggingConfiguration(bucketName, bucketTaggingConfiguration); |
| 367 | + ((AmazonS3Client)s3).removeRequestHandler( statusCodeCheckingHandler ); |
354 | 368 |
|
355 | 369 | print(account + ": Getting TagSets for bucket '" + bucketName + "'"); |
356 | 370 | List<TagSet> tagSets = bucketTaggingConfiguration.getAllTagSets(); |
|
0 commit comments