mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -7,17 +7,17 @@ VERSION:2.0
|
|||||||
PRODID:-//Alfresco Software//Calendar 1.1//EN
|
PRODID:-//Alfresco Software//Calendar 1.1//EN
|
||||||
<#list events as item>
|
<#list events as item>
|
||||||
<#assign event = item.event>
|
<#assign event = item.event>
|
||||||
<#assign from = event.properties["ia:fromDate"]>
|
<#assign from = event.start>
|
||||||
<#assign to = event.properties["ia:toDate"]>
|
<#assign to = event.end>
|
||||||
<#assign created = event.properties["cm:created"]>
|
<#assign created = event.createdAt>
|
||||||
BEGIN:VEVENT
|
BEGIN:VEVENT
|
||||||
UID:${event.id}
|
UID:${event.nodeRef.id}
|
||||||
DTSTART:${from?string(dateFormat)}T${from?string(timeFormat)}Z
|
DTSTART:${from?string(dateFormat)}T${from?string(timeFormat)}Z
|
||||||
DTEND:${to?string(dateFormat)}T${to?string(timeFormat)}Z
|
DTEND:${to?string(dateFormat)}T${to?string(timeFormat)}Z
|
||||||
SUMMARY:${event.properties["ia:whatEvent"]!""}
|
SUMMARY:${event.title!""}
|
||||||
DTSTAMP:${created?string(dateFormat)}T${created?string(timeFormat)}Z
|
DTSTAMP:${created?string(dateFormat)}T${created?string(timeFormat)}Z
|
||||||
<#if event.properties["ia:descriptionEvent"]?exists>
|
<#if event.description?exists>
|
||||||
DESCRIPTION:${event.properties["ia:descriptionEvent"]?replace("\\", "\\\\")?replace(",", "\\,")?replace(";", "\\;")?replace("\r?\n", "\\n", "r")}
|
DESCRIPTION:${event.description?replace("\\", "\\\\")?replace(",", "\\,")?replace(";", "\\;")?replace("\r?\n", "\\n", "r")}
|
||||||
</#if>
|
</#if>
|
||||||
END:VEVENT
|
END:VEVENT
|
||||||
</#list>
|
</#list>
|
||||||
|
@@ -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_EVENT_BASE = "/calendar/event/" + SITE_SHORT_NAME_CALENDAR + "/";
|
||||||
private static final String URL_EVENTS_LIST = "/calendar/eventList";
|
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_EVENT_CREATE = "/calendar/create";
|
||||||
|
|
||||||
private static final String URL_USER_EVENTS_LIST = "/calendar/events/user";
|
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
|
// Tests
|
||||||
|
|
||||||
@@ -698,6 +704,19 @@ public class CalendarRestApiTest extends BaseWebScriptTest
|
|||||||
entries = dates.getJSONArray("6/28/2011");
|
entries = dates.getJSONArray("6/28/2011");
|
||||||
assertEquals(1, entries.length());
|
assertEquals(1, entries.length());
|
||||||
assertEquals(EVENT_TITLE_THREE, entries.getJSONObject(0).getString("name"));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user