mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed InviteSender tests broken by r32893.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32931 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -174,9 +174,8 @@ public class InviteSender
|
||||
private Map<String, String> buildArgs(Map<String, String> properties, NodeRef inviter, NodeRef invitee)
|
||||
{
|
||||
String params = buildUrlParamString(properties);
|
||||
String serverPath = ensureEndsWithSlash(properties.get(wfVarServerPath));
|
||||
String acceptLink = serverPath + properties.get(wfVarAcceptUrl) + params;
|
||||
String rejectLink = serverPath + properties.get(wfVarRejectUrl) + params;
|
||||
String acceptLink = makeLink(properties.get(wfVarServerPath), properties.get(wfVarAcceptUrl), params);
|
||||
String rejectLink = makeLink(properties.get(wfVarServerPath), properties.get(wfVarRejectUrl), params);
|
||||
|
||||
Map<String, String> args = new HashMap<String, String>();
|
||||
args.put("inviteePersonRef", invitee.toString());
|
||||
@@ -190,11 +189,14 @@ public class InviteSender
|
||||
return args;
|
||||
}
|
||||
|
||||
protected static String ensureEndsWithSlash(String thePath)
|
||||
protected String makeLink(String location, String endpoint, String queryParams)
|
||||
{
|
||||
return thePath.endsWith("/")?thePath:thePath+"/";
|
||||
location = location.endsWith("/") ? location : location + "/";
|
||||
endpoint = endpoint.startsWith("/") ? endpoint.substring(1) : endpoint;
|
||||
queryParams = queryParams.startsWith("?") ? queryParams : "?" + queryParams;
|
||||
return location + endpoint + queryParams;
|
||||
}
|
||||
|
||||
|
||||
private String getRoleName(Map<String, String> properties)
|
||||
{
|
||||
String roleName = properties.get(wfVarRole);
|
||||
|
@@ -231,12 +231,17 @@ public class InviteSenderTest extends TestCase
|
||||
|
||||
public void testValidServerPath() throws Exception
|
||||
{
|
||||
String validPath = "test://test/path/";
|
||||
String serverPath = InviteSender.ensureEndsWithSlash("test://test/path");
|
||||
assertEquals(validPath,serverPath);
|
||||
|
||||
serverPath = InviteSender.ensureEndsWithSlash("test://test/path/");
|
||||
assertEquals(validPath,serverPath);
|
||||
String validPath = "test://test/path/accept?hello";
|
||||
String link = sender.makeLink("test://test/path", "accept", "hello");
|
||||
assertEquals(validPath, link);
|
||||
link = sender.makeLink("test://test/path/", "accept", "hello");
|
||||
assertEquals(validPath, link);
|
||||
link = sender.makeLink("test://test/path", "/accept", "hello");
|
||||
assertEquals(validPath, link);
|
||||
link = sender.makeLink("test://test/path/", "/accept", "hello");
|
||||
assertEquals(validPath, link);
|
||||
link = sender.makeLink("test://test/path", "/accept", "?hello");
|
||||
assertEquals(validPath, link);
|
||||
}
|
||||
|
||||
protected static String ensureEndsWithSlash(String thePath)
|
||||
|
Reference in New Issue
Block a user