Search in sources :

Example 1 with Limits

use of org.alfresco.rest.api.search.model.Limits in project alfresco-remote-api by Alfresco.

the class SearchMapperTests method fromLimits.

@Test
public void fromLimits() throws Exception {
    SearchParameters searchParameters = new SearchParameters();
    searchMapper.setDefaults(searchParameters);
    // Doesn't error
    searchMapper.fromLimits(searchParameters, null);
    assertEquals(500, searchParameters.getLimit());
    assertEquals(LimitBy.UNLIMITED, searchParameters.getLimitBy());
    searchMapper.fromLimits(searchParameters, new Limits(null, null));
    assertEquals(LimitBy.UNLIMITED, searchParameters.getLimitBy());
    assertEquals(500, searchParameters.getLimit());
    searchMapper.fromLimits(searchParameters, new Limits(null, 34));
    assertEquals(LimitBy.NUMBER_OF_PERMISSION_EVALUATIONS, searchParameters.getLimitBy());
    assertEquals(34, searchParameters.getMaxPermissionChecks());
    assertEquals(-1, searchParameters.getLimit());
    assertEquals(-1, searchParameters.getMaxPermissionCheckTimeMillis());
    searchParameters = new SearchParameters();
    searchMapper.setDefaults(searchParameters);
    searchMapper.fromLimits(searchParameters, new Limits(1000, null));
    assertEquals(LimitBy.NUMBER_OF_PERMISSION_EVALUATIONS, searchParameters.getLimitBy());
    assertEquals(1000, searchParameters.getMaxPermissionCheckTimeMillis());
    assertEquals(-1, searchParameters.getLimit());
    assertEquals(-1, searchParameters.getMaxPermissionChecks());
}
Also used : SearchParameters(org.alfresco.service.cmr.search.SearchParameters) Limits(org.alfresco.rest.api.search.model.Limits) Test(org.junit.Test)

Aggregations

Limits (org.alfresco.rest.api.search.model.Limits)1 SearchParameters (org.alfresco.service.cmr.search.SearchParameters)1 Test (org.junit.Test)1