Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)

122276 gjames: Improving the test coverage of webscriptGet


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126464 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 11:04:04 +00:00
parent f7f489f349
commit 52ef5d5374

View File

@@ -21,6 +21,7 @@ package org.alfresco.rest.framework.tests.core;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
@@ -450,8 +451,46 @@ public class SerializeTests
}});
}
@Test
public void testInvokeEntities() throws IOException
{
ResourceWithMetadata entityResource = locator.locateEntityResource(api,"sheep", HttpMethod.GET);
AbstractResourceWebScript executor = (AbstractResourceWebScript) applicationContext.getBean("executorOfGets");
executor.execute(entityResource, Params.valueOf((String)null, null), new ExecutionCallback<CollectionWithPagingInfo>(){
@Override
public void onSuccess(CollectionWithPagingInfo result, ContentInfo contentInfo)
{
assertNotNull(result);
}});
ResourceWithMetadata baa = locator.locateRelationResource(api,"sheep", "baaahh", HttpMethod.GET);
executor = (AbstractResourceWebScript) applicationContext.getBean("executorOfGets");
executor.execute(baa, Params.valueOf("4", null), new ExecutionCallback<CollectionWithPagingInfo>(){
@Override
public void onSuccess(CollectionWithPagingInfo result, ContentInfo contentInfo)
{
assertNotNull(result);
}});
executor.execute(baa, Params.valueOf("4", "45"), new ExecutionCallback<ExecutionResult>(){
@Override
public void onSuccess(ExecutionResult result, ContentInfo contentInfo)
{
assertNotNull(result);
}});
ResourceWithMetadata baaPhoto = locator.locateRelationResource(api,"sheep/{entityId}/baaahh", "photo", HttpMethod.GET);
executor.execute(baaPhoto, Params.valueOf("4", "45"), new ExecutionCallback<ExecutionResult>(){
@Override
public void onSuccess(ExecutionResult result, ContentInfo contentInfo)
{
assertNull(result);
}});
}
@Test
public void testInvokeVersions() throws IOException
{
final Map<String, Object> respons = new HashMap<String, Object>();