use of net.opengis.wfs.v_1_1_0.QueryType in project ddf by codice.
the class TestWfsSource method testSortingAscendingSortingNotSupported.
/**
* Verify that the SortBy is NOT set. In this case, sorting is not supported in the capabilities.
*/
@Test
public void testSortingAscendingSortingNotSupported() throws Exception {
// Setup
final String searchPhrase = "*";
final String mockTemporalFeatureProperty = "myTemporalFeatureProperty";
final String mockFeatureType = "{http://example.com}" + SAMPLE_FEATURE_NAME + 0;
final int pageSize = 1;
// Set ImplementsSorting to FALSE (sorting not supported)
FilterCapabilities mockCapabilitiesSortingNotSupported = MockWfsServer.getFilterCapabilities();
ConformanceType conformance = mockCapabilitiesSortingNotSupported.getConformance();
List<DomainType> domainTypes = conformance.getConstraint();
for (DomainType domainType : domainTypes) {
if (StringUtils.equals(domainType.getName(), "ImplementsSorting")) {
ValueType valueType = new ValueType();
valueType.setValue("FALSE");
domainType.setDefaultValue(valueType);
break;
}
}
WfsSource source = getWfsSource(ONE_TEXT_PROPERTY_SCHEMA, mockCapabilitiesSortingNotSupported, GeospatialUtil.EPSG_4326_URN, 1, false, false, 0);
MetacardMapper mockMetacardMapper = mock(MetacardMapper.class);
when(mockMetacardMapper.getFeatureType()).thenReturn(mockFeatureType);
when(mockMetacardMapper.getSortByTemporalFeatureProperty()).thenReturn(mockTemporalFeatureProperty);
List<MetacardMapper> mappers = new ArrayList<MetacardMapper>(1);
mappers.add(mockMetacardMapper);
source.setMetacardToFeatureMapper(mappers);
QueryImpl query = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text(searchPhrase));
query.setPageSize(pageSize);
SortBy sortBy = new SortByImpl(Result.TEMPORAL, SortOrder.ASCENDING);
query.setSortBy(sortBy);
// Perform Test
GetFeatureType featureType = source.buildGetFeatureRequest(query);
// Verify
QueryType queryType = (QueryType) featureType.getAbstractQueryExpression().get(0).getValue();
assertFalse(queryType.isSetAbstractSortingClause());
}
use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.
the class QueryInterpreter2Test method getQuery.
@Nullable
private ObjectQuery getQuery(File file, Class type) throws SchemaException, IOException {
QueryType queryType = PrismTestUtil.parseAtomicValue(file, QueryType.COMPLEX_TYPE);
LOGGER.info("QUERY TYPE TO CONVERT : {}", ObjectQueryUtil.dump(queryType, prismContext));
ObjectQuery query = null;
try {
// TODO
query = QueryJaxbConvertor.createObjectQuery(type, queryType, prismContext);
} catch (Exception ex) {
LOGGER.info("error while converting query: " + ex.getMessage(), ex);
}
return query;
}
use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.
the class TestOpenDj method test202SearchObjectsCompexFilter.
@Test
public void test202SearchObjectsCompexFilter() throws Exception {
final String TEST_NAME = "test202SearchObjectsCompexFilter";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
QueryType queryType = PrismTestUtil.parseAtomicValue(QUERY_COMPLEX_FILTER_FILE, QueryType.COMPLEX_TYPE);
ObjectQuery query = QueryJaxbConvertor.createObjectQuery(ShadowType.class, queryType, prismContext);
provisioningService.applyDefinition(ShadowType.class, query, task, result);
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
TestUtil.displayWhen(TEST_NAME);
List<PrismObject<ShadowType>> objListType = provisioningService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
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);
assertConnectorSimulatedPagingSearchIncrement(0);
}
use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.
the class TestOpenDj method test250CountObjects.
@Test
public void test250CountObjects() throws Exception {
final String TEST_NAME = "test250CountObjects";
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);
// WHEN
Integer count = provisioningService.countObjects(ShadowType.class, query, null, task, result);
// THEN
result.computeStatus();
assertSuccess(result);
assertEquals("Unexpected number of search results", (Integer) 14, count);
}
use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.
the class TestWSSanity method test015SearchLdapConnector.
// TODO: fetch&parse schema http://..?WSDL
@Test
public void test015SearchLdapConnector() throws Exception {
final String TEST_NAME = "test015SearchLdapConnector";
displayTestTitle(TEST_NAME);
QueryType query = new QueryType();
query.setFilter(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:connectorType</path>" + "<value>" + CONNECTOR_LDAP_TYPE + "</value>" + "</equal>"));
Holder<ObjectListType> objectListHolder = new Holder<>();
Holder<OperationResultType> resultHolder = new Holder<>();
// WHEN
modelPort.searchObjects(ModelClientUtil.getTypeQName(ConnectorType.class), query, null, objectListHolder, resultHolder);
// THEN
assertSuccess(resultHolder);
ObjectListType objectList = objectListHolder.value;
assertEquals("Unexpected number of LDAP connectors", 1, objectList.getObject().size());
ConnectorType ldapConnector = (ConnectorType) objectList.getObject().get(0);
assertNotNull("Null LDAP connector", ldapConnector);
connectorLdapOid = ldapConnector.getOid();
assertNotNull("Null LDAP connector OID", connectorLdapOid);
}
Aggregations