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)
|
private Map<String, String> buildArgs(Map<String, String> properties, NodeRef inviter, NodeRef invitee)
|
||||||
{
|
{
|
||||||
String params = buildUrlParamString(properties);
|
String params = buildUrlParamString(properties);
|
||||||
String serverPath = ensureEndsWithSlash(properties.get(wfVarServerPath));
|
String acceptLink = makeLink(properties.get(wfVarServerPath), properties.get(wfVarAcceptUrl), params);
|
||||||
String acceptLink = serverPath + properties.get(wfVarAcceptUrl) + params;
|
String rejectLink = makeLink(properties.get(wfVarServerPath), properties.get(wfVarRejectUrl), params);
|
||||||
String rejectLink = serverPath + properties.get(wfVarRejectUrl) + params;
|
|
||||||
|
|
||||||
Map<String, String> args = new HashMap<String, String>();
|
Map<String, String> args = new HashMap<String, String>();
|
||||||
args.put("inviteePersonRef", invitee.toString());
|
args.put("inviteePersonRef", invitee.toString());
|
||||||
@@ -190,9 +189,12 @@ public class InviteSender
|
|||||||
return args;
|
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)
|
private String getRoleName(Map<String, String> properties)
|
||||||
|
@@ -231,12 +231,17 @@ public class InviteSenderTest extends TestCase
|
|||||||
|
|
||||||
public void testValidServerPath() throws Exception
|
public void testValidServerPath() throws Exception
|
||||||
{
|
{
|
||||||
String validPath = "test://test/path/";
|
String validPath = "test://test/path/accept?hello";
|
||||||
String serverPath = InviteSender.ensureEndsWithSlash("test://test/path");
|
String link = sender.makeLink("test://test/path", "accept", "hello");
|
||||||
assertEquals(validPath,serverPath);
|
assertEquals(validPath, link);
|
||||||
|
link = sender.makeLink("test://test/path/", "accept", "hello");
|
||||||
serverPath = InviteSender.ensureEndsWithSlash("test://test/path/");
|
assertEquals(validPath, link);
|
||||||
assertEquals(validPath,serverPath);
|
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)
|
protected static String ensureEndsWithSlash(String thePath)
|
||||||
|
Reference in New Issue
Block a user