Search in sources :

Example 56 with SearchResultMetadata

use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.

the class AbstractAdLdapTest method test162SeachFirst2AccountsOffset0.

@Test
public void test162SeachFirst2AccountsOffset0() throws Exception {
    final String TEST_NAME = "test162SeachFirst2AccountsOffset0";
    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.setOffset(0);
    paging.setMaxSize(2);
    query.setPaging(paging);
    SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 2, task, result);
    assertConnectorOperationIncrement(1);
    assertConnectorSimulatedPagingSearchIncrement(0);
    SearchResultMetadata metadata = searchResultList.getMetadata();
    if (metadata != null) {
        assertFalse(metadata.isPartialResults());
    }
    assertLdapConnectorInstances(2);
}
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) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest)

Example 57 with SearchResultMetadata

use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.

the class AbstractAdLdapTest method test105SeachPiratesByCn.

@Test
public void test105SeachPiratesByCn() throws Exception {
    final String TEST_NAME = "test105SeachPiratesByCn";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getGroupObjectClass(), prismContext);
    ObjectQueryUtil.filterAnd(query.getFilter(), createAttributeFilter("cn", GROUP_PIRATES_NAME));
    rememberConnectorOperationCount();
    rememberConnectorSimulatedPagingSearchCount();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    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);
    groupPiratesOid = shadow.getOid();
    assertConnectorOperationIncrement(1);
    assertConnectorSimulatedPagingSearchIncrement(0);
    SearchResultMetadata metadata = shadows.getMetadata();
    if (metadata != null) {
        assertFalse(metadata.isPartialResults());
    }
    assertLdapConnectorInstances(1);
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) 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) AbstractIntegrationTest(com.evolveum.midpoint.test.AbstractIntegrationTest)

Example 58 with SearchResultMetadata

use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.

the class AbstractEDirTest method test105SeachPiratesByCn.

@Test
public void test105SeachPiratesByCn() throws Exception {
    final String TEST_NAME = "test105SeachPiratesByCn";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getGroupObjectClass(), prismContext);
    ObjectQueryUtil.filterAnd(query.getFilter(), createAttributeFilter("cn", GROUP_PIRATES_NAME));
    rememberConnectorOperationCount();
    rememberConnectorSimulatedPagingSearchCount();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    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);
    groupPiratesOid = shadow.getOid();
    assertConnectorOperationIncrement(2);
    assertConnectorSimulatedPagingSearchIncrement(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) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) 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 59 with SearchResultMetadata

use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.

the class AbstractEDirTest method test100SeachJackByLdapUid.

@Test
public void test100SeachJackByLdapUid() throws Exception {
    final String TEST_NAME = "test100SeachJackByLdapUid";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ObjectQuery query = createUidQuery(ACCOUNT_JACK_UID);
    rememberConnectorOperationCount();
    rememberConnectorSimulatedPagingSearchCount();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    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);
    assertConnectorOperationIncrement(2);
    assertConnectorSimulatedPagingSearchIncrement(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) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) 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 60 with SearchResultMetadata

use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.

the class AbstractEDirTest method test150SeachAllAccounts.

/**
	 * No paging. It should return all accounts.
	 */
@Test
public void test150SeachAllAccounts() throws Exception {
    final String TEST_NAME = "test150SeachAllAccounts";
    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);
    SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, NUMBER_OF_ACCOUNTS, task, result);
    assertConnectorOperationIncrement(1);
    assertConnectorSimulatedPagingSearchIncrement(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)

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