@Override public Object parse(String value) throws Exception { if(!GridCS.GCSGrid2dSquare.getXmlConstant().equalsIgnoreCase(value)) throw new WcsException("Unrecognized GridCS " + value, WcsExceptionCode.InvalidParameterValue, "GridCS"); return GridCS.GCSGrid2dSquare.getXmlConstant(); } }
@Override public Object parse(String value) throws Exception { if (!GridCS.GCSGrid2dSquare.getXmlConstant().equalsIgnoreCase(value)) throw new WcsException( "Unrecognized GridCS " + value, WcsExceptionCode.InvalidParameterValue, "GridCS"); return GridCS.GCSGrid2dSquare.getXmlConstant(); } }
@Test public void testGridCS() throws Exception { Map<String, Object> raw = baseMap(); final String layerId = getLayerId(TASMANIA_BM); raw.put("identifier", layerId); raw.put("format", "image/tiff"); raw.put("BoundingBox", "-45,146,-42,147"); raw.put("GridCS", GridCS.GCSGrid2dSquare.getXmlConstant()); GetCoverageType getCoverage = (GetCoverageType) reader.read(reader.createRequest(), parseKvp(raw), raw); assertEquals( GridCS.GCSGrid2dSquare.getXmlConstant(), getCoverage.getOutput().getGridCRS().getGridCS()); raw.put("GridCS", GridCS.GCSGrid2dSquare.getXmlConstant().toUpperCase()); getCoverage = (GetCoverageType) reader.read(reader.createRequest(), parseKvp(raw), raw); assertEquals( GridCS.GCSGrid2dSquare.getXmlConstant(), getCoverage.getOutput().getGridCRS().getGridCS()); raw.put("GridCS", "Hoolabaloola"); try { reader.read(reader.createRequest(), parseKvp(raw), raw); fail("We should have had a WcsException here?"); } catch (WcsException e) { assertEquals(InvalidParameterValue.name(), e.getCode()); assertEquals("GridCS", e.getLocator()); } }
if (!gridCS.equalsIgnoreCase(GridCS.GCSGrid2dSquare.getXmlConstant())) throw new WcsException("Unsupported grid cs " + gridCS, InvalidParameterValue, "GridCS"); gridCRS.setGridCS(GridCS.GCSGrid2dSquare.getXmlConstant());
if (!gridCS.equalsIgnoreCase(GridCS.GCSGrid2dSquare.getXmlConstant())) throw new WcsException( "Unsupported grid cs " + gridCS, InvalidParameterValue, "GridCS"); gridCRS.setGridCS(GridCS.GCSGrid2dSquare.getXmlConstant());