use of org.geotools.filter.FilterFactoryImpl in project ddf by codice.
the class SolrProviderQuery method contextualLogicalAndNegativeCase.
@Test
public void contextualLogicalAndNegativeCase() throws UnsupportedQueryException, IngestException {
createContextualMetacards();
FilterFactory filterFactory = new FilterFactoryImpl();
Filter filter = filterFactory.and(filterFactory.like(filterFactory.property(Metacard.METADATA), Library.FLAGSTAFF_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false), filterFactory.like(filterFactory.property(Metacard.METADATA), Library.TAMPA_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false));
SourceResponse sourceResponse = provider.query(new QueryRequestImpl(new QueryImpl(filter)));
assertEquals("Flagstaff and Tampa", 0, sourceResponse.getResults().size());
}
use of org.geotools.filter.FilterFactoryImpl in project ddf by codice.
the class PropertyMapperVisitorTest method testPropertyMapperVisitPassThrough.
@Test
public void testPropertyMapperVisitPassThrough() {
Map<String, String> map = new HashMap<>();
map.put("prop", "newProp");
PropertyMapperVisitor mapper = new PropertyMapperVisitor(map);
PropertyName propertyName = new PropertyNameImpl("myprop");
AttributeExpressionImpl exp = (AttributeExpressionImpl) mapper.visit(propertyName, new FilterFactoryImpl());
assertThat(exp.getPropertyName(), equalTo("myprop"));
}
use of org.geotools.filter.FilterFactoryImpl in project ddf by codice.
the class PropertyMapperVisitorTest method testPropertyMapperVisit.
@Test
public void testPropertyMapperVisit() {
Map<String, String> map = new HashMap<>();
map.put("prop", "newProp");
PropertyMapperVisitor mapper = new PropertyMapperVisitor(map);
PropertyName propertyName = new PropertyNameImpl("prop");
AttributeExpressionImpl exp = (AttributeExpressionImpl) mapper.visit(propertyName, new FilterFactoryImpl());
assertThat(exp.getPropertyName(), equalTo("newProp"));
}
use of org.geotools.filter.FilterFactoryImpl in project ddf by codice.
the class PropertyMapperVisitorTest method testPropertyMapperVisitNullProperty.
@Test
public void testPropertyMapperVisitNullProperty() {
Map<String, String> map = new HashMap<>();
PropertyMapperVisitor mapper = new PropertyMapperVisitor(map);
AttributeExpressionImpl exp = (AttributeExpressionImpl) mapper.visit((PropertyName) null, new FilterFactoryImpl());
assertThat(exp, nullValue());
}
use of org.geotools.filter.FilterFactoryImpl in project ddf by codice.
the class SolrProviderCreate method testCreateMultivaluedAttribute.
/**
* Tests that multivalued attributes are stored and returned
*/
@Test
public void testCreateMultivaluedAttribute() throws UnsupportedQueryException, IngestException {
deleteAll(provider);
FilterFactory filterFactory = new FilterFactoryImpl();
MockMetacard metacard = new MockMetacard(Library.getFlagstaffRecord());
List<Serializable> a = new ArrayList<>();
a.add("sample-validator");
a.add("sample-validator2");
AttributeImpl attribute = new AttributeImpl(Validation.VALIDATION_WARNINGS, a);
metacard.setAttribute(attribute);
create(metacard, provider);
Filter filter = filterFactory.like(filterFactory.property(Metacard.TITLE), MockMetacard.DEFAULT_TITLE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false);
QueryImpl query = new QueryImpl(filter);
query.setStartIndex(1);
SourceResponse sourceResponse = provider.query(new QueryRequestImpl(query));
List<Result> results = sourceResponse.getResults();
Metacard mResult = results.get(0).getMetacard();
assertThat(mResult.getAttribute(Validation.VALIDATION_WARNINGS).getValues().size(), is(2));
}
Aggregations