use of org.geotoolkit.filter.DefaultPropertyName in project geotoolkit by Geomatys.
the class XmlFeatureTest method testWriteSimpleFeaturePrimitiveWithAtts.
@Test
public void testWriteSimpleFeaturePrimitiveWithAtts() throws JAXBException, IOException, XMLStreamException, DataStoreException, ParserConfigurationException, SAXException {
final File temp = File.createTempFile("gml", ".xml");
temp.deleteOnExit();
final XmlFeatureWriter writer = new JAXPStreamFeatureWriter("3.2.1", "1.1.0", null);
writer.write(featureEmpty, temp);
writer.dispose();
String result = IOUtilities.toString(new FileInputStream(temp));
String expResult = IOUtilities.toString(XmlFeatureTest.class.getResourceAsStream("/org/geotoolkit/feature/xml/SimpleFeatureEmpty.xml"));
expResult = expResult.replace("EPSG_VERSION", EPSG_VERSION);
expResult = expResult.replaceAll("(?i)epsg\\:\\d+\\.\\d+\\.?\\d*\\:", "epsg::");
result = result.replaceAll("(?i)epsg\\:\\d+\\.\\d+\\.?\\d*\\:", "epsg::");
final Expression exp = new DefaultPropertyName("/identifier/_value");
Object v = exp.apply(featureEmpty);
DomCompare.compare(expResult, result);
}
use of org.geotoolkit.filter.DefaultPropertyName in project geotoolkit by Geomatys.
the class JavaScriptFunction method prepare.
private static Expression[] prepare(final Expression jsFunction) {
final String str = jsFunction.apply(null).toString();
final List<Expression> properties = new ArrayList<Expression>();
properties.add(jsFunction);
String current = null;
for (int i = 0, n = str.length(); i < n; i++) {
char c = str.charAt(i);
if (current != null) {
if (END_CHARACTERS.contains(c)) {
if (!current.isEmpty()) {
properties.add(new DefaultPropertyName(current));
}
current = null;
} else {
current += c;
}
} else {
if (c == VAR_CHARACTER) {
current = "";
}
}
}
if (current != null && !current.isEmpty()) {
properties.add(new DefaultPropertyName(current));
}
return properties.toArray(new Expression[properties.size()]);
}
use of org.geotoolkit.filter.DefaultPropertyName in project geotoolkit by Geomatys.
the class XPathBindingTest method testStarXPath.
@Test
public void testStarXPath() {
final String exp = "*[10]";
final ValueReference pn = new DefaultPropertyName(exp);
final Object result = pn.apply(FilterTestConstants.FEATURE_1);
assertEquals("test string data", result);
}
use of org.geotoolkit.filter.DefaultPropertyName in project geotoolkit by Geomatys.
the class XPathBindingTest method testDoubleSlashXPath.
@Test
public void testDoubleSlashXPath() {
final String exp = "//gml:testString";
final ValueReference pn = new DefaultPropertyName(exp);
final Object result = pn.apply(FilterTestConstants.FEATURE_1);
assertEquals("test string data", result);
}
use of org.geotoolkit.filter.DefaultPropertyName in project geotoolkit by Geomatys.
the class GroovyFunction method prepare.
/**
* Map groovy parameters to PropertyNames.
* @param gvFunction
* @return Expression[]
*/
private static Expression[] prepare(final Expression gvFunction) {
final String str = gvFunction.apply(null).toString();
final List<Expression> properties = new ArrayList<Expression>();
properties.add(gvFunction);
String current = null;
for (int i = 0, n = str.length(); i < n; i++) {
char c = str.charAt(i);
if (current != null) {
if (END_CHARACTERS.contains(c)) {
if (!current.isEmpty()) {
properties.add(new DefaultPropertyName(current));
}
current = null;
} else {
current += c;
}
} else {
if (c == VAR_CHARACTER) {
current = "";
}
}
}
if (current != null && !current.isEmpty()) {
properties.add(new DefaultPropertyName(current));
}
return properties.toArray(new Expression[properties.size()]);
}
Aggregations