mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -25,12 +25,12 @@ import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
|||||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||||
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.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.JSONException;
|
||||||
import org.json.JSONObject;
|
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
|
* Unit test to test preference Web Script API
|
||||||
@@ -40,10 +40,13 @@ import org.json.JSONObject;
|
|||||||
public class PreferenceServiceTest extends BaseWebScriptTest
|
public class PreferenceServiceTest extends BaseWebScriptTest
|
||||||
{
|
{
|
||||||
private MutableAuthenticationService authenticationService;
|
private MutableAuthenticationService authenticationService;
|
||||||
|
|
||||||
private AuthenticationComponent authenticationComponent;
|
private AuthenticationComponent authenticationComponent;
|
||||||
|
|
||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
|
|
||||||
private static final String USER_ONE = "PreferenceTestOne" + System.currentTimeMillis();
|
private static final String USER_ONE = "PreferenceTestOne" + System.currentTimeMillis();
|
||||||
|
|
||||||
private static final String USER_BAD = "PreferenceTestBad" + System.currentTimeMillis();
|
private static final String USER_BAD = "PreferenceTestBad" + System.currentTimeMillis();
|
||||||
|
|
||||||
private static final String URL = "/api/people/" + USER_ONE + "/preferences";;
|
private static final String URL = "/api/people/" + USER_ONE + "/preferences";;
|
||||||
@@ -53,8 +56,10 @@ public class PreferenceServiceTest extends BaseWebScriptTest
|
|||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
this.authenticationService = (MutableAuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService");
|
this.authenticationService = (MutableAuthenticationService) getServer().getApplicationContext().getBean(
|
||||||
this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
|
"AuthenticationService");
|
||||||
|
this.authenticationComponent = (AuthenticationComponent) getServer().getApplicationContext().getBean(
|
||||||
|
"authenticationComponent");
|
||||||
this.personService = (PersonService) getServer().getApplicationContext().getBean("PersonService");
|
this.personService = (PersonService) getServer().getApplicationContext().getBean("PersonService");
|
||||||
|
|
||||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
@@ -172,14 +177,14 @@ public class PreferenceServiceTest extends BaseWebScriptTest
|
|||||||
assertFalse(jsonResult.keys().hasNext());
|
assertFalse(jsonResult.keys().hasNext());
|
||||||
|
|
||||||
// Test trying to update another user's permissions
|
// 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
|
// Test error conditions
|
||||||
sendRequest(new GetRequest("/api/people/noExistUser/preferences"), 404);
|
sendRequest(new GetRequest("/api/people/noExistUser/preferences"), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject getPreferenceObj()
|
private JSONObject getPreferenceObj() throws JSONException
|
||||||
throws JSONException
|
|
||||||
{
|
{
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("stringValue", "value");
|
jsonObject.put("stringValue", "value");
|
||||||
@@ -188,8 +193,7 @@ public class PreferenceServiceTest extends BaseWebScriptTest
|
|||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkJSONObject(JSONObject jsonObject)
|
private void checkJSONObject(JSONObject jsonObject) throws JSONException
|
||||||
throws JSONException
|
|
||||||
{
|
{
|
||||||
assertEquals("value", jsonObject.get("stringValue"));
|
assertEquals("value", jsonObject.get("stringValue"));
|
||||||
assertEquals(10, jsonObject.get("numberValue"));
|
assertEquals(10, jsonObject.get("numberValue"));
|
||||||
|
Reference in New Issue
Block a user