Search in sources :

Example 56 with QueryType

use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.

the class TestOpenDj method test202SearchObjectsComplexFilter.

@Test
public void test202SearchObjectsComplexFilter() throws Exception {
    Task task = getTestTask();
    OperationResult result = task.getResult();
    QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_COMPLEX_FILTER_FILE, QueryType.COMPLEX_TYPE);
    ObjectQuery query = getQueryConverter().createObjectQuery(ShadowType.class, queryType);
    provisioningService.applyDefinition(ShadowType.class, query, task, result);
    rememberCounter(InternalCounters.CONNECTOR_OPERATION_COUNT);
    rememberCounter(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT);
    // WHEN
    when();
    List<PrismObject<ShadowType>> objListType = provisioningService.searchObjects(ShadowType.class, query, null, task, result);
    // THEN
    then();
    result.computeStatus();
    TestUtil.assertSuccess(result);
    for (PrismObject<ShadowType> objType : objListType) {
        assertNotNull("Null search result", objType);
        display("found object", objType);
    }
    assertEquals("Unexpected number of objects found", 1, objListType.size());
    assertConnectorOperationIncrement(1, 3);
    assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Example 57 with QueryType

use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.

the class TestOpenDj method test330SearchForPosixAccount.

/**
 * Search for account created directly on resource (no shadow in repo). The account has
 * posixAccount auxiliary object class. Provisioning should figure that out.
 */
@Test
public void test330SearchForPosixAccount() throws Exception {
    Task task = getTestTask();
    OperationResult result = task.getResult();
    QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_VANHELGEN_FILE, QueryType.COMPLEX_TYPE);
    ObjectQuery query = getQueryConverter().createObjectQuery(ShadowType.class, queryType);
    provisioningService.applyDefinition(ShadowType.class, query, task, result);
    Entry entry = openDJController.addEntryFromLdifFile(ACCOUNT_POSIX_VANHELGEN_LDIF_FILE);
    display("Added entry", entry);
    rememberCounter(InternalCounters.CONNECTOR_OPERATION_COUNT);
    rememberCounter(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT);
    // WHEN
    when();
    List<PrismObject<ShadowType>> objListType = provisioningService.searchObjects(ShadowType.class, query, null, task, result);
    // THEN
    then();
    for (PrismObject<ShadowType> objType : objListType) {
        assertNotNull("Null search result", objType);
        display("found object", objType);
    }
    assertEquals("Unexpected number of objects found", 1, objListType.size());
    PrismObject<ShadowType> provisioningShadow = objListType.get(0);
    assertAttribute(provisioningShadow, "cn", "Edward Van Helgen");
    assertAttribute(provisioningShadow, "homeDirectory", "/home/vanhelgen");
    assertAttribute(provisioningShadow, "uidNumber", 1002);
    assertConnectorOperationIncrement(1, 3);
    assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
    assertShadows(17);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) Entry(org.opends.server.types.Entry) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Example 58 with QueryType

use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.

the class TestOpenDj method test252CountLdapGroups.

/**
 * Account counting is simulated.
 * But "dumber" resource do not have any simulation for this.
 */
@Test
public void test252CountLdapGroups() throws Exception {
    Task task = getTestTask();
    OperationResult result = task.getResult();
    QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_ALL_LDAP_GROUPS_FILE, QueryType.COMPLEX_TYPE);
    ObjectQuery query = getQueryConverter().createObjectQuery(ShadowType.class, queryType);
    // WHEN
    when();
    Integer count = provisioningService.countObjects(ShadowType.class, query, null, task, result);
    // THEN
    then();
    assertSuccess(result);
    displayValue("All LDAP groups count", count);
    assertEquals("Unexpected number of search results", getExpectedLdapGroupCountTest25x(), count);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Example 59 with QueryType

use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.

the class TestOpenDj method test250CountAccounts.

/**
 * Account counting is simulated.
 * For "dumber" resource it is defined in schemaHandling as a object-type-specific capability.
 */
@Test
public void test250CountAccounts() throws Exception {
    Task task = getTestTask();
    OperationResult result = task.getResult();
    QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_ALL_ACCOUNTS_FILE, QueryType.COMPLEX_TYPE);
    ObjectQuery query = getQueryConverter().createObjectQuery(ShadowType.class, queryType);
    // WHEN
    when();
    Integer count = provisioningService.countObjects(ShadowType.class, query, null, task, result);
    // THEN
    then();
    assertSuccess(result);
    displayValue("All accounts count", count);
    assertEquals("Unexpected number of search results", (Integer) 14, count);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Example 60 with QueryType

use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.

the class TestOpenDj method test231SearchObjectsPagedOffsetZero.

@Test
public void test231SearchObjectsPagedOffsetZero() throws Exception {
    Task task = getTestTask();
    OperationResult result = task.getResult();
    QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_ALL_ACCOUNTS_FILE, QueryType.COMPLEX_TYPE);
    ObjectQuery query = getQueryConverter().createObjectQuery(ShadowType.class, queryType);
    ObjectPaging paging = prismContext.queryFactory().createPaging(0, 4);
    query.setPaging(paging);
    rememberCounter(InternalCounters.CONNECTOR_OPERATION_COUNT);
    rememberCounter(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT);
    // WHEN
    when();
    SearchResultList<PrismObject<ShadowType>> searchResults = provisioningService.searchObjects(ShadowType.class, query, null, task, result);
    // THEN
    then();
    assertSuccess(result);
    display("Search results", searchResults);
    assertSearchResults(searchResults, "cook", "drake", "hbarbossa", "idm");
    assertConnectorOperationIncrement(1, 9);
    assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);
    // VLV search if forced by using offset. So we have result number estimate.
    assertApproxNumberOfAllResults(searchResults.getMetadata(), 14);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ObjectPaging(com.evolveum.midpoint.prism.query.ObjectPaging) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) Test(org.testng.annotations.Test)

Aggregations

QueryType (com.evolveum.prism.xml.ns._public.query_3.QueryType)91 Test (org.junit.Test)89 QueryImpl (ddf.catalog.operation.impl.QueryImpl)71 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)67 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)58 Test (org.testng.annotations.Test)52 QName (javax.xml.namespace.QName)50 JAXBElement (javax.xml.bind.JAXBElement)44 SearchFilterType (com.evolveum.prism.xml.ns._public.query_3.SearchFilterType)38 ArrayList (java.util.ArrayList)37 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)34 Filter (org.opengis.filter.Filter)32 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)23 SortBy (org.opengis.filter.sort.SortBy)22 QueryConstraintType (net.opengis.cat.csw.v_2_0_2.QueryConstraintType)21 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)21 SortByImpl (ddf.catalog.filter.impl.SortByImpl)20 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)19 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)19 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)18