use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractAdLdapSimpleTest method test162SearchFirst2AccountsOffset0.
@Test
public void test162SearchFirst2AccountsOffset0() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = prismContext.queryFactory().createPaging();
paging.setOffset(0);
paging.setMaxSize(2);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(query, 2, task, result);
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 1);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorReasonableInstances();
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractAdLdapSimpleTest method test154SearchFirst11Accounts.
/**
* Blocksize is 5, so this gets more than two blocks.
*/
@Test
public void test154SearchFirst11Accounts() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = prismContext.queryFactory().createPaging();
paging.setMaxSize(11);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(query, 11, task, result);
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 1);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorReasonableInstances();
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractAdLdapSimpleTest method test172Search2AccountsOffset1.
/**
* Blocksize is 5, so this is in one block.
* There is offset, so VLV should be used.
* No explicit sorting.
*/
@Test
public void test172Search2AccountsOffset1() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = prismContext.queryFactory().createPaging(1, 2);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(query, 2, task, result);
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 1);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorReasonableInstances();
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractAdLdapSimpleTest method test182Search2AccountsOffset1SortCn.
/**
* Blocksize is 5, so this is in one block.
* There is offset, so VLV should be used.
* Explicit sorting.
*/
@Test
public void test182Search2AccountsOffset1SortCn() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = prismContext.queryFactory().createPaging(1, 2);
paging.setOrdering(getAttributePath(resource, "cn"), OrderDirection.ASCENDING);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> shadows = doSearch(query, 2, task, result);
// assertAccountShadow(shadows.get(0), "CN=Administrator,CN=Users,DC=win,DC=evolveum,DC=com");
// assertAccountShadow(shadows.get(1), "CN=Chuck LeChuck,CN=Users,DC=win,DC=evolveum,DC=com");
assertAccountShadow(shadows.get(0), "CN=Chuck LeChuck,CN=Users,DC=win,DC=evolveum,DC=com");
assertAccountShadow(shadows.get(1), "CN=Guest,CN=Users,DC=win,DC=evolveum,DC=com");
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 1);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorReasonableInstances();
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractAdLdapSimpleTest method test174SearchFirst11AccountsOffset2.
/**
* Blocksize is 5, so this gets more than two blocks.
* There is offset, so VLV should be used.
* No explicit sorting.
*/
@Test
public void test174SearchFirst11AccountsOffset2() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = prismContext.queryFactory().createPaging(2, 11);
query.setPaging(paging);
allowDuplicateSearchResults = true;
// WHEN
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(query, 11, task, result);
// THEN
allowDuplicateSearchResults = false;
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 1);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorReasonableInstances();
}
Aggregations