public void test() { InputStream is = getClass().getResourceAsStream("/hosted_zones.xml"); IterableWithMarker<HostedZone> expected = expected(); ListHostedZonesResponseHandler handler = injector.getInstance(ListHostedZonesResponseHandler.class); IterableWithMarker<HostedZone> result = factory.create(handler).parse(is); assertEquals(result.toString(), expected.toString()); }
public void test() { InputStream is = getClass().getResourceAsStream("/hosted_zones.xml"); IterableWithMarker<HostedZone> expected = expected(); ListHostedZonesResponseHandler handler = injector.getInstance(ListHostedZonesResponseHandler.class); IterableWithMarker<HostedZone> result = factory.create(handler).parse(is); assertEquals(result.toString(), expected.toString()); }
/** * Tests parsing all possible XML elements that could be encountered by {@link ListAlarmsResponseHandler}. * * @throws Exception if something goes wrong */ public void testParseFullResponse() throws Exception { IterableWithMarker<Alarm> metricAlarms = factory.create(injector.getInstance(ListAlarmsResponseHandler.class)) .parse(getClass().getResourceAsStream("/DescribeAlarmsResponse.xml")); assertEquals(metricAlarms.toString(), expected().toString()); assertFalse(metricAlarms.nextMarker().isPresent()); }
/** * Tests parsing all possible XML elements that could be encountered by {@link ListAlarmHistoryResponseHandler}. * * @throws Exception if something goes wrong */ public void testParseFullResponse() throws Exception { IterableWithMarker<AlarmHistoryItem> alarmHistoryItems = factory.create(injector.getInstance(ListAlarmHistoryResponseHandler.class)) .parse(getClass().getResourceAsStream("/DescribeAlarmHistoryResponse.xml")); assertEquals(alarmHistoryItems.toString(), expected().toString()); assertFalse(alarmHistoryItems.nextMarker().isPresent()); }
/** * Tests parsing all possible XML elements that could be encountered by {@link ListAlarmHistoryResponseHandler}. * * @throws Exception if something goes wrong */ public void testParseFullResponse() throws Exception { IterableWithMarker<AlarmHistoryItem> alarmHistoryItems = factory.create(injector.getInstance(ListAlarmHistoryResponseHandler.class)) .parse(getClass().getResourceAsStream("/DescribeAlarmHistoryResponse.xml")); assertEquals(alarmHistoryItems.toString(), expected().toString()); assertFalse(alarmHistoryItems.nextMarker().isPresent()); }
/** * Tests parsing all possible XML elements that could be encountered by {@link ListAlarmsResponseHandler}. * * @throws Exception if something goes wrong */ public void testParseFullResponse() throws Exception { IterableWithMarker<Alarm> metricAlarms = factory.create(injector.getInstance(ListAlarmsResponseHandler.class)) .parse(getClass().getResourceAsStream("/DescribeAlarmsResponse.xml")); assertEquals(metricAlarms.toString(), expected().toString()); assertFalse(metricAlarms.nextMarker().isPresent()); }
public void testListWhenResponseIs2xx() { Route53Api success = requestSendsResponse(list, listResponse); assertEquals(success.getResourceRecordSetApiForHostedZone("Z1PA6795UKMFR9").list().get(0).toString(), new ListResourceRecordSetsResponseTest().expected().toString()); }
public void testDescribeAlarmHistory() throws Exception { String alarmName = "TestAlarmName"; HistoryItemType historyItemType = HistoryItemType.ACTION; int maxRecords = 10; String endDateStr = "2013-01-02T00:00:00.000Z"; String startDateStr = "2013-01-01T00:00:00.000Z"; CloudWatchApi cloudWatchApi = requestSendsResponse( alarmRequest(ImmutableMap.<String, String> builder() .put("Action", "DescribeAlarmHistory") .put("AlarmName", alarmName) .put("EndDate", "2013-01-02T00%3A00%3A00.000Z") .put("HistoryItemType", historyItemType.toString()) .put("MaxRecords", Integer.toString(maxRecords)) .put("StartDate", "2013-01-01T00%3A00%3A00.000Z") .put("Signature", "O2u9yIQvCuVpKdUeUDJcswri0YD0sD4%2B/SR5TtYbPeQ%3D") .build()), HttpResponse.builder() .statusCode(200) .payload(payloadFromResourceWithContentType("/DescribeAlarmHistoryResponse.xml", "text/xml")) .build()); assertEquals(new ListAlarmHistoryResponseHandlerTest().expected().toString(), cloudWatchApi.getAlarmApiForRegion(null) .listHistory(new ListAlarmHistoryOptions() .alarmName("TestAlarmName") .endDate(dateService.iso8601DateParse(endDateStr)) .historyItemType(HistoryItemType.ACTION) .maxRecords(maxRecords) .startDate(dateService.iso8601DateParse(startDateStr)) ).get(0).toString()); }
public void testListWhenResponseIs2xx() { Route53Api success = requestSendsResponse(list, listResponse); assertEquals(success.getResourceRecordSetApiForHostedZone("Z1PA6795UKMFR9").list().get(0).toString(), new ListResourceRecordSetsResponseTest().expected().toString()); }
public void testDescribeAlarmHistory() throws Exception { String alarmName = "TestAlarmName"; HistoryItemType historyItemType = HistoryItemType.ACTION; int maxRecords = 10; String endDateStr = "2013-01-02T00:00:00.000Z"; String startDateStr = "2013-01-01T00:00:00.000Z"; CloudWatchApi cloudWatchApi = requestSendsResponse( alarmRequest(ImmutableMap.<String, String> builder() .put("Action", "DescribeAlarmHistory") .put("AlarmName", alarmName) .put("EndDate", "2013-01-02T00%3A00%3A00.000Z") .put("HistoryItemType", historyItemType.toString()) .put("MaxRecords", Integer.toString(maxRecords)) .put("StartDate", "2013-01-01T00%3A00%3A00.000Z") .put("Signature", "O2u9yIQvCuVpKdUeUDJcswri0YD0sD4%2B/SR5TtYbPeQ%3D") .build()), HttpResponse.builder() .statusCode(200) .payload(payloadFromResourceWithContentType("/DescribeAlarmHistoryResponse.xml", "text/xml")) .build()); assertEquals(new ListAlarmHistoryResponseHandlerTest().expected().toString(), cloudWatchApi.getAlarmApiForRegion(null) .listHistory(new ListAlarmHistoryOptions() .alarmName("TestAlarmName") .endDate(dateService.iso8601DateParse(endDateStr)) .historyItemType(HistoryItemType.ACTION) .maxRecords(maxRecords) .startDate(dateService.iso8601DateParse(startDateStr)) ).get(0).toString()); }
public void testList2PagesWhenResponseIs2xx() { HttpResponse noMore = HttpResponse.builder().statusCode(OK.getStatusCode()) .payload(payloadFromStringWithContentType("<ListHostedZonesResponse />", "text/xml")).build(); Route53Api success = requestsSendResponses(list, listResponse, listAt, noMore); assertEquals(success.getHostedZoneApi().list().concat().toString(), new ListHostedZonesResponseTest().expected() .toString()); }
public void testListMetricsWhenResponseIs2xx() throws Exception { HttpResponse listMetricsResponse = HttpResponse.builder().statusCode(200) .payload(payloadFromResourceWithContentType("/list_metrics.xml", "text/xml")).build(); CloudWatchApi apiWhenMetricsExist = requestSendsResponse( listMetrics, listMetricsResponse); assertEquals(apiWhenMetricsExist.getMetricApiForRegion(null).list().get(0).toString(), "[Metric{namespace=AWS/EC2, metricName=CPUUtilization, dimension=[Dimension{name=InstanceId, value=i-689fcf0f}]}]"); }
public void testList2PagesWhenResponseIs2xx() { HttpResponse noMore = HttpResponse.builder().statusCode(OK.getStatusCode()) .payload(payloadFromStringWithContentType("<ListHostedZonesResponse />", "text/xml")).build(); Route53Api success = requestsSendResponses(list, listResponse, listAt, noMore); assertEquals(success.getHostedZoneApi().list().concat().toString(), new ListHostedZonesResponseTest().expected() .toString()); }
public void testListMetricsWhenResponseIs2xx() throws Exception { HttpResponse listMetricsResponse = HttpResponse.builder().statusCode(200) .payload(payloadFromResourceWithContentType("/list_metrics.xml", "text/xml")).build(); CloudWatchApi apiWhenMetricsExist = requestSendsResponse( listMetrics, listMetricsResponse); assertEquals(apiWhenMetricsExist.getMetricApiForRegion(null).list().get(0).toString(), "[Metric{namespace=AWS/EC2, metricName=CPUUtilization, dimension=[Dimension{name=InstanceId, value=i-689fcf0f}]}]"); }
.metricName(EC2Constants.MetricName.CPU_UTILIZATION) .namespace("SOMENEXTTOKEN") .afterMarker(Namespaces.EC2)).toString(), "[Metric{namespace=AWS/EC2, metricName=CPUUtilization, dimension=[Dimension{name=InstanceId, value=i-689fcf0f}]}]");