Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

59064: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      59042: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1)
         58919 : MNT-9205 : Search by IM property with spaces doesn't work
            - Using correct regexp to split search term. Added a test


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62089 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-12 00:55:21 +00:00
parent 8f5df07015
commit c26d709423

View File

@@ -29,6 +29,7 @@ import org.alfresco.service.cmr.security.MutableAuthenticationService;
import org.alfresco.service.cmr.security.NoSuchPersonException; import org.alfresco.service.cmr.security.NoSuchPersonException;
import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.util.PropertyMap; import org.alfresco.util.PropertyMap;
import org.springframework.extensions.surf.util.URLEncoder;
import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest;
import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest;
@@ -196,6 +197,28 @@ public class PersonServiceTest extends BaseWebScriptTest
Response response = sendRequest(new GetRequest(URL_PEOPLE), 200); Response response = sendRequest(new GetRequest(URL_PEOPLE), 200);
} }
public void testJobWithSpace() throws Exception
{
String userName = RandomStringUtils.randomNumeric(6);
String userJob = "myJob" + RandomStringUtils.randomNumeric(2) + " myJob" + RandomStringUtils.randomNumeric(3);
//we need to ecape a spaces for search
String jobSearchString = userJob.replace(" ", "\\ ");
createPerson(userName, "myTitle", "myFirstName", "myLastName", "myOrganisation",
userJob, "firstName.lastName@email.com", "myBio", "images/avatar.jpg",
Status.STATUS_OK);
// Get a person
Response response = sendRequest(new GetRequest(URL_PEOPLE + "?filter=" + URLEncoder.encode("jobtitle:" + jobSearchString)), 200);
JSONObject res = new JSONObject(response.getContentAsString());
assertEquals(1, res.getJSONArray("people").length());
response = sendRequest(new GetRequest(URL_PEOPLE + "?filter=" + URLEncoder.encode("jobtitle:" + userJob)), 200);
res = new JSONObject(response.getContentAsString());
assertEquals(0, res.getJSONArray("people").length());
}
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void testGetPerson() throws Exception public void testGetPerson() throws Exception
{ {