use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractAdLdapSimpleTest method test150SearchAllAccounts.
/**
* No paging. It should return all accounts.
*/
@Test
public void test150SearchAllAccounts() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
rememberCounter(InternalCounters.CONNECTOR_OPERATION_COUNT);
rememberCounter(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT);
// WHEN
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(query, NUMBER_OF_ACCOUNTS, task, result);
// TODO: why 11? should be 1
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 9);
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 test100SearchJackByLdapUid.
@Test
public void test100SearchJackByLdapUid() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = createUidQuery(ACCOUNT_JACK_UID);
rememberCounter(InternalCounters.CONNECTOR_OPERATION_COUNT);
rememberCounter(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT);
// WHEN
when();
SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Unexpected search result: " + shadows, 1, shadows.size());
PrismObject<ShadowType> shadow = shadows.get(0);
display("Shadow", shadow);
assertAccountShadow(shadow, toAccountDn(ACCOUNT_JACK_UID));
assertShadowLockout(shadow, LockoutStatusType.NORMAL);
jackAccountOid = shadow.getOid();
assertNotNull("Null OID in " + shadow, jackAccountOid);
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 2);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractEDirTest method test150SearchAllAccounts.
/**
* No paging. It should return all accounts.
*/
@Test
public void test150SearchAllAccounts() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getAccountObjectClass(), prismContext);
SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(query, NUMBER_OF_ACCOUNTS, 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());
}
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractEDirTest method test800JackLockoutExpires.
// Wait until the lockout of Jack expires, check status
@Test
public void test800JackLockoutExpires() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
long now = System.currentTimeMillis();
long lockoutExpires = jackLockoutTimestamp + LOCKOUT_EXPIRATION_SECONDS * 1000;
if (now < lockoutExpires) {
display("Sleeping for " + (lockoutExpires - now) + "ms (waiting for lockout expiration)");
Thread.sleep(lockoutExpires - now);
}
now = System.currentTimeMillis();
display("Time is now " + now);
ObjectQuery query = createUidQuery(ACCOUNT_JACK_UID);
rememberCounter(InternalCounters.CONNECTOR_OPERATION_COUNT);
rememberCounter(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT);
// WHEN
when();
SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
then();
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Unexpected search result: " + shadows, 1, shadows.size());
PrismObject<ShadowType> shadow = shadows.get(0);
display("Shadow", shadow);
assertAccountShadow(shadow, toAccountDn(ACCOUNT_JACK_UID));
assertShadowLockout(shadow, LockoutStatusType.NORMAL);
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 1);
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
}
Aggregations