Search in sources :

Example 66 with QueryType

use of net.opengis.cat.csw.v_2_0_2.QueryType in project ddf by codice.

the class ValidatorTest method testValidateElementNames.

@Test
public void testValidateElementNames() throws Exception {
    QueryType query = new QueryType();
    List<QName> elementNameList = Arrays.asList(new QName("brief"), new QName("summary"), new QName("full"));
    query.setElementName(elementNameList);
    validator.validateElementNames(query);
}
Also used : QName(javax.xml.namespace.QName) QueryType(net.opengis.cat.csw.v_2_0_2.QueryType) Test(org.junit.Test)

Example 67 with QueryType

use of net.opengis.cat.csw.v_2_0_2.QueryType in project midpoint by Evolveum.

the class AbstractTestForExchangeConnector method listRequestableRoles.

protected Collection<RoleType> listRequestableRoles() throws SAXException, IOException, FaultMessage, JAXBException {
    SearchFilterType filter = ModelClientUtil.parseSearchFilterType("<equal xmlns='http://prism.evolveum.com/xml/ns/public/query-3' xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3' >" + "<path>c:requestable</path>" + "<value>true</value>" + "</equal>");
    QueryType query = new QueryType();
    query.setFilter(filter);
    SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
    Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
    modelPort.searchObjects(ModelClientUtil.getTypeQName(RoleType.class), query, options, objectListHolder, resultHolder);
    ObjectListType objectList = objectListHolder.value;
    return (Collection) objectList.getObject();
}
Also used : SearchFilterType(com.evolveum.prism.xml.ns._public.query_3.SearchFilterType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) Holder(javax.xml.ws.Holder) Collection(java.util.Collection) ObjectListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) SelectorQualifiedGetOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)

Example 68 with QueryType

use of net.opengis.cat.csw.v_2_0_2.QueryType in project midpoint by Evolveum.

the class TestSanityLegacy method searchUserByName.

private UserType searchUserByName(String name) throws Exception {
    //        Document doc = DOMUtil.getDocument();
    //        Element nameElement = doc.createElementNS(SchemaConstants.C_NAME.getNamespaceURI(),
    //                SchemaConstants.C_NAME.getLocalPart());
    //        nameElement.setTextContent(name);
    //        Element filter = QueryUtil.createEqualFilter(doc, null, nameElement);
    //
    //        QueryType query = new QueryType();
    //        query.setFilter(filter);
    ObjectQuery q = ObjectQueryUtil.createNameQuery(UserType.class, prismContext, name);
    QueryType query = QueryJaxbConvertor.createQueryType(q, prismContext);
    OperationResultType resultType = new OperationResultType();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>(resultType);
    Holder<ObjectListType> listHolder = new Holder<ObjectListType>();
    assertNoRepoCache();
    modelWeb.searchObjects(ObjectTypes.USER.getTypeQName(), query, null, listHolder, resultHolder);
    assertNoRepoCache();
    ObjectListType objects = listHolder.value;
    TestUtil.assertSuccess("searchObjects has failed", resultHolder.value);
    AssertJUnit.assertEquals("User not found (or found too many)", 1, objects.getObject().size());
    UserType user = (UserType) objects.getObject().get(0);
    AssertJUnit.assertEquals(user.getName(), PrismTestUtil.createPolyStringType(name));
    return user;
}
Also used : OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Holder(javax.xml.ws.Holder) ObjectListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 69 with QueryType

use of net.opengis.cat.csw.v_2_0_2.QueryType in project midpoint by Evolveum.

the class TestOpenDj method test230SearchObjectsPagedNoOffset.

@Test
public void test230SearchObjectsPagedNoOffset() throws Exception {
    final String TEST_NAME = "test230SearchObjectsPagedNoOffset";
    TestUtil.displayTestTile(TEST_NAME);
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_ALL_ACCOUNTS_FILE, QueryType.COMPLEX_TYPE);
    ObjectQuery query = QueryJaxbConvertor.createObjectQuery(ShadowType.class, queryType, prismContext);
    ObjectPaging paging = ObjectPaging.createPaging(null, 3);
    query.setPaging(paging);
    rememberConnectorOperationCount();
    rememberConnectorSimulatedPagingSearchCount();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    List<PrismObject<ShadowType>> searchResults = provisioningService.searchObjects(ShadowType.class, query, null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    assertSuccess(result);
    display("Search resutls", searchResults);
    assertSearchResults(searchResults, "cook", "drake", "hbarbossa");
    assertConnectorOperationIncrement(1, 7);
    assertConnectorSimulatedPagingSearchIncrement(0);
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) 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)

Example 70 with QueryType

use of net.opengis.cat.csw.v_2_0_2.QueryType in project midpoint by Evolveum.

the class TestOpenDj method test232SearchObjectsPagedOffset.

@Test
public void test232SearchObjectsPagedOffset() throws Exception {
    final String TEST_NAME = "test232SearchObjectsPagedOffset";
    TestUtil.displayTestTile(TEST_NAME);
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_ALL_ACCOUNTS_FILE, QueryType.COMPLEX_TYPE);
    ObjectQuery query = QueryJaxbConvertor.createObjectQuery(ShadowType.class, queryType, prismContext);
    ObjectPaging paging = ObjectPaging.createPaging(2, 5);
    query.setPaging(paging);
    rememberConnectorOperationCount();
    rememberConnectorSimulatedPagingSearchCount();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    SearchResultList<PrismObject<ShadowType>> searchResults = provisioningService.searchObjects(ShadowType.class, query, null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    assertSuccess(result);
    display("Search resutls", searchResults);
    // The results should be this:
    assertSearchResults(searchResults, "hbarbossa", "idm", "jbeckett", "jbond", "jgibbs");
    assertConnectorOperationIncrement(1, 11);
    assertConnectorSimulatedPagingSearchIncrement(0);
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) 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)57 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)41 Test (org.junit.Test)40 QueryImpl (ddf.catalog.operation.impl.QueryImpl)37 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)36 QName (javax.xml.namespace.QName)34 Test (org.testng.annotations.Test)32 JAXBElement (javax.xml.bind.JAXBElement)27 SearchFilterType (com.evolveum.prism.xml.ns._public.query_3.SearchFilterType)24 ArrayList (java.util.ArrayList)24 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)20 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)17 Matchers.anyString (org.mockito.Matchers.anyString)14 ObjectListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType)13 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)13 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)12 Task (com.evolveum.midpoint.task.api.Task)12 Holder (javax.xml.ws.Holder)12 GetFeatureType (ogc.schema.opengis.wfs.v_1_0_0.GetFeatureType)12 QueryType (ogc.schema.opengis.wfs.v_1_0_0.QueryType)12