Merged V4.1-BUG-FIX to HEAD

41549: (RECORD ONLY) ALF-15908: Ensure custom actions work (latest Surf libs r1140)
   41551: Fixed the failing unit test for ALF-15687.
   41553: ALF-14201: sorted out sorting issue in historic task query
   41554: ALF-15930: Removed redundant duplicate condition checking when deploying a workflow


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@41555 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-09-13 10:06:19 +00:00
parent 11ee3f8511
commit e7fefd8f6a

View File

@@ -25,12 +25,12 @@ import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.service.cmr.security.MutableAuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.util.PropertyMap;
import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest;
import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest;
import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest;
import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest;
import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest;
import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest;
import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
/**
* Unit test to test preference Web Script API
@@ -40,10 +40,13 @@ import org.json.JSONObject;
public class PreferenceServiceTest extends BaseWebScriptTest
{
private MutableAuthenticationService authenticationService;
private AuthenticationComponent authenticationComponent;
private PersonService personService;
private static final String USER_ONE = "PreferenceTestOne" + System.currentTimeMillis();
private static final String USER_BAD = "PreferenceTestBad" + System.currentTimeMillis();
private static final String URL = "/api/people/" + USER_ONE + "/preferences";;
@@ -53,9 +56,11 @@ public class PreferenceServiceTest extends BaseWebScriptTest
{
super.setUp();
this.authenticationService = (MutableAuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService");
this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
this.authenticationService = (MutableAuthenticationService) getServer().getApplicationContext().getBean(
"AuthenticationService");
this.authenticationComponent = (AuthenticationComponent) getServer().getApplicationContext().getBean(
"authenticationComponent");
this.personService = (PersonService) getServer().getApplicationContext().getBean("PersonService");
this.authenticationComponent.setSystemUserAsCurrentUser();
@@ -172,14 +177,14 @@ public class PreferenceServiceTest extends BaseWebScriptTest
assertFalse(jsonResult.keys().hasNext());
// Test trying to update another user's permissions
sendRequest(new PostRequest("/api/people/" + USER_BAD + "/preferences", jsonObject.toString(), "application/json"), 500);
sendRequest(new PostRequest("/api/people/" + USER_BAD + "/preferences", jsonObject.toString(),
"application/json"), 401);
// Test error conditions
sendRequest(new GetRequest("/api/people/noExistUser/preferences"), 404);
}
private JSONObject getPreferenceObj()
throws JSONException
private JSONObject getPreferenceObj() throws JSONException
{
JSONObject jsonObject = new JSONObject();
jsonObject.put("stringValue", "value");
@@ -188,8 +193,7 @@ public class PreferenceServiceTest extends BaseWebScriptTest
return jsonObject;
}
private void checkJSONObject(JSONObject jsonObject)
throws JSONException
private void checkJSONObject(JSONObject jsonObject) throws JSONException
{
assertEquals("value", jsonObject.get("stringValue"));
assertEquals(10, jsonObject.get("numberValue"));