mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126490 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 122636 gjames: RA-211: Adding the ResponseCallBack to the Multipart actions git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126834 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -30,6 +30,7 @@ import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.rest.framework.webscripts.ResponseCallBack;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.servlet.FormData;
|
||||
|
||||
@@ -43,7 +44,7 @@ public class MultiPartTestEntityResource
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title = "Creates a multipart", successStatus = Status.STATUS_ACCEPTED)
|
||||
public MultiPartTestResponse create(FormData formData, Parameters parameters)
|
||||
public MultiPartTestResponse create(FormData formData, Parameters parameters, ResponseCallBack withResponse)
|
||||
{
|
||||
return new MultiPartTestResponse(formData.getParameters().get("filename")[0]);
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ package org.alfresco.rest.framework.tests.api.mocks;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.rest.framework.webscripts.ResponseCallBack;
|
||||
import org.springframework.extensions.webscripts.servlet.FormData;
|
||||
|
||||
/**
|
||||
@@ -41,7 +42,7 @@ public class MultiPartTestRelationshipResource
|
||||
|
||||
@Override
|
||||
public MultiPartTestResponse create(String entityResourceId, FormData formData,
|
||||
Parameters parameters)
|
||||
Parameters parameters, ResponseCallBack withResponse)
|
||||
{
|
||||
return new MultiPartTestResponse(formData.getParameters().get("filename")[0]);
|
||||
}
|
||||
|
@@ -14,7 +14,9 @@ import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.parameters.Params;
|
||||
import org.alfresco.rest.framework.webscripts.AbstractResourceWebScript;
|
||||
import org.alfresco.rest.framework.webscripts.ApiWebScript;
|
||||
import org.alfresco.rest.framework.webscripts.ResourceWebScriptHelper;
|
||||
import org.alfresco.rest.framework.webscripts.ResponseCallBack;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -22,6 +24,7 @@ import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -49,6 +52,7 @@ public abstract class AbstractContextTest
|
||||
|
||||
static Params NOT_USED = Params.valueOf("notUsed", null, mock(WebScriptRequest.class));
|
||||
static final Params.RecognizedParams NULL_PARAMS = new Params.RecognizedParams(null, null, null, null, null, null, null, false);
|
||||
static final ResponseCallBack callBack = new ResponseCallBack(Status.STATUS_OK, ApiWebScript.DEFAULT_JSON_CONTENT,ApiWebScript.CACHE_NEVER);
|
||||
static Api api = Api.valueOf("alfrescomock", "private", "1");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@@ -153,7 +153,7 @@ public class SerializeTests extends AbstractContextTest
|
||||
mockRequest.setContent(reqBody.getBody());
|
||||
mockRequest.setContentType(reqBody.getContentType());
|
||||
|
||||
String out = writeResponse(helper.processAdditionsToTheResponse(mock(WebScriptResponse.class), api,null, NOT_USED, resource.create(new FormData(mockRequest), NOT_USED)));
|
||||
String out = writeResponse(helper.processAdditionsToTheResponse(mock(WebScriptResponse.class), api,null, NOT_USED, resource.create(new FormData(mockRequest), NOT_USED, callBack)));
|
||||
assertTrue("There must be json output", StringUtils.startsWith(out, "{\"entry\":"));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user