Search in sources :

Example 1 with ListBucketInventoryConfigurationsResult

use of com.amazonaws.services.s3.model.ListBucketInventoryConfigurationsResult in project aws-sdk-android by aws-amplify.

the class BucketInventorySaxUnmarshallerTest method listResponse_unmarshalls_properly.

@Test
public void listResponse_unmarshalls_properly() throws Exception {
    ListBucketInventoryConfigurationsResult result = parseListBucketInventoryConfigurationsResponse(LIST_RESPONSE);
    assertTrue(result.isTruncated());
    assertEquals("token1", result.getContinuationToken());
    assertEquals("token2", result.getNextContinuationToken());
    List<InventoryConfiguration> inventoryConfigurationList = result.getInventoryConfigurationList();
    assertEquals(2, inventoryConfigurationList.size());
    InventoryConfiguration configuration = inventoryConfigurationList.get(0);
    assertEquals("configId", configuration.getId());
    InventoryS3BucketDestination s3BucketDestination = configuration.getDestination().getS3BucketDestination();
    assertEquals(InventoryFormat.CSV.toString(), s3BucketDestination.getFormat());
    assertEquals("accountId", s3BucketDestination.getAccountId());
    assertEquals("arn:aws:s3:::bucket", s3BucketDestination.getBucketArn());
    assertEquals("prefix", s3BucketDestination.getPrefix());
    assertTrue(configuration.isEnabled());
    assertEquals("prefix", ((InventoryPrefixPredicate) configuration.getInventoryFilter().getPredicate()).getPrefix());
    assertEquals(InventoryIncludedObjectVersions.All.toString(), configuration.getIncludedObjectVersions());
    List<String> optionalFields = configuration.getOptionalFields();
    assertEquals(3, optionalFields.size());
    assertTrue(optionalFields.containsAll(Arrays.asList(InventoryOptionalField.LastModifiedDate.toString(), InventoryOptionalField.StorageClass.toString(), InventoryOptionalField.ReplicationStatus.toString())));
    assertFalse(optionalFields.contains(InventoryOptionalField.Size.toString()));
    assertEquals(InventoryFrequency.Daily.toString(), configuration.getSchedule().getFrequency());
    // Assert second Inventory configuration
    configuration = inventoryConfigurationList.get(1);
    assertEquals("configId2", configuration.getId());
    assertNull(configuration.getInventoryFilter().getPredicate());
}
Also used : InventoryS3BucketDestination(com.amazonaws.services.s3.model.inventory.InventoryS3BucketDestination) InventoryConfiguration(com.amazonaws.services.s3.model.inventory.InventoryConfiguration) ListBucketInventoryConfigurationsResult(com.amazonaws.services.s3.model.ListBucketInventoryConfigurationsResult) Test(org.junit.Test)

Aggregations

ListBucketInventoryConfigurationsResult (com.amazonaws.services.s3.model.ListBucketInventoryConfigurationsResult)1 InventoryConfiguration (com.amazonaws.services.s3.model.inventory.InventoryConfiguration)1 InventoryS3BucketDestination (com.amazonaws.services.s3.model.inventory.InventoryS3BucketDestination)1 Test (org.junit.Test)1