Search in sources :

Example 71 with ObjectQuery

use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.

the class AbstractAdLdapTest method test182Search2AccountsOffset1SortCn.

/**
	 * Blocksize is 5, so this is in one block.
	 * There is offset, so VLV should be used.
	 * Explicit sorting.
	 */
@Test
public void test182Search2AccountsOffset1SortCn() throws Exception {
    final String TEST_NAME = "test182Search2AccountsOffset1SortCn";
    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.createPaging(1, 2);
    paging.setOrdering(getAttributePath(resource, "cn"), OrderDirection.ASCENDING);
    query.setPaging(paging);
    SearchResultList<PrismObject<ShadowType>> shadows = doSearch(TEST_NAME, query, 2, task, result);
    assertAccountShadow(shadows.get(0), "CN=a5vg a5vg,CN=Users,DC=win,DC=evolveum,DC=com");
    assertAccountShadow(shadows.get(1), "CN=Adalbert Meduza,OU=evolveum,DC=win,DC=evolveum,DC=com");
    //        assertAccountShadow(shadows.get(0), "CN=Adalbert Meduza,OU=evolveum,DC=win,DC=evolveum,DC=com");
    //        assertAccountShadow(shadows.get(1), "CN=Adalbert Meduza1,OU=evolveum,DC=win,DC=evolveum,DC=com");
    assertConnectorOperationIncrement(1);
    assertConnectorSimulatedPagingSearchIncrement(0);
    SearchResultMetadata metadata = shadows.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 72 with ObjectQuery

use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.

the class AbstractLdapConnTest method test154SeachFirst222Accounts.

/**
	 * Blocksize is 100, so this gets more than two blocks.
	 */
@Test
public void test154SeachFirst222Accounts() throws Exception {
    final String TEST_NAME = "test154SeachFirst222Accounts";
    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.setMaxSize(222);
    query.setPaging(paging);
    SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 222, task, result);
    assertConnectorOperationIncrement(1, 223);
    assertConnectorSimulatedPagingSearchIncrement(0);
    SearchResultMetadata metadata = searchResultList.getMetadata();
    if (metadata != null) {
        assertFalse(metadata.isPartialResults());
    }
    assertLdapConnectorInstances(1, 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)

Example 73 with ObjectQuery

use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.

the class AbstractLdapConnTest method test190SeachAllAccountsSizelimit.

/**
	 * No paging. Allow incomplete results. This should violate sizelimit, but some results should
	 * be returned anyway.
	 */
@Test
public void test190SeachAllAccountsSizelimit() throws Exception {
    final String TEST_NAME = "test190SeachAllAccountsSizelimit";
    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);
    query.setAllowPartialResults(true);
    SearchResultList<PrismObject<ShadowType>> resultList = doSearch(TEST_NAME, query, getSearchSizeLimit(), task, result);
    assertConnectorOperationIncrement(1, getSearchSizeLimit() + 1);
    assertConnectorSimulatedPagingSearchIncrement(0);
    SearchResultMetadata metadata = resultList.getMetadata();
    assertNotNull("No search metadata", metadata);
    assertTrue("Partial results not indicated", metadata.isPartialResults());
    assertLdapConnectorInstances(1, 2);
}
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 74 with ObjectQuery

use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.

the class AbstractEDirTest method test810SeachLockedAccounts.

@Test
public void test810SeachLockedAccounts() throws Exception {
    final String TEST_NAME = "test810SeachLockedAccounts";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassFilterPrefix(getResourceOid(), getAccountObjectClass(), prismContext).and().item(ShadowType.F_ACTIVATION, ActivationType.F_LOCKOUT_STATUS).eq(LockoutStatusType.LOCKED).build();
    SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 0, task, result);
    assertConnectorOperationIncrement(1);
    assertConnectorSimulatedPagingSearchIncrement(0);
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Example 75 with ObjectQuery

use of com.evolveum.midpoint.prism.query.ObjectQuery in project midpoint by Evolveum.

the class AbstractEDirTest method test190SeachLockedAccounts.

@Test
public void test190SeachLockedAccounts() throws Exception {
    final String TEST_NAME = "test190SeachLockedAccounts";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassFilterPrefix(getResourceOid(), getAccountObjectClass(), prismContext).and().item(ShadowType.F_ACTIVATION, ActivationType.F_LOCKOUT_STATUS).eq(LockoutStatusType.LOCKED).build();
    SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 1, task, result);
    assertConnectorOperationIncrement(1);
    assertConnectorSimulatedPagingSearchIncrement(0);
    PrismObject<ShadowType> shadow = searchResultList.get(0);
    display("Shadow", shadow);
    assertAccountShadow(shadow, toAccountDn(ACCOUNT_JACK_UID));
    assertShadowLockout(shadow, LockoutStatusType.LOCKED);
    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) 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)

Aggregations

ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)697 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)453 Test (org.testng.annotations.Test)335 PrismObject (com.evolveum.midpoint.prism.PrismObject)284 Task (com.evolveum.midpoint.task.api.Task)268 QName (javax.xml.namespace.QName)111 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)78 SearchResultMetadata (com.evolveum.midpoint.schema.SearchResultMetadata)76 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)64 ArrayList (java.util.ArrayList)61 ObjectPaging (com.evolveum.midpoint.prism.query.ObjectPaging)58 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)53 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)41 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)41 SystemException (com.evolveum.midpoint.util.exception.SystemException)38 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)37 NotNull (org.jetbrains.annotations.NotNull)35 List (java.util.List)33 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)32 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)27