ALF-10318 Tweak iCAL ftl for recent changes, and add REST unit tests for the iCAL feed webscript

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30602 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-09-19 13:10:10 +00:00
parent ff3df63e6a
commit 05b02a4350
2 changed files with 27 additions and 8 deletions

View File

@@ -70,7 +70,7 @@ public class CalendarRestApiTest extends BaseWebScriptTest
private static final String URL_EVENT_BASE = "/calendar/event/" + SITE_SHORT_NAME_CALENDAR + "/";
private static final String URL_EVENTS_LIST = "/calendar/eventList";
private static final String URL_EVENTS_LIST_ICS = "/calendar/eventList-" + SITE_SHORT_NAME_CALENDAR + ".ics";
private static final String URL_EVENTS_LIST_ICS = "/calendar/eventList-" + SITE_SHORT_NAME_CALENDAR + ".ics?format=calendar";
private static final String URL_EVENT_CREATE = "/calendar/create";
private static final String URL_USER_EVENTS_LIST = "/calendar/events/user";
@@ -351,6 +351,12 @@ public class CalendarRestApiTest extends BaseWebScriptTest
}
}
private String getEntriesICAL() throws Exception
{
Response response = sendRequest(new GetRequest(URL_EVENTS_LIST_ICS), 200);
return response.getContentAsString();
}
// Tests
@@ -698,6 +704,19 @@ public class CalendarRestApiTest extends BaseWebScriptTest
entries = dates.getJSONArray("6/28/2011");
assertEquals(1, entries.length());
assertEquals(EVENT_TITLE_THREE, entries.getJSONObject(0).getString("name"));
// Now check the ICS
String ical = getEntriesICAL();
assertTrue("Invalid ICAL:\n" + ical, ical.contains("BEGIN:VCALENDAR"));
assertTrue("Invalid ICAL:\n" + ical, ical.contains("END:VCALENDAR"));
// Should have the three entries
assertEquals(3+1, ical.split("BEGIN:VEVENT").length);
assertTrue("Title not found:\n" + ical, ical.contains("SUMMARY:"+EVENT_TITLE_ONE));
assertTrue("Title not found:\n" + ical, ical.contains("SUMMARY:"+EVENT_TITLE_TWO));
assertTrue("Title not found:\n" + ical, ical.contains("SUMMARY:"+EVENT_TITLE_THREE));
}
/**