use of com.evolveum.midpoint.prism.query.ObjectPaging in project midpoint by Evolveum.
the class AbstractLdapConnTest method test158SeachBeyondEnd.
/**
* Make a search that goes beyond the end of the list of all accounts.
*/
@Test
public void test158SeachBeyondEnd() throws Exception {
final String TEST_NAME = "test158SeachBeyondEnd";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = ObjectPaging.createEmptyPaging();
paging.setOffset(getNumberOfAllAccounts() + 50);
paging.setMaxSize(123);
query.setPaging(paging);
int expectedEntries = 0;
if (isVlvSearchBeyondEndResurnsLastEntry()) {
expectedEntries = 1;
}
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, expectedEntries, task, result);
// Fails for 389ds tests. For some unknown reason. And this is not that important. There are similar asserts in other tests that are passing.
// assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorInstances(1, 2);
}
use of com.evolveum.midpoint.prism.query.ObjectPaging in project midpoint by Evolveum.
the class AbstractLdapConnTest method test152SeachFirst50Accounts.
/**
* Blocksize is 100, so this is in one block.
*/
@Test
public void test152SeachFirst50Accounts() throws Exception {
final String TEST_NAME = "test152SeachFirst50Accounts";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = ObjectPaging.createEmptyPaging();
paging.setMaxSize(50);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 50, task, result);
assertConnectorOperationIncrement(1, 51);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorInstances(1, 2);
}
use of com.evolveum.midpoint.prism.query.ObjectPaging in project midpoint by Evolveum.
the class AbstractLdapConnTest method test156SeachThroughEnd.
/**
* Make a search that starts in the list of all accounts but goes beyond the end.
*/
@Test
public void test156SeachThroughEnd() throws Exception {
final String TEST_NAME = "test156SeachBeyondEnd";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = ObjectPaging.createEmptyPaging();
paging.setOffset(getNumberOfAllAccounts() - 150);
paging.setMaxSize(333);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 150, task, result);
assertConnectorOperationIncrement(1, 151);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorInstances(1, 2);
}
use of com.evolveum.midpoint.prism.query.ObjectPaging in project midpoint by Evolveum.
the class AbstractAdLdapTest method test162SeachFirst2AccountsOffset0.
@Test
public void test162SeachFirst2AccountsOffset0() throws Exception {
final String TEST_NAME = "test162SeachFirst2AccountsOffset0";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = ObjectPaging.createEmptyPaging();
paging.setOffset(0);
paging.setMaxSize(2);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 2, task, result);
assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorInstances(2);
}
use of com.evolveum.midpoint.prism.query.ObjectPaging in project midpoint by Evolveum.
the class AbstractAdLdapTest method test174SeachFirst11AccountsOffset2.
/**
* Blocksize is 5, so this gets more than two blocks.
* There is offset, so VLV should be used.
* No explicit sorting.
*/
@Test
public void test174SeachFirst11AccountsOffset2() throws Exception {
final String TEST_NAME = "test174SeachFirst11AccountsOffset2";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = ObjectPaging.createPaging(2, 11);
query.setPaging(paging);
allowDuplicateSearchResults = true;
// WHEN
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 11, task, result);
// THEN
allowDuplicateSearchResults = false;
assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorInstances(2);
}
Aggregations