@Test public void testCoverageFilter() throws IOException, SAXException { String input = "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[292864,6845440],[292864,6781952],[393216,6781952],[393216,6845440],[292864,6845440]]]},\"properties\":{\"area\":\"Alue ei saa muodostaa silmukkaa. Piirrä risteämätön alue nähdäksesi mittaustuloksen.\"},\"id\":\"drawFeature3\"}],\"crs\":\"EPSG:3067\"}"; Filter filter = createGeometryFilter(input); String request = org.oskari.csw.request.GetRecords.createRequest(filter); String expected = IOHelper.readString(getClass().getResourceAsStream("GetRecords-coverage.xml")); Diff xmlDiff = new Diff(request, expected); DetailedDiff detailXmlDiff = new DetailedDiff(xmlDiff); List<Difference> differences = detailXmlDiff.getAllDifferences(); boolean isJava11 = System.getProperty("java.version").startsWith("11."); if (isJava11 && differences.size() == 1) { final String coordinatesPath = "/GetRecords[1]/Query[1]/Constraint[1]/Filter[1]/Intersects[1]/Polygon[1]/outerBoundaryIs[1]/LinearRing[1]/coordinates[1]/text()[1]"; assertEquals("Something else than coordinates transform differ in expected and result", coordinatesPath, differences.get(0).getTestNodeDetail().getXpathLocation()); } else { assertTrue("Should get expected coverage request" + xmlDiff, xmlDiff.similar()); } }
public static String createRequest(Filter filter) { if (filter == null) { throw new ServiceRuntimeException("Filter is required"); } final StringWriter writer = new StringWriter(); XMLStreamWriter xsw = getXMLWriter(writer); startDocument(xsw); writeRawXMLUnsafe(xsw, writer, getFilterAsString(filter)); endDocument(xsw); return writer.toString(); }
GetRecords { public static String createRequest(Filter filter) { if (filter == null) { throw new ServiceRuntimeException("Filter is required"); } final StringWriter writer = new StringWriter(); XMLStreamWriter xsw = getXMLWriter(writer); startDocument(xsw); writeRawXMLUnsafe(xsw, writer, getFilterAsString(filter)); endDocument(xsw); return writer.toString(); } }
GetRecords { public static String createRequest(Filter filter) { if (filter == null) { throw new ServiceRuntimeException("Filter is required"); } final StringWriter writer = new StringWriter(); XMLStreamWriter xsw = getXMLWriter(writer); startDocument(xsw); writeRawXMLUnsafe(xsw, writer, getFilterAsString(filter)); endDocument(xsw); return writer.toString(); } private  GetRecords(); }
GetRecords { public static String createRequest(Filter filter) { if (filter == null) { throw new ServiceRuntimeException("Filter is required"); } final StringWriter writer = new StringWriter(); XMLStreamWriter xsw = getXMLWriter(writer); startDocument(xsw); writeRawXMLUnsafe(xsw, writer, getFilterAsString(filter)); endDocument(xsw); return writer.toString(); } private  GetRecords(); static String createRequest(Filter filter); }
GetRecords { public static String createRequest(Filter filter) { if (filter == null) { throw new ServiceRuntimeException("Filter is required"); } final StringWriter writer = new StringWriter(); XMLStreamWriter xsw = getXMLWriter(writer); startDocument(xsw); writeRawXMLUnsafe(xsw, writer, getFilterAsString(filter)); endDocument(xsw); return writer.toString(); } private  GetRecords(); static String createRequest(Filter filter);  }