Merged searchapi (5.2.1) to 5.2.N (5.2.1)

129821 gjames: SEARCH-150: Implementing include in the JSON body


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@130181 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gethin James
2016-09-06 14:19:08 +00:00
parent c2953c739c
commit d1d0c6436b
4 changed files with 81 additions and 5 deletions

View File

@@ -37,11 +37,12 @@ import org.alfresco.rest.api.search.model.Query;
import org.alfresco.rest.api.search.model.SearchQuery;
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
import org.alfresco.rest.framework.resource.parameters.Paging;
import org.alfresco.rest.framework.resource.parameters.Params;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.SearchParameters;
import org.junit.Test;
import java.util.Arrays;
/**
* Tests the SearchMapper class
*
@@ -136,10 +137,41 @@ public class SearchMapperTests
assertEquals(searchParameters.getSkipCount(),paging.getSkipCount());
}
@Test
public void validateInclude() throws Exception
{
try
{
searchMapper.validateInclude(Arrays.asList("sausage"));
fail();
}
catch (InvalidArgumentException iae)
{
//Sausage is illegal
assertNotNull(iae);
}
searchMapper.validateInclude(null);
try
{
searchMapper.validateInclude(Arrays.asList("AspectNames"));
fail();
}
catch (InvalidArgumentException iae)
{
//Case sensitive
assertNotNull(iae);
}
searchMapper.validateInclude(Arrays.asList("properties", "aspectNames"));
}
private SearchQuery minimalQuery()
{
Query query = new Query("cmis", "foo", "");
SearchQuery sq = new SearchQuery(query,null);
SearchQuery sq = new SearchQuery(query,null, null);
return sq;
}
}