use of com.thoughtworks.xstream.io.xml.DomReader in project ddf by codice.
the class TestBoundingBoxReader method testGetWktBoundingBoxInLonLat.
/**
* Verify that if given a BoundingBox with coords in LON/LAT that the resulting WKT is in
* LON/LAT.
*/
@Test
public void testGetWktBoundingBoxInLonLat() throws ParserConfigurationException, SAXException, IOException, CswException {
// Setup
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse("src/test/resources/BoundingBoxInLonLat.xml");
HierarchicalStreamReader hReader = new DomReader(doc);
BoundingBoxReader boundingBoxReader = new BoundingBoxReader(hReader, CswAxisOrder.LON_LAT);
// Perform Test
String wktInLonLat = boundingBoxReader.getWkt();
LOGGER.debug("WKT: {}", wktInLonLat);
// Verify
assertThat(wktInLonLat, is(NON_JTS_FORMATTED_POLYGON_CONTROL_WKT_IN_LON_LAT));
}
use of com.thoughtworks.xstream.io.xml.DomReader in project ddf by codice.
the class TestBoundingBoxReader method testJTSConverterEPSG4326LonLat.
@Test
public void testJTSConverterEPSG4326LonLat() throws Exception {
// Setup
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse("src/test/resources/BoundingBoxInLonLatEPSG4326.xml");
HierarchicalStreamReader hReader = new DomReader(doc);
BoundingBoxReader boundingBoxReader = new BoundingBoxReader(hReader, CswAxisOrder.LON_LAT);
// Perform Test
String wktInLonLat = boundingBoxReader.getWkt();
LOGGER.debug("WKT: {}", wktInLonLat);
// Verify
assertThat(wktInLonLat, is(NON_JTS_FORMATTED_POLYGON_CONTROL_WKT_IN_LON_LAT));
}
use of com.thoughtworks.xstream.io.xml.DomReader in project ddf by codice.
the class TestBoundingBoxReader method testJTSConverterBadLat.
@Test(expected = CswException.class)
public void testJTSConverterBadLat() throws Exception {
// Setup
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse("src/test/resources/BoundingBoxBadCoordinates.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(NON_JTS_FORMATTED_POLYGON_CONTROL_WKT_IN_LON_LAT));
}
use of com.thoughtworks.xstream.io.xml.DomReader in project ddf by codice.
the class TestBoundingBoxReader method testGetWktBoundingBoxInLatLon.
/**
* Verify that if given a BoundingBox with coords in LAT/LON that the resulting WKT is in
* LON/LAT (i.e., the coords are reversed).
*/
@Test
public void testGetWktBoundingBoxInLatLon() throws ParserConfigurationException, SAXException, IOException, CswException {
// Setup
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse("src/test/resources/BoundingBoxInLatLon.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));
}
use of com.thoughtworks.xstream.io.xml.DomReader in project ddf by codice.
the class TestBoundingBoxReader method testJTSConverterBadCrs.
@Test(expected = CswException.class)
public void testJTSConverterBadCrs() throws Exception {
// Setup
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse("src/test/resources/BoundingBoxBadCrs.xml");
HierarchicalStreamReader hReader = new DomReader(doc);
BoundingBoxReader boundingBoxReader = new BoundingBoxReader(hReader, CswAxisOrder.LAT_LON);
boundingBoxReader.getWkt();
}
Aggregations