use of com.sldeditor.datasource.impl.ExtractAttributes in project sldeditor by robward-scisys.
the class ExtractAttributesTest method testBinarySpatialOperator.
@Test
public void testBinarySpatialOperator() {
DummyInternalSLDFile2 dummy = new DummyInternalSLDFile2();
StyledLayerDescriptor sld = createTestSLD(dummy);
List<Rule> ruleList = getRuleList(sld);
Rule rule = DefaultSymbols.createNewRule();
// Try bbox
String expectedGeometryFieldName = "test geometry";
Filter filter = ff.bbox(expectedGeometryFieldName, -1.0, 49.0, 2.0, 55.0, "EPSG:4326");
rule.setFilter(filter);
ruleList.clear();
ruleList.add(rule);
ExtractAttributes extract = new ExtractAttributes();
extract.extractDefaultFields(sld);
// Check fields extracted ok
List<String> actualGeometryFields = extract.getGeometryFields();
assertEquals(1, actualGeometryFields.size());
assertEquals(expectedGeometryFieldName, actualGeometryFields.get(0));
List<DataSourceAttributeData> actualFieldnameList = extract.getFields();
assertEquals(0, actualFieldnameList.size());
}
use of com.sldeditor.datasource.impl.ExtractAttributes in project sldeditor by robward-scisys.
the class ExtractAttributesTest method testBinaryTemporalFilter.
@Test
public void testBinaryTemporalFilter() {
DummyInternalSLDFile2 dummy = new DummyInternalSLDFile2();
StyledLayerDescriptor sld = createTestSLD(dummy);
List<Rule> ruleList = getRuleList(sld);
Rule rule = DefaultSymbols.createNewRule();
// Try begins
Filter filter = ff.begins(ff.property("test"), ff.literal("1234"));
rule.setFilter(filter);
ruleList.clear();
ruleList.add(rule);
ExtractAttributes extract = new ExtractAttributes();
extract.extractDefaultFields(sld);
// Check fields extracted ok
List<DataSourceAttributeData> actualFieldnameList = extract.getFields();
assertEquals(1, actualFieldnameList.size());
DataSourceAttributeData dataSourceField = actualFieldnameList.get(0);
assertEquals(Integer.class, dataSourceField.getType());
}
Aggregations