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());
}
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());
}
Aggregations