use of com.amazonaws.services.s3.model.metrics.MetricsFilter in project aws-sdk-android by aws-amplify.
the class BucketMetricsSaxUnmarshallerTest method listResponse_unmarshalls_properly.
@Test
public void listResponse_unmarshalls_properly() throws Exception {
ListBucketMetricsConfigurationsResult result = parseListBucketMetricsConfigurationsResponse(LIST_RESPONSE);
assertTrue(result.isTruncated());
assertEquals("token1", result.getContinuationToken());
assertEquals("token2", result.getNextContinuationToken());
List<MetricsConfiguration> metricsConfigurationList = result.getMetricsConfigurationList();
assertEquals(2, metricsConfigurationList.size());
// Test first metrics configuration
MetricsConfiguration configuration = metricsConfigurationList.get(0);
MetricsFilter filter = configuration.getFilter();
assertEquals("id1", configuration.getId());
assertNotNull(filter);
List<MetricsFilterPredicate> operands = ((MetricsAndOperator) filter.getPredicate()).getOperands();
assertEquals(2, operands.size());
assertEquals("documents/", ((MetricsPrefixPredicate) operands.get(0)).getPrefix());
assertEquals("foo", ((MetricsTagPredicate) operands.get(1)).getTag().getKey());
assertEquals("bar", ((MetricsTagPredicate) operands.get(1)).getTag().getValue());
// Test second metrics configuration
configuration = metricsConfigurationList.get(1);
assertEquals("id2", configuration.getId());
MetricsTagPredicate tagPredicate = (MetricsTagPredicate) configuration.getFilter().getPredicate();
assertEquals("key", tagPredicate.getTag().getKey());
assertEquals("value", tagPredicate.getTag().getValue());
}
use of com.amazonaws.services.s3.model.metrics.MetricsFilter in project aws-sdk-android by aws-amplify.
the class BucketMetricsSaxUnmarshallerTest method getResponse_unmarshalls_properly.
@Test
public void getResponse_unmarshalls_properly() throws Exception {
MetricsConfiguration configuration = parseGetBucketMetricsConfigurationResponse(GET_RESPONSE).getMetricsConfiguration();
MetricsFilter filter = configuration.getFilter();
assertEquals("metrics-id", configuration.getId());
List<MetricsFilterPredicate> operands = ((MetricsAndOperator) filter.getPredicate()).getOperands();
assertEquals(3, operands.size());
assertEquals("documents/", ((MetricsPrefixPredicate) operands.get(0)).getPrefix());
assertEquals("foo", ((MetricsTagPredicate) operands.get(1)).getTag().getKey());
assertEquals("bar", ((MetricsTagPredicate) operands.get(1)).getTag().getValue());
assertEquals("", ((MetricsTagPredicate) operands.get(2)).getTag().getKey());
assertEquals("", ((MetricsTagPredicate) operands.get(2)).getTag().getValue());
}
Aggregations