Search in sources :

Example 76 with SearchResultMetadata

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();
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) ObjectPaging(com.evolveum.midpoint.prism.query.ObjectPaging) 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 77 with SearchResultMetadata

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();
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) ObjectPaging(com.evolveum.midpoint.prism.query.ObjectPaging) 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 78 with SearchResultMetadata

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();
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) ObjectPaging(com.evolveum.midpoint.prism.query.ObjectPaging) 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 79 with SearchResultMetadata

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());
    }
}
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 80 with SearchResultMetadata

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();
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) ObjectPaging(com.evolveum.midpoint.prism.query.ObjectPaging) 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)

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