use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class AbstractAdLdapTest 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 {
final String TEST_NAME = "test182Search2AccountsOffset1SortCn";
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(1, 2);
paging.setOrdering(getAttributePath(resource, "cn"), OrderDirection.ASCENDING);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> shadows = doSearch(TEST_NAME, query, 2, task, result);
assertAccountShadow(shadows.get(0), "CN=a5vg a5vg,CN=Users,DC=win,DC=evolveum,DC=com");
assertAccountShadow(shadows.get(1), "CN=Adalbert Meduza,OU=evolveum,DC=win,DC=evolveum,DC=com");
// assertAccountShadow(shadows.get(0), "CN=Adalbert Meduza,OU=evolveum,DC=win,DC=evolveum,DC=com");
// assertAccountShadow(shadows.get(1), "CN=Adalbert Meduza1,OU=evolveum,DC=win,DC=evolveum,DC=com");
assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorInstances(2);
}
use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class AbstractLdapConnTest method test154SeachFirst222Accounts.
/**
* Blocksize is 100, so this gets more than two blocks.
*/
@Test
public void test154SeachFirst222Accounts() throws Exception {
final String TEST_NAME = "test154SeachFirst222Accounts";
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(222);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 222, task, result);
assertConnectorOperationIncrement(1, 223);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorInstances(1, 2);
}
use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class AbstractLdapConnTest method test190SeachAllAccountsSizelimit.
/**
* No paging. Allow incomplete results. This should violate sizelimit, but some results should
* be returned anyway.
*/
@Test
public void test190SeachAllAccountsSizelimit() throws Exception {
final String TEST_NAME = "test190SeachAllAccountsSizelimit";
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);
query.setAllowPartialResults(true);
SearchResultList<PrismObject<ShadowType>> resultList = doSearch(TEST_NAME, query, getSearchSizeLimit(), task, result);
assertConnectorOperationIncrement(1, getSearchSizeLimit() + 1);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = resultList.getMetadata();
assertNotNull("No search metadata", metadata);
assertTrue("Partial results not indicated", metadata.isPartialResults());
assertLdapConnectorInstances(1, 2);
}
use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class AbstractEDirTest method test810SeachLockedAccounts.
@Test
public void test810SeachLockedAccounts() throws Exception {
final String TEST_NAME = "test810SeachLockedAccounts";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassFilterPrefix(getResourceOid(), getAccountObjectClass(), prismContext).and().item(ShadowType.F_ACTIVATION, ActivationType.F_LOCKOUT_STATUS).eq(LockoutStatusType.LOCKED).build();
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 0, task, result);
assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
}
use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.
the class AbstractEDirTest method test190SeachLockedAccounts.
@Test
public void test190SeachLockedAccounts() throws Exception {
final String TEST_NAME = "test190SeachLockedAccounts";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassFilterPrefix(getResourceOid(), getAccountObjectClass(), prismContext).and().item(ShadowType.F_ACTIVATION, ActivationType.F_LOCKOUT_STATUS).eq(LockoutStatusType.LOCKED).build();
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 1, task, result);
assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
PrismObject<ShadowType> shadow = searchResultList.get(0);
display("Shadow", shadow);
assertAccountShadow(shadow, toAccountDn(ACCOUNT_JACK_UID));
assertShadowLockout(shadow, LockoutStatusType.LOCKED);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
}
Aggregations