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

129838 gjames: SEARCH-117: Implementing templates


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@130185 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gethin James
2016-09-06 14:19:35 +00:00
parent e6549ed9a0
commit 2b2bff2ef7
6 changed files with 99 additions and 4 deletions

View File

@@ -37,6 +37,7 @@ import org.alfresco.rest.api.search.impl.SearchMapper;
import org.alfresco.rest.api.search.model.Query;
import org.alfresco.rest.api.search.model.SearchQuery;
import org.alfresco.rest.api.search.model.SortDef;
import org.alfresco.rest.api.search.model.Template;
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
import org.alfresco.rest.framework.resource.parameters.Paging;
import org.alfresco.service.cmr.repository.StoreRef;
@@ -182,6 +183,21 @@ public class SearchMapperTests
});
}
@Test
public void fromTemplate() throws Exception
{
SearchParameters searchParameters = new SearchParameters();
//Doesn't error
searchMapper.fromTemplate(searchParameters, null);
searchMapper.fromTemplate(searchParameters, Arrays.asList(new Template("hedge", "hog"), new Template("king", "kong"), new Template("bish", "bash")));
assertEquals(3 ,searchParameters.getQueryTemplates().size());
assertEquals("hog" ,searchParameters.getQueryTemplates().get("hedge"));
assertEquals("kong" ,searchParameters.getQueryTemplates().get("king"));
assertEquals("bash" ,searchParameters.getQueryTemplates().get("bish"));
}
@Test
public void validateInclude() throws Exception
{
@@ -216,7 +232,7 @@ public class SearchMapperTests
private SearchQuery minimalQuery()
{
Query query = new Query("cmis", "foo", "");
SearchQuery sq = new SearchQuery(query,null, null, null);
SearchQuery sq = new SearchQuery(query,null, null, null, null);
return sq;
}
}