From 52ef5d537484aaeeb692516dde2bdc8898ac1efa Mon Sep 17 00:00:00 2001 From: Jamal Kaabi-Mofrad Date: Tue, 10 May 2016 11:04:04 +0000 Subject: [PATCH] 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 --- .../framework/tests/core/SerializeTests.java | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/source/test-java/org/alfresco/rest/framework/tests/core/SerializeTests.java b/source/test-java/org/alfresco/rest/framework/tests/core/SerializeTests.java index 366c1d738f..74875af92b 100644 --- a/source/test-java/org/alfresco/rest/framework/tests/core/SerializeTests.java +++ b/source/test-java/org/alfresco/rest/framework/tests/core/SerializeTests.java @@ -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(){ + @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(){ + @Override + public void onSuccess(CollectionWithPagingInfo result, ContentInfo contentInfo) + { + assertNotNull(result); + }}); + + executor.execute(baa, Params.valueOf("4", "45"), new ExecutionCallback(){ + @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(){ + @Override + public void onSuccess(ExecutionResult result, ContentInfo contentInfo) + { + assertNull(result); + }}); + + } + + @Test public void testInvokeVersions() throws IOException { final Map respons = new HashMap();