use of ddf.catalog.filter.impl.SortByImpl in project ddf by codice.
the class WfsSourceTest method testTypeNameHasPrefix.
@Test
public void testTypeNameHasPrefix() throws Exception {
// Setup
final String TITLE = "title";
final String searchPhrase = "*";
final int pageSize = 1;
WfsSource source = getWfsSource(ONE_TEXT_PROPERTY_SCHEMA, MockWfsServer.getFilterCapabilities(), 3, false, true, 3);
QueryImpl query = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text(searchPhrase));
query.setPageSize(pageSize);
SortBy sortBy = new SortByImpl(TITLE, SortOrder.DESCENDING);
query.setSortBy(sortBy);
// Perform test
GetFeatureType featureType = source.buildGetFeatureRequest(query);
// Validate
List<JAXBElement<?>> queryList = featureType.getAbstractQueryExpression();
for (JAXBElement<?> queryType : queryList) {
Object val = queryType.getValue();
QueryType queryTypeVal = (QueryType) val;
assertThat(queryTypeVal.getTypeNames().get(0), containsString("Prefix"));
assertThat(queryTypeVal.getTypeNames().get(0), containsString(":"));
assertThat(queryTypeVal.getTypeNames().get(0), containsString("SampleFeature"));
}
}
use of ddf.catalog.filter.impl.SortByImpl in project ddf by codice.
the class WfsSourceTest method testResultNumReturnedIsWrong.
/**
* If numberReturned is null, then query should return back size equivalent to the number of
* members in the feature collection.
*/
@Test
public void testResultNumReturnedIsWrong() throws Exception {
// Setup
final String TITLE = "title";
final String searchPhrase = "*";
final int pageSize = 1;
WfsSource source = getWfsSource(ONE_TEXT_PROPERTY_SCHEMA, MockWfsServer.getFilterCapabilities(), 3, false, true, 5);
QueryImpl query = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text(searchPhrase));
query.setPageSize(pageSize);
SortBy sortBy = new SortByImpl(TITLE, SortOrder.DESCENDING);
query.setSortBy(sortBy);
QueryRequestImpl queryReq = new QueryRequestImpl(query);
// Perform test
SourceResponse resp = source.query(queryReq);
assertEquals(3, resp.getResults().size());
}
use of ddf.catalog.filter.impl.SortByImpl in project ddf by codice.
the class WfsSourceTest method testResultNumReturnedIsNull.
/**
* If numberReturned is null, then query should return back size equivalent to the number of
* members in the feature collection.
*/
@Test
public void testResultNumReturnedIsNull() throws Exception {
// Setup
final String TITLE = "title";
final String searchPhrase = "*";
final int pageSize = 1;
WfsSource source = getWfsSource(ONE_TEXT_PROPERTY_SCHEMA, MockWfsServer.getFilterCapabilities(), 3, false, true, NULL_NUM_RETURNED);
QueryImpl query = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text(searchPhrase));
query.setPageSize(pageSize);
SortBy sortBy = new SortByImpl(TITLE, SortOrder.DESCENDING);
query.setSortBy(sortBy);
QueryRequestImpl queryReq = new QueryRequestImpl(query);
// Perform test
SourceResponse resp = source.query(queryReq);
assertEquals(3, resp.getResults().size());
}
use of ddf.catalog.filter.impl.SortByImpl in project ddf by codice.
the class WfsSourceTest method testResultNumReturnedNegative.
@Test
public void testResultNumReturnedNegative() throws Exception {
// Setup
final String TITLE = "title";
final String searchPhrase = "*";
final int pageSize = 1;
WfsSource source = getWfsSource(ONE_TEXT_PROPERTY_SCHEMA, MockWfsServer.getFilterCapabilities(), 3, false, true, -1);
QueryImpl query = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text(searchPhrase));
query.setPageSize(pageSize);
SortBy sortBy = new SortByImpl(TITLE, SortOrder.DESCENDING);
query.setSortBy(sortBy);
QueryRequestImpl queryReq = new QueryRequestImpl(query);
// Perform test
source.query(queryReq);
}
use of ddf.catalog.filter.impl.SortByImpl in project ddf by codice.
the class TestWfsSource method testTypeNameHasPrefix.
@Test
public void testTypeNameHasPrefix() throws WfsException, SecurityServiceException, UnsupportedQueryException {
//Setup
final String TITLE = "title";
final String searchPhrase = "*";
final int pageSize = 1;
WfsSource source = getWfsSource(ONE_TEXT_PROPERTY_SCHEMA, MockWfsServer.getFilterCapabilities(), GeospatialUtil.EPSG_4326_URN, 3, false, true, 3);
QueryImpl query = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text(searchPhrase));
query.setPageSize(pageSize);
SortBy sortBy = new SortByImpl(TITLE, SortOrder.DESCENDING);
query.setSortBy(sortBy);
// Perform test
GetFeatureType featureType = source.buildGetFeatureRequest(query);
//Validate
List<JAXBElement<?>> queryList = featureType.getAbstractQueryExpression();
for (JAXBElement<?> queryType : queryList) {
Object val = queryType.getValue();
QueryType queryTypeVal = (QueryType) val;
assertThat(queryTypeVal.getTypeNames().get(0), containsString("Prefix"));
assertThat(queryTypeVal.getTypeNames().get(0), containsString(":"));
assertThat(queryTypeVal.getTypeNames().get(0), containsString("SampleFeature"));
}
}
Aggregations