use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractLdapConnTest method test162SearchFirst50AccountsOffset0.
@Test
public void test162SearchFirst50AccountsOffset0() 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(50);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(query, 50, task, result);
assertConnectorOperationIncrement(1, 51);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
// VLV search. We should know the estimate
assertApproxNumberOfAllResults(metadata, getNumberOfAllAccounts());
assertLdapConnectorReasonableInstances();
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractLdapConnTest method test172Search50AccountsOffset20.
/**
* Blocksize is 100, so this is in one block.
* There is offset, so VLV should be used.
* No explicit sorting.
*/
@Test
public void test172Search50AccountsOffset20() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = prismContext.queryFactory().createPaging(20, 50);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(query, 50, task, result);
assertConnectorOperationIncrement(1, 51);
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 AbstractLdapConnTest method test174SearchFirst222AccountsOffset20.
/**
* Blocksize is 100, so this gets more than two blocks.
* There is offset, so VLV should be used.
* No explicit sorting.
*/
@Test
public void test174SearchFirst222AccountsOffset20() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
ObjectPaging paging = prismContext.queryFactory().createPaging(20, 222);
query.setPaging(paging);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(query, 222, task, result);
assertConnectorOperationIncrement(1, 223);
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 AbstractEDirTest method test820JackLockoutAndUnlock.
@Test
public void test820JackLockoutAndUnlock() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
makeBadLoginAttempt(ACCOUNT_JACK_UID);
makeBadLoginAttempt(ACCOUNT_JACK_UID);
makeBadLoginAttempt(ACCOUNT_JACK_UID);
makeBadLoginAttempt(ACCOUNT_JACK_UID);
jackLockoutTimestamp = System.currentTimeMillis();
ObjectQuery query = createUidQuery(ACCOUNT_JACK_UID);
// precondition
SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Unexpected search result: " + shadows, 1, shadows.size());
PrismObject<ShadowType> shadowLocked = shadows.get(0);
display("Locked shadow", shadowLocked);
assertAccountShadow(shadowLocked, toAccountDn(ACCOUNT_JACK_UID));
assertShadowLockout(shadowLocked, LockoutStatusType.LOCKED);
rememberCounter(InternalCounters.CONNECTOR_OPERATION_COUNT);
rememberCounter(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT);
// WHEN
when();
modifyObjectReplaceProperty(ShadowType.class, shadowLocked.getOid(), PATH_ACTIVATION_LOCKOUT_STATUS, task, result, LockoutStatusType.NORMAL);
// THEN
then();
result.computeStatus();
TestUtil.assertSuccess(result);
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 1);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
PrismObject<ShadowType> shadowAfter = getObject(ShadowType.class, shadowLocked.getOid());
display("Shadow after", shadowAfter);
assertAccountShadow(shadowAfter, toAccountDn(ACCOUNT_JACK_UID));
assertShadowLockout(shadowAfter, LockoutStatusType.NORMAL);
assertLdapPassword(ACCOUNT_JACK_UID, ACCOUNT_JACK_PASSWORD);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractAdLdapMultidomainTest 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);
// TODO: Why 2? Why not 1?
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 2);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
SearchResultMetadata metadata = searchResultList.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorReasonableInstances();
}
Aggregations