mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge from SEAMIST3
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10728 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -175,7 +175,7 @@ public class DiscussionServiceTest extends BaseWebScriptTest
|
|||||||
JSONObject post = new JSONObject();
|
JSONObject post = new JSONObject();
|
||||||
post.put("title", title);
|
post.put("title", title);
|
||||||
post.put("content", content);
|
post.put("content", content);
|
||||||
Response response = sendRequest(new PutRequest(URL_FORUM_POST + name, post.toString(), "application/json"), expectedStatus);
|
Response response = sendRequest(new PutRequest(URL_FORUM_POST + nodeRef, post.toString(), "application/json"), expectedStatus);
|
||||||
|
|
||||||
if (expectedStatus != 200)
|
if (expectedStatus != 200)
|
||||||
{
|
{
|
||||||
|
@@ -50,12 +50,10 @@ import org.alfresco.service.cmr.workflow.WorkflowService;
|
|||||||
import org.alfresco.util.PropertyMap;
|
import org.alfresco.util.PropertyMap;
|
||||||
import org.alfresco.util.URLEncoder;
|
import org.alfresco.util.URLEncoder;
|
||||||
import org.alfresco.web.scripts.Status;
|
import org.alfresco.web.scripts.Status;
|
||||||
<<<<<<< .working
|
|
||||||
import org.apache.commons.lang.RandomStringUtils;
|
|
||||||
=======
|
|
||||||
import org.alfresco.web.scripts.TestWebScriptServer.GetRequest;
|
import org.alfresco.web.scripts.TestWebScriptServer.GetRequest;
|
||||||
|
import org.alfresco.web.scripts.TestWebScriptServer.PutRequest;
|
||||||
import org.alfresco.web.scripts.TestWebScriptServer.Response;
|
import org.alfresco.web.scripts.TestWebScriptServer.Response;
|
||||||
>>>>>>> .merge-right.r9819
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -283,18 +281,11 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
|
|
||||||
private void deletePersonByUserName(String userName)
|
private void deletePersonByUserName(String userName)
|
||||||
{
|
{
|
||||||
<<<<<<< .working
|
|
||||||
// delete authentication if authentication exists for given user name
|
// delete authentication if authentication exists for given user name
|
||||||
if (this.authenticationService.authenticationExists(userName))
|
if (this.authenticationService.authenticationExists(userName))
|
||||||
{
|
{
|
||||||
this.authenticationService.deleteAuthentication(userName);
|
this.authenticationService.deleteAuthentication(userName);
|
||||||
}
|
}
|
||||||
=======
|
|
||||||
// Inviter sends invitation to Invitee to join a Site
|
|
||||||
String startInviteUrl = URL_INVITE_SERVICE + "/" + INVITE_ACTION_START + "?inviteeEmail=" + inviteeEmail
|
|
||||||
+ "&siteShortName=" + siteShortName;
|
|
||||||
Response response = sendRequest(new GetRequest(startInviteUrl), expectedStatus);
|
|
||||||
>>>>>>> .merge-right.r9819
|
|
||||||
|
|
||||||
// delete user account
|
// delete user account
|
||||||
if (this.mutableAuthenticationDao.userExists(userName))
|
if (this.mutableAuthenticationDao.userExists(userName))
|
||||||
@@ -326,8 +317,7 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
+ "&acceptUrl=" + "page/accept-invite"
|
+ "&acceptUrl=" + "page/accept-invite"
|
||||||
+ "&rejectUrl=" + "page/reject-invite";
|
+ "&rejectUrl=" + "page/reject-invite";
|
||||||
|
|
||||||
MockHttpServletResponse response = getRequest(startInviteUrl,
|
Response response = sendRequest(new GetRequest(startInviteUrl), expectedStatus);
|
||||||
expectedStatus);
|
|
||||||
|
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
|
|
||||||
@@ -354,8 +344,7 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
String getInvitesUrl = URL_INVITES_SERVICE + "?inviteId=" + inviteId;
|
String getInvitesUrl = URL_INVITES_SERVICE + "?inviteId=" + inviteId;
|
||||||
|
|
||||||
// invoke get invites web script
|
// invoke get invites web script
|
||||||
MockHttpServletResponse response = getRequest(getInvitesUrl,
|
Response response = sendRequest(new GetRequest(getInvitesUrl), expectedStatus);
|
||||||
expectedStatus);
|
|
||||||
|
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
|
|
||||||
@@ -370,8 +359,7 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
+ inviterUserName;
|
+ inviterUserName;
|
||||||
|
|
||||||
// invoke get invites web script
|
// invoke get invites web script
|
||||||
MockHttpServletResponse response = getRequest(getInvitesUrl,
|
Response response = sendRequest(new GetRequest(getInvitesUrl), expectedStatus);
|
||||||
expectedStatus);
|
|
||||||
|
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
|
|
||||||
@@ -386,8 +374,7 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
+ inviteeUserName;
|
+ inviteeUserName;
|
||||||
|
|
||||||
// invoke get invites web script
|
// invoke get invites web script
|
||||||
MockHttpServletResponse response = getRequest(getInvitesUrl,
|
Response response = sendRequest(new GetRequest(getInvitesUrl), expectedStatus);
|
||||||
expectedStatus);
|
|
||||||
|
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
|
|
||||||
@@ -402,8 +389,7 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
+ siteShortName;
|
+ siteShortName;
|
||||||
|
|
||||||
// invoke get invites web script
|
// invoke get invites web script
|
||||||
MockHttpServletResponse response = getRequest(getInvitesUrl,
|
Response response = sendRequest(new GetRequest(getInvitesUrl), expectedStatus);
|
||||||
expectedStatus);
|
|
||||||
|
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
|
|
||||||
@@ -491,15 +477,8 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
String inviteId = result.getString("inviteId");
|
String inviteId = result.getString("inviteId");
|
||||||
|
|
||||||
// Inviter cancels pending invitation
|
// Inviter cancels pending invitation
|
||||||
<<<<<<< .working
|
String cancelInviteUrl = URL_INVITE_SERVICE + "/" + INVITE_ACTION_CANCEL + "?inviteId=" + inviteId;
|
||||||
String cancelInviteUrl = URL_INVITE_SERVICE + "/"
|
|
||||||
+ INVITE_ACTION_CANCEL + "?inviteId=" + inviteId;
|
|
||||||
MockHttpServletResponse response = getRequest(cancelInviteUrl,
|
|
||||||
Status.STATUS_OK);
|
|
||||||
=======
|
|
||||||
String cancelInviteUrl = URL_INVITE_SERVICE + "/" + INVITE_ACTION_CANCEL + "?workflowId=" + workflowId;
|
|
||||||
Response response = sendRequest(new GetRequest(cancelInviteUrl), Status.STATUS_OK);
|
Response response = sendRequest(new GetRequest(cancelInviteUrl), Status.STATUS_OK);
|
||||||
>>>>>>> .merge-right.r9819
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAcceptInvite() throws Exception
|
public void testAcceptInvite() throws Exception
|
||||||
@@ -517,10 +496,8 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
String inviteeUserName = result.getString("inviteeUserName");
|
String inviteeUserName = result.getString("inviteeUserName");
|
||||||
|
|
||||||
// Invitee accepts invitation to a Site from Inviter
|
// Invitee accepts invitation to a Site from Inviter
|
||||||
<<<<<<< .working
|
|
||||||
String acceptInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket + "/accept";
|
String acceptInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket + "/accept";
|
||||||
MockHttpServletResponse response = putRequest(acceptInviteUrl,
|
Response response = sendRequest(new PutRequest(acceptInviteUrl, (byte[])null, null), Status.STATUS_OK);
|
||||||
Status.STATUS_OK, null, null);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// test that invitation represented by invite ID (of invitation started
|
// test that invitation represented by invite ID (of invitation started
|
||||||
@@ -535,11 +512,6 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
|
|
||||||
// there should no longer be any invites identified by invite ID pending
|
// there should no longer be any invites identified by invite ID pending
|
||||||
assertEquals(getInvitesResult.getJSONArray("invites").length(), 0);
|
assertEquals(getInvitesResult.getJSONArray("invites").length(), 0);
|
||||||
=======
|
|
||||||
String acceptInviteUrl = URL_INVITERSP_SERVICE + "/" + INVITE_RSP_ACCEPT + "?workflowId=" + workflowId
|
|
||||||
+ "&inviteeUserName=" + inviteeUserName + "&siteShortName=" + SITE_SHORT_NAME_INVITE;
|
|
||||||
Response response = sendRequest(new GetRequest(acceptInviteUrl), Status.STATUS_OK);
|
|
||||||
>>>>>>> .merge-right.r9819
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRejectInvite() throws Exception
|
public void testRejectInvite() throws Exception
|
||||||
@@ -558,8 +530,7 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
|
|
||||||
// Invitee rejects invitation to a Site from Inviter
|
// Invitee rejects invitation to a Site from Inviter
|
||||||
String rejectInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket + "/reject";
|
String rejectInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket + "/reject";
|
||||||
MockHttpServletResponse response = putRequest(rejectInviteUrl,
|
Response response = sendRequest(new PutRequest(rejectInviteUrl, (byte[])null, null), Status.STATUS_OK);
|
||||||
Status.STATUS_OK, null, null);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// test that invite represented by invite ID (of invitation started
|
// test that invite represented by invite ID (of invitation started
|
||||||
@@ -569,8 +540,7 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
//
|
//
|
||||||
|
|
||||||
// get pending invite matching inviteId from invite started above
|
// get pending invite matching inviteId from invite started above
|
||||||
JSONObject getInvitesResult = getInvitesByInviteId(inviteId,
|
JSONObject getInvitesResult = getInvitesByInviteId(inviteId, Status.STATUS_OK);
|
||||||
Status.STATUS_OK);
|
|
||||||
|
|
||||||
// there should no longer be any invites identified by invite ID pending
|
// there should no longer be any invites identified by invite ID pending
|
||||||
assertEquals(getInvitesResult.getJSONArray("invites").length(), 0);
|
assertEquals(getInvitesResult.getJSONArray("invites").length(), 0);
|
||||||
@@ -592,21 +562,11 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
JSONObject getInvitesResult = getInvitesByInviteId(inviteId,
|
JSONObject getInvitesResult = getInvitesByInviteId(inviteId,
|
||||||
Status.STATUS_OK);
|
Status.STATUS_OK);
|
||||||
|
|
||||||
<<<<<<< .working
|
|
||||||
assertEquals(getInvitesResult.getJSONArray("invites").length(), 1);
|
assertEquals(getInvitesResult.getJSONArray("invites").length(), 1);
|
||||||
|
|
||||||
JSONObject inviteJSONObj = getInvitesResult.getJSONArray("invites").getJSONObject(0);
|
JSONObject inviteJSONObj = getInvitesResult.getJSONArray("invites").getJSONObject(0);
|
||||||
|
|
||||||
assertEquals(inviteId, inviteJSONObj.get("inviteId"));
|
assertEquals(inviteId, inviteJSONObj.get("inviteId"));
|
||||||
=======
|
|
||||||
// get hold of invitee user name that was generated as part of starting the invite
|
|
||||||
String inviteeUserName = result.getString("inviteeUserName");
|
|
||||||
|
|
||||||
// Invitee rejects invitation to a Site from Inviter
|
|
||||||
String rejectInviteUrl = URL_INVITERSP_SERVICE + "/" + INVITE_RSP_REJECT + "?workflowId=" + workflowId
|
|
||||||
+ "&inviteeUserName=" + inviteeUserName + "&siteShortName=" + SITE_SHORT_NAME_INVITE;
|
|
||||||
Response response = sendRequest(new GetRequest(rejectInviteUrl), Status.STATUS_OK);
|
|
||||||
>>>>>>> .merge-right.r9819
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetInvitesByInviterUserName() throws Exception
|
public void testGetInvitesByInviterUserName() throws Exception
|
||||||
|
@@ -33,8 +33,11 @@ import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
|||||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
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.alfresco.web.scripts.Status;
|
||||||
|
import org.alfresco.web.scripts.TestWebScriptServer.DeleteRequest;
|
||||||
import org.alfresco.web.scripts.TestWebScriptServer.GetRequest;
|
import org.alfresco.web.scripts.TestWebScriptServer.GetRequest;
|
||||||
import org.alfresco.web.scripts.TestWebScriptServer.PostRequest;
|
import org.alfresco.web.scripts.TestWebScriptServer.PostRequest;
|
||||||
|
import org.alfresco.web.scripts.TestWebScriptServer.PutRequest;
|
||||||
import org.alfresco.web.scripts.TestWebScriptServer.Response;
|
import org.alfresco.web.scripts.TestWebScriptServer.Response;
|
||||||
import org.apache.commons.lang.RandomStringUtils;
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@@ -142,8 +145,7 @@ public class PersonServiceTest extends BaseWebScriptTest
|
|||||||
person.put("jobtitle", jobTitle);
|
person.put("jobtitle", jobTitle);
|
||||||
person.put("email", email);
|
person.put("email", email);
|
||||||
|
|
||||||
MockHttpServletResponse response = putRequest(
|
Response response = sendRequest(new PutRequest(URL_PEOPLE + "/" + userName, person.toString(), "application/json"), expectedStatus);
|
||||||
URL_PEOPLE + "/" + userName, expectedStatus, person.toString(), "application/json");
|
|
||||||
|
|
||||||
// switch back to non-admin user
|
// switch back to non-admin user
|
||||||
this.authenticationComponent.setCurrentUser(currentUser);
|
this.authenticationComponent.setCurrentUser(currentUser);
|
||||||
@@ -191,7 +193,7 @@ public class PersonServiceTest extends BaseWebScriptTest
|
|||||||
String adminUser = this.authenticationComponent.getSystemUserName();
|
String adminUser = this.authenticationComponent.getSystemUserName();
|
||||||
this.authenticationComponent.setCurrentUser(adminUser);
|
this.authenticationComponent.setCurrentUser(adminUser);
|
||||||
|
|
||||||
MockHttpServletResponse response = deleteRequest(URL_PEOPLE + "/" + userName, expectedStatus);
|
Response response = sendRequest(new DeleteRequest(URL_PEOPLE + "/" + userName), expectedStatus);
|
||||||
this.createdPeople.remove(userName);
|
this.createdPeople.remove(userName);
|
||||||
|
|
||||||
// switch back to non-admin user
|
// switch back to non-admin user
|
||||||
|
@@ -159,17 +159,17 @@ public class SiteServiceTest extends BaseWebScriptTest
|
|||||||
createSite("myPreset", GUID.generate(), "myTitle", "myDescription", true, 200);
|
createSite("myPreset", GUID.generate(), "myTitle", "myDescription", true, 200);
|
||||||
createSite("myPreset", GUID.generate(), "myTitle", "myDescription", true, 200);
|
createSite("myPreset", GUID.generate(), "myTitle", "myDescription", true, 200);
|
||||||
|
|
||||||
response = getRequest(URL_SITES, 200);
|
response = sendRequest(new GetRequest(URL_SITES), 200);
|
||||||
result = new JSONArray(response.getContentAsString());
|
result = new JSONArray(response.getContentAsString());
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(5, result.length());
|
assertEquals(5, result.length());
|
||||||
|
|
||||||
response = getRequest(URL_SITES + "?size=3", 200);
|
response = sendRequest(new GetRequest(URL_SITES + "?size=3"), 200);
|
||||||
result = new JSONArray(response.getContentAsString());
|
result = new JSONArray(response.getContentAsString());
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(3, result.length());
|
assertEquals(3, result.length());
|
||||||
|
|
||||||
response = getRequest(URL_SITES + "?size=13", 200);
|
response = sendRequest(new GetRequest(URL_SITES + "?size=13"), 200);
|
||||||
result = new JSONArray(response.getContentAsString());
|
result = new JSONArray(response.getContentAsString());
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(5, result.length());
|
assertEquals(5, result.length());
|
||||||
@@ -361,7 +361,7 @@ public class SiteServiceTest extends BaseWebScriptTest
|
|||||||
String shortName2 = GUID.generate();
|
String shortName2 = GUID.generate();
|
||||||
createSite("myPreset", shortName2, "myTitle", "myDescription", true, 200);
|
createSite("myPreset", shortName2, "myTitle", "myDescription", true, 200);
|
||||||
|
|
||||||
MockHttpServletResponse response = getRequest("/api/people/" + USER_TWO + "/sites", 200);
|
Response response = sendRequest(new GetRequest("/api/people/" + USER_TWO + "/sites"), 200);
|
||||||
JSONArray result = new JSONArray(response.getContentAsString());
|
JSONArray result = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
@@ -373,39 +373,39 @@ public class SiteServiceTest extends BaseWebScriptTest
|
|||||||
JSONObject person = new JSONObject();
|
JSONObject person = new JSONObject();
|
||||||
person.put("userName", USER_TWO);
|
person.put("userName", USER_TWO);
|
||||||
membership.put("person", person);
|
membership.put("person", person);
|
||||||
postRequest(URL_SITES + "/" + shortName + URL_MEMBERSHIPS, 200, membership.toString(), "application/json");
|
sendRequest(new PostRequest(URL_SITES + "/" + shortName + URL_MEMBERSHIPS, membership.toString(), "application/json"), 200);
|
||||||
membership = new JSONObject();
|
membership = new JSONObject();
|
||||||
membership.put("role", SiteModel.SITE_CONSUMER);
|
membership.put("role", SiteModel.SITE_CONSUMER);
|
||||||
person = new JSONObject();
|
person = new JSONObject();
|
||||||
person.put("userName", USER_TWO);
|
person.put("userName", USER_TWO);
|
||||||
membership.put("person", person);
|
membership.put("person", person);
|
||||||
postRequest(URL_SITES + "/" + shortName2 + URL_MEMBERSHIPS, 200, membership.toString(), "application/json");
|
sendRequest(new PostRequest(URL_SITES + "/" + shortName2 + URL_MEMBERSHIPS, membership.toString(), "application/json"), 200);
|
||||||
|
|
||||||
response = getRequest("/api/people/" + USER_TWO + "/sites", 200);
|
response = sendRequest(new GetRequest("/api/people/" + USER_TWO + "/sites"), 200);
|
||||||
result = new JSONArray(response.getContentAsString());
|
result = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(2, result.length());
|
assertEquals(2, result.length());
|
||||||
|
|
||||||
response = getRequest("/api/people/" + USER_ONE + "/sites", 200);
|
response = sendRequest(new GetRequest("/api/people/" + USER_ONE + "/sites"), 200);
|
||||||
result = new JSONArray(response.getContentAsString());
|
result = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(2, result.length());
|
assertEquals(2, result.length());
|
||||||
|
|
||||||
response = getRequest("/api/people/" + USER_THREE + "/sites", 200);
|
response = sendRequest(new GetRequest("/api/people/" + USER_THREE + "/sites"), 200);
|
||||||
result = new JSONArray(response.getContentAsString());
|
result = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(0, result.length());
|
assertEquals(0, result.length());
|
||||||
|
|
||||||
response = getRequest("/api/people/" + USER_ONE + "/sites?size=1", 200);
|
response = sendRequest(new GetRequest("/api/people/" + USER_ONE + "/sites?size=1"), 200);
|
||||||
result = new JSONArray(response.getContentAsString());
|
result = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(1, result.length());
|
assertEquals(1, result.length());
|
||||||
|
|
||||||
response = getRequest("/api/people/" + USER_ONE + "/sites?size=5", 200);
|
response = sendRequest(new GetRequest("/api/people/" + USER_ONE + "/sites?size=5"), 200);
|
||||||
result = new JSONArray(response.getContentAsString());
|
result = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
|
@@ -37,8 +37,9 @@ import org.alfresco.service.cmr.security.PersonService;
|
|||||||
import org.alfresco.service.cmr.tagging.TaggingService;
|
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.alfresco.util.PropertyMap;
|
import org.alfresco.util.PropertyMap;
|
||||||
|
import org.alfresco.web.scripts.TestWebScriptServer.GetRequest;
|
||||||
|
import org.alfresco.web.scripts.TestWebScriptServer.Response;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.springframework.mock.web.MockHttpServletResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit test to test tagging Web Script API
|
* Unit test to test tagging Web Script API
|
||||||
@@ -140,19 +141,19 @@ public class TaggingServiceTest extends BaseWebScriptTest
|
|||||||
public void testGetTags()
|
public void testGetTags()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
MockHttpServletResponse response = getRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore", 200);
|
Response response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore"), 200);
|
||||||
JSONArray jsonArray = new JSONArray(response.getContentAsString());
|
JSONArray jsonArray = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(jsonArray);
|
assertNotNull(jsonArray);
|
||||||
//assertEquals(5, jsonArray.length());
|
//assertEquals(5, jsonArray.length());
|
||||||
|
|
||||||
response = getRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore?tf=one", 200);
|
response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore?tf=one"), 200);
|
||||||
jsonArray = new JSONArray(response.getContentAsString());
|
jsonArray = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(jsonArray);
|
assertNotNull(jsonArray);
|
||||||
assertEquals(1, jsonArray.length());
|
assertEquals(1, jsonArray.length());
|
||||||
|
|
||||||
response = getRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore?tf=none", 200);
|
response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore?tf=none"), 200);
|
||||||
jsonArray = new JSONArray(response.getContentAsString());
|
jsonArray = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(jsonArray);
|
assertNotNull(jsonArray);
|
||||||
@@ -162,7 +163,7 @@ public class TaggingServiceTest extends BaseWebScriptTest
|
|||||||
public void testGetNodes()
|
public void testGetNodes()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
MockHttpServletResponse response = getRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore/" + TAG_1 + "/nodes", 200);
|
Response response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore/" + TAG_1 + "/nodes"), 200);
|
||||||
JSONArray jsonArray = new JSONArray(response.getContentAsString());
|
JSONArray jsonArray = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(jsonArray);
|
assertNotNull(jsonArray);
|
||||||
@@ -170,13 +171,13 @@ public class TaggingServiceTest extends BaseWebScriptTest
|
|||||||
|
|
||||||
System.out.println(response.getContentAsString());
|
System.out.println(response.getContentAsString());
|
||||||
|
|
||||||
response = getRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore/" + TAG_2 + "/nodes", 200);
|
response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore/" + TAG_2 + "/nodes"), 200);
|
||||||
jsonArray = new JSONArray(response.getContentAsString());
|
jsonArray = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(jsonArray);
|
assertNotNull(jsonArray);
|
||||||
assertEquals(2, jsonArray.length());
|
assertEquals(2, jsonArray.length());
|
||||||
|
|
||||||
response = getRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore/jumk/nodes", 200);
|
response = sendRequest(new GetRequest("/api/tags/" + StoreRef.PROTOCOL_WORKSPACE + "/SpacesStore/jumk/nodes"), 200);
|
||||||
jsonArray = new JSONArray(response.getContentAsString());
|
jsonArray = new JSONArray(response.getContentAsString());
|
||||||
|
|
||||||
assertNotNull(jsonArray);
|
assertNotNull(jsonArray);
|
||||||
|
@@ -150,7 +150,7 @@ public class ThumbnailServiceTest extends BaseWebScriptTest
|
|||||||
if (this.contentService.getTransformer(MimetypeMap.MIMETYPE_PDF, MimetypeMap.MIMETYPE_FLASH) != null)
|
if (this.contentService.getTransformer(MimetypeMap.MIMETYPE_PDF, MimetypeMap.MIMETYPE_FLASH) != null)
|
||||||
{
|
{
|
||||||
String url = "/api/node/" + pdfNode.getStoreRef().getProtocol() + "/" + pdfNode.getStoreRef().getIdentifier() + "/" + pdfNode.getId() + "/content/thumbnaildefinitions";
|
String url = "/api/node/" + pdfNode.getStoreRef().getProtocol() + "/" + pdfNode.getStoreRef().getIdentifier() + "/" + pdfNode.getId() + "/content/thumbnaildefinitions";
|
||||||
MockHttpServletResponse response = this.getRequest(url, 200);
|
Response response = sendRequest(new GetRequest(url), 200);
|
||||||
|
|
||||||
JSONArray array = new JSONArray(response.getContentAsString());
|
JSONArray array = new JSONArray(response.getContentAsString());
|
||||||
assertNotNull(array);
|
assertNotNull(array);
|
||||||
@@ -173,7 +173,7 @@ public class ThumbnailServiceTest extends BaseWebScriptTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
String url = "/api/node/" + jpgNode.getStoreRef().getProtocol() + "/" + jpgNode.getStoreRef().getIdentifier() + "/" + jpgNode.getId() + "/content/thumbnaildefinitions";
|
String url = "/api/node/" + jpgNode.getStoreRef().getProtocol() + "/" + jpgNode.getStoreRef().getIdentifier() + "/" + jpgNode.getId() + "/content/thumbnaildefinitions";
|
||||||
MockHttpServletResponse response = this.getRequest(url, 200);
|
Response response = sendRequest(new GetRequest(url), 200);
|
||||||
|
|
||||||
JSONArray array = new JSONArray(response.getContentAsString());
|
JSONArray array = new JSONArray(response.getContentAsString());
|
||||||
assertNotNull(array);
|
assertNotNull(array);
|
||||||
|
Reference in New Issue
Block a user