Search in sources :

Example 1 with AnalyticsTagPredicate

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

the class BucketAnalyticsSaxUnmarshallerTest method getResponse_unmarshalls_properly.

@Test
public void getResponse_unmarshalls_properly() throws Exception {
    AnalyticsConfiguration configuration = parseGetAnalyticsConfigurationResponse(GET_RESPONSE).getAnalyticsConfiguration();
    AnalyticsFilter filter = configuration.getFilter();
    StorageClassAnalysis storageClassAnalysis = configuration.getStorageClassAnalysis();
    assertEquals("analytics-id", configuration.getId());
    assertNotNull(filter);
    List<AnalyticsFilterPredicate> operands = ((AnalyticsAndOperator) filter.getPredicate()).getOperands();
    assertEquals(2, operands.size());
    assertEquals("documents/", ((AnalyticsPrefixPredicate) operands.get(0)).getPrefix());
    assertEquals("foo", ((AnalyticsTagPredicate) operands.get(1)).getTag().getKey());
    assertEquals("bar", ((AnalyticsTagPredicate) operands.get(1)).getTag().getValue());
    assertEquals(StorageClassAnalysisSchemaVersion.V_1.toString(), storageClassAnalysis.getDataExport().getOutputSchemaVersion());
    AnalyticsS3BucketDestination s3BucketDestination = storageClassAnalysis.getDataExport().getDestination().getS3BucketDestination();
    assertEquals(AnalyticsS3ExportFileFormat.CSV.toString(), s3BucketDestination.getFormat());
    assertEquals("123456789", s3BucketDestination.getBucketAccountId());
    assertEquals("arn:aws:s3:::destination-bucket", s3BucketDestination.getBucketArn());
    assertEquals("destination-prefix", s3BucketDestination.getPrefix());
}
Also used : AnalyticsConfiguration(com.amazonaws.services.s3.model.analytics.AnalyticsConfiguration) StorageClassAnalysis(com.amazonaws.services.s3.model.analytics.StorageClassAnalysis) AnalyticsFilterPredicate(com.amazonaws.services.s3.model.analytics.AnalyticsFilterPredicate) AnalyticsS3BucketDestination(com.amazonaws.services.s3.model.analytics.AnalyticsS3BucketDestination) AnalyticsFilter(com.amazonaws.services.s3.model.analytics.AnalyticsFilter) AnalyticsTagPredicate(com.amazonaws.services.s3.model.analytics.AnalyticsTagPredicate) AnalyticsAndOperator(com.amazonaws.services.s3.model.analytics.AnalyticsAndOperator) Test(org.junit.Test)

Example 2 with AnalyticsTagPredicate

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

the class BucketAnalyticsSaxUnmarshallerTest method listResponse_unmarshalls_properly.

@Test
public void listResponse_unmarshalls_properly() throws Exception {
    ListBucketAnalyticsConfigurationsResult result = parseListAnalyticsConfigurationResponse(LIST_RESPONSE);
    assertTrue(result.isTruncated());
    assertEquals("token1", result.getContinuationToken());
    assertEquals("token2", result.getNextContinuationToken());
    List<AnalyticsConfiguration> analyticsConfigurationList = result.getAnalyticsConfigurationList();
    assertEquals(2, analyticsConfigurationList.size());
    // Test first analytics configuration
    AnalyticsConfiguration configuration = analyticsConfigurationList.get(0);
    AnalyticsFilter filter = configuration.getFilter();
    StorageClassAnalysis storageClassAnalysis = configuration.getStorageClassAnalysis();
    assertEquals("XXX", configuration.getId());
    assertNotNull(filter);
    List<AnalyticsFilterPredicate> operands = ((AnalyticsAndOperator) filter.getPredicate()).getOperands();
    assertEquals(2, operands.size());
    assertEquals("documents/", ((AnalyticsPrefixPredicate) operands.get(0)).getPrefix());
    assertEquals("foo", ((AnalyticsTagPredicate) operands.get(1)).getTag().getKey());
    assertEquals("bar", ((AnalyticsTagPredicate) operands.get(1)).getTag().getValue());
    assertEquals(StorageClassAnalysisSchemaVersion.V_1.toString(), storageClassAnalysis.getDataExport().getOutputSchemaVersion());
    AnalyticsS3BucketDestination s3BucketDestination = storageClassAnalysis.getDataExport().getDestination().getS3BucketDestination();
    assertEquals(AnalyticsS3ExportFileFormat.CSV.toString(), s3BucketDestination.getFormat());
    assertEquals("123456789", s3BucketDestination.getBucketAccountId());
    assertEquals("arn:aws:s3:::destination-bucket", s3BucketDestination.getBucketArn());
    assertEquals("destination-prefix", s3BucketDestination.getPrefix());
    // Test second analytics configuration
    configuration = analyticsConfigurationList.get(1);
    storageClassAnalysis = configuration.getStorageClassAnalysis();
    assertEquals("YYY", configuration.getId());
    assertEquals("prefix", ((AnalyticsPrefixPredicate) configuration.getFilter().getPredicate()).getPrefix());
    assertEquals("V_2", storageClassAnalysis.getDataExport().getOutputSchemaVersion());
    s3BucketDestination = storageClassAnalysis.getDataExport().getDestination().getS3BucketDestination();
    assertEquals("JSON", s3BucketDestination.getFormat());
    assertEquals("123", s3BucketDestination.getBucketAccountId());
    assertEquals("arn:aws:s3:::bucket2", s3BucketDestination.getBucketArn());
    assertEquals("prefix2", s3BucketDestination.getPrefix());
}
Also used : AnalyticsConfiguration(com.amazonaws.services.s3.model.analytics.AnalyticsConfiguration) StorageClassAnalysis(com.amazonaws.services.s3.model.analytics.StorageClassAnalysis) AnalyticsFilterPredicate(com.amazonaws.services.s3.model.analytics.AnalyticsFilterPredicate) AnalyticsS3BucketDestination(com.amazonaws.services.s3.model.analytics.AnalyticsS3BucketDestination) ListBucketAnalyticsConfigurationsResult(com.amazonaws.services.s3.model.ListBucketAnalyticsConfigurationsResult) AnalyticsFilter(com.amazonaws.services.s3.model.analytics.AnalyticsFilter) AnalyticsTagPredicate(com.amazonaws.services.s3.model.analytics.AnalyticsTagPredicate) AnalyticsAndOperator(com.amazonaws.services.s3.model.analytics.AnalyticsAndOperator) Test(org.junit.Test)

Aggregations

AnalyticsAndOperator (com.amazonaws.services.s3.model.analytics.AnalyticsAndOperator)2 AnalyticsConfiguration (com.amazonaws.services.s3.model.analytics.AnalyticsConfiguration)2 AnalyticsFilter (com.amazonaws.services.s3.model.analytics.AnalyticsFilter)2 AnalyticsFilterPredicate (com.amazonaws.services.s3.model.analytics.AnalyticsFilterPredicate)2 AnalyticsS3BucketDestination (com.amazonaws.services.s3.model.analytics.AnalyticsS3BucketDestination)2 AnalyticsTagPredicate (com.amazonaws.services.s3.model.analytics.AnalyticsTagPredicate)2 StorageClassAnalysis (com.amazonaws.services.s3.model.analytics.StorageClassAnalysis)2 Test (org.junit.Test)2 ListBucketAnalyticsConfigurationsResult (com.amazonaws.services.s3.model.ListBucketAnalyticsConfigurationsResult)1