public void testPopulatedOptions() throws Exception { String alarmName = "TestAlarmName"; Date endDate = new Date(new Date().getTime() + 5000); HistoryItemType historyItemType = HistoryItemType.ACTION; int maxRecords = 5; Date startDate = new Date(); Multimap<String, String> formParameters = new ListAlarmHistoryOptions() .alarmName(alarmName) .endDate(endDate) .historyItemType(historyItemType) .maxRecords(maxRecords) .startDate(startDate) .buildFormParameters(); assertEquals(formParameters.get("AlarmName"), ImmutableSet.of(alarmName)); assertEquals(formParameters.get("EndDate"), ImmutableSet.of(dateService.iso8601DateFormat(endDate))); assertEquals(formParameters.get("HistoryItemType"), ImmutableSet.of(historyItemType.toString())); assertEquals(formParameters.get("MaxRecords"), ImmutableSet.of(Integer.toString(maxRecords))); assertEquals(formParameters.get("StartDate"), ImmutableSet.of(dateService.iso8601DateFormat(startDate))); }
public void testEmptyOptions() throws Exception { Multimap<String, String> formParameters = new ListAlarmHistoryOptions().buildFormParameters(); assertFalse(formParameters.containsKey("AlarmName")); assertFalse(formParameters.containsKey("EndDate")); assertFalse(formParameters.containsKey("HistoryItemType")); assertFalse(formParameters.containsKey("MaxRecords")); assertFalse(formParameters.containsKey("NextToken")); assertFalse(formParameters.containsKey("StartDate")); }
ListAlarmHistoryOptions daho = new ListAlarmHistoryOptions().alarmName(alarmName); success = retry(new Predicate<ListAlarmHistoryOptions>() { public boolean apply(ListAlarmHistoryOptions options) {
public void testEmptyOptions() throws Exception { Multimap<String, String> formParameters = new ListAlarmHistoryOptions().buildFormParameters(); assertFalse(formParameters.containsKey("AlarmName")); assertFalse(formParameters.containsKey("EndDate")); assertFalse(formParameters.containsKey("HistoryItemType")); assertFalse(formParameters.containsKey("MaxRecords")); assertFalse(formParameters.containsKey("NextToken")); assertFalse(formParameters.containsKey("StartDate")); }
ListAlarmHistoryOptions daho = new ListAlarmHistoryOptions().alarmName(alarmName); success = retry(new Predicate<ListAlarmHistoryOptions>() { public boolean apply(ListAlarmHistoryOptions options) {
public void testPopulatedOptions() throws Exception { String alarmName = "TestAlarmName"; Date endDate = new Date(new Date().getTime() + 5000); HistoryItemType historyItemType = HistoryItemType.ACTION; int maxRecords = 5; Date startDate = new Date(); Multimap<String, String> formParameters = new ListAlarmHistoryOptions() .alarmName(alarmName) .endDate(endDate) .historyItemType(historyItemType) .maxRecords(maxRecords) .startDate(startDate) .buildFormParameters(); assertEquals(formParameters.get("AlarmName"), ImmutableSet.of(alarmName)); assertEquals(formParameters.get("EndDate"), ImmutableSet.of(dateService.iso8601DateFormat(endDate))); assertEquals(formParameters.get("HistoryItemType"), ImmutableSet.of(historyItemType.toString())); assertEquals(formParameters.get("MaxRecords"), ImmutableSet.of(Integer.toString(maxRecords))); assertEquals(formParameters.get("StartDate"), ImmutableSet.of(dateService.iso8601DateFormat(startDate))); }
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 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()); }