Search in sources :

Example 11 with SearchResultMetadata

use of com.evolveum.midpoint.schema.SearchResultMetadata 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 12 with SearchResultMetadata

use of com.evolveum.midpoint.schema.SearchResultMetadata 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 13 with SearchResultMetadata

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

the class AbstractLdapConnTest method test182Search50AccountsOffset20SortUid.

/**
	 * Blocksize is 100, so this is in one block.
	 * There is offset, so VLV should be used.
	 * Explicit sorting.
	 */
@Test
public void test182Search50AccountsOffset20SortUid() throws Exception {
    final String TEST_NAME = "test182Search50AccountsOffset20SortUid";
    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(20, 50);
    paging.setOrdering(getAttributePath(resource, "uid"), OrderDirection.ASCENDING);
    query.setPaging(paging);
    SearchResultList<PrismObject<ShadowType>> shadows = doSearch(TEST_NAME, query, 50, task, result);
    assertAccountShadow(shadows.get(0), toAccountDn(isIdmAdminInteOrgPerson() ? ACCOUNT_19_UID : ACCOUNT_20_UID));
    assertAccountShadow(shadows.get(49), toAccountDn(isIdmAdminInteOrgPerson() ? ACCOUNT_68_UID : ACCOUNT_69_UID));
    assertConnectorOperationIncrement(1, 51);
    assertConnectorSimulatedPagingSearchIncrement(0);
    SearchResultMetadata metadata = shadows.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 14 with SearchResultMetadata

use of com.evolveum.midpoint.schema.SearchResultMetadata 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 15 with SearchResultMetadata

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

the class AbstractEDirTest method test120JackLockout.

@Test
public void test120JackLockout() throws Exception {
    final String TEST_NAME = "test120JackLockout";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
    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);
    rememberConnectorOperationCount();
    rememberConnectorSimulatedPagingSearchCount();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    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.LOCKED);
    assertConnectorOperationIncrement(1);
    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)

Aggregations

SearchResultMetadata (com.evolveum.midpoint.schema.SearchResultMetadata)39 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)39 PrismObject (com.evolveum.midpoint.prism.PrismObject)37 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)37 Task (com.evolveum.midpoint.task.api.Task)36 Test (org.testng.annotations.Test)34 ObjectPaging (com.evolveum.midpoint.prism.query.ObjectPaging)19 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)16 AbstractIntegrationTest (com.evolveum.midpoint.test.AbstractIntegrationTest)9 QName (javax.xml.namespace.QName)4 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)3 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)3 PropertyDelta (com.evolveum.midpoint.prism.delta.PropertyDelta)3 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 GenericConnectorException (com.evolveum.midpoint.provisioning.api.GenericConnectorException)3 GenericFrameworkException (com.evolveum.midpoint.provisioning.ucf.api.GenericFrameworkException)3 ProvisioningUtil (com.evolveum.midpoint.provisioning.util.ProvisioningUtil)3 ResourceShadowDiscriminator (com.evolveum.midpoint.schema.ResourceShadowDiscriminator)3 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)3 InternalsConfig (com.evolveum.midpoint.schema.internals.InternalsConfig)3