Search in sources :

Example 11 with DomReader

use of com.thoughtworks.xstream.io.xml.DomReader in project ddf by codice.

the class TestBoundingBoxReader method testJTSConverterEPSG4326LatLon.

@Test
public void testJTSConverterEPSG4326LatLon() throws Exception {
    // Setup
    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
    Document doc = docBuilder.parse("src/test/resources/BoundingBoxInLatLonEPSG4326.xml");
    HierarchicalStreamReader hReader = new DomReader(doc);
    BoundingBoxReader boundingBoxReader = new BoundingBoxReader(hReader, CswAxisOrder.LAT_LON);
    // Perform Test
    String wktInLonLat = boundingBoxReader.getWkt();
    LOGGER.debug("WKT: {}", wktInLonLat);
    // Verify
    assertThat(wktInLonLat, is(POLYGON_CONTROL_WKT_IN_LON_LAT));
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DomReader(com.thoughtworks.xstream.io.xml.DomReader) DocumentBuilder(javax.xml.parsers.DocumentBuilder) HierarchicalStreamReader(com.thoughtworks.xstream.io.HierarchicalStreamReader) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

HierarchicalStreamReader (com.thoughtworks.xstream.io.HierarchicalStreamReader)11 DomReader (com.thoughtworks.xstream.io.xml.DomReader)11 DocumentBuilder (javax.xml.parsers.DocumentBuilder)11 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)11 Test (org.junit.Test)11 Document (org.w3c.dom.Document)11 Metacard (ddf.catalog.data.Metacard)3 XStream (com.thoughtworks.xstream.XStream)2 DataHolder (com.thoughtworks.xstream.converters.DataHolder)2 WstxDriver (com.thoughtworks.xstream.io.xml.WstxDriver)2 UnmarshallingContext (com.thoughtworks.xstream.converters.UnmarshallingContext)1 TreeUnmarshaller (com.thoughtworks.xstream.core.TreeUnmarshaller)1 InputStream (java.io.InputStream)1 StringWriter (java.io.StringWriter)1 URL (java.net.URL)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1