Search in sources :

Example 81 with SearchResultMetadata

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();
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) SearchResultMetadata(com.evolveum.midpoint.schema.SearchResultMetadata) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test) AbstractAdLdapTest(com.evolveum.midpoint.testing.conntest.ad.AbstractAdLdapTest) AbstractLdapSynchronizationTest(com.evolveum.midpoint.testing.conntest.AbstractLdapSynchronizationTest)

Example 82 with SearchResultMetadata

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());
    }
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) SearchResultMetadata(com.evolveum.midpoint.schema.SearchResultMetadata) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Example 83 with SearchResultMetadata

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());
    }
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) SearchResultMetadata(com.evolveum.midpoint.schema.SearchResultMetadata) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Example 84 with SearchResultMetadata

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());
    }
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) SearchResultMetadata(com.evolveum.midpoint.schema.SearchResultMetadata) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Aggregations

SearchResultMetadata (com.evolveum.midpoint.schema.SearchResultMetadata)84 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)83 Test (org.testng.annotations.Test)80 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)76 PrismObject (com.evolveum.midpoint.prism.PrismObject)70 Task (com.evolveum.midpoint.task.api.Task)67 ObjectPaging (com.evolveum.midpoint.prism.query.ObjectPaging)35 AbstractAdLdapTest (com.evolveum.midpoint.testing.conntest.ad.AbstractAdLdapTest)19 SqaleRepoBaseTest (com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)13 SqlPerformanceMonitorImpl (com.evolveum.midpoint.repo.sqlbase.perfmon.SqlPerformanceMonitorImpl)13 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)11 AbstractIntegrationTest (com.evolveum.midpoint.test.AbstractIntegrationTest)9 AbstractLdapSynchronizationTest (com.evolveum.midpoint.testing.conntest.AbstractLdapSynchronizationTest)8 QUser (com.evolveum.midpoint.repo.sqale.qmodel.focus.QUser)5 JdbcSession (com.evolveum.midpoint.repo.sqlbase.JdbcSession)3 ResultHandler (com.evolveum.midpoint.schema.ResultHandler)3 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3