Search in sources :

Example 86 with PrismObject

use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.

the class TestUcfDummyMulti method test110SearchNonBlocking.

@Test
public void test110SearchNonBlocking() throws Exception {
    final String TEST_NAME = "test100SearchNonBlocking";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    final ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findDefaultObjectClassDefinition(ShadowKindType.ACCOUNT);
    // Determine object class from the schema
    final List<PrismObject<ShadowType>> searchResults = new ArrayList<PrismObject<ShadowType>>();
    ResultHandler<ShadowType> handler = new ResultHandler<ShadowType>() {

        @Override
        public boolean handle(PrismObject<ShadowType> shadow) {
            System.out.println("Search: found: " + shadow);
            checkUcfShadow(shadow, accountDefinition);
            searchResults.add(shadow);
            return true;
        }
    };
    OperationResult result = new OperationResult(this.getClass().getName() + "." + TEST_NAME);
    // WHEN
    cc.search(accountDefinition, new ObjectQuery(), handler, null, null, null, null, result);
    // THEN
    assertEquals("Unexpected number of search results", 1, searchResults.size());
    ConnectorOperationalStatus opStat = cc.getOperationalStatus();
    display("stats", opStat);
    assertEquals("Wrong pool active", (Integer) 0, opStat.getPoolStatusNumActive());
    assertEquals("Wrong pool active", (Integer) 1, opStat.getPoolStatusNumIdle());
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ArrayList(java.util.ArrayList) ObjectClassComplexTypeDefinition(com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResultHandler(com.evolveum.midpoint.provisioning.ucf.api.ResultHandler) ConnectorOperationalStatus(com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Example 87 with PrismObject

use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.

the class AbstractAdLdapTest method test172Search2AccountsOffset1.

/**
	 * Blocksize is 5, so this is in one block.
	 * There is offset, so VLV should be used.
	 * No explicit sorting.
	 */
@Test
public void test172Search2AccountsOffset1() throws Exception {
    final String TEST_NAME = "test172Search2AccountsOffset1";
    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);
    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 88 with PrismObject

use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.

the class AbstractAdLdapTest method test152SeachFirst2Accounts.

/**
	 * Blocksize is 5, so this is in one block.
	 */
@Test
public void test152SeachFirst2Accounts() throws Exception {
    final String TEST_NAME = "test152SeachFirst2Accounts";
    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(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 89 with PrismObject

use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.

the class AbstractAdLdapTest method test154SeachFirst11Accounts.

/**
	 * Blocksize is 5, so this gets more than two blocks.
	 */
@Test
public void test154SeachFirst11Accounts() throws Exception {
    final String TEST_NAME = "test154SeachFirst11Accounts";
    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(11);
    query.setPaging(paging);
    SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, 11, 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 90 with PrismObject

use of com.evolveum.midpoint.prism.PrismObject in project midpoint by Evolveum.

the class AbstractAdLdapTest 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);
    rememberConnectorOperationCount();
    rememberConnectorSimulatedPagingSearchCount();
    // WHEN
    SearchResultList<PrismObject<ShadowType>> searchResultList = doSearch(TEST_NAME, query, NUMBER_OF_ACCOUNTS, task, result);
    // TODO: why 11? should be 1
    assertConnectorOperationIncrement(12);
    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) 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)

Aggregations

PrismObject (com.evolveum.midpoint.prism.PrismObject)488 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)358 Test (org.testng.annotations.Test)227 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)219 Task (com.evolveum.midpoint.task.api.Task)205 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)97 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)95 ArrayList (java.util.ArrayList)81 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)79 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)64 QName (javax.xml.namespace.QName)59 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)50 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)40 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)37 ResultHandler (com.evolveum.midpoint.schema.ResultHandler)37 SearchResultMetadata (com.evolveum.midpoint.schema.SearchResultMetadata)37 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)37 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)37 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)35 SystemException (com.evolveum.midpoint.util.exception.SystemException)34