WMTSClient extends AbstractOWSClient<WMTSCapabilitiesAdapter> { public GetTileResponse getTile( GetTile request ) throws IOException, OWSExceptionReport, XMLStreamException { Map<String, String> kvp = buildGetTileKvpMap( request ); if ( request.getOverriddenParameters() != null ) { for ( Entry<String, String> e : request.getOverriddenParameters().entrySet() ) { if ( kvp.containsKey( e.getKey().toLowerCase() ) ) { kvp.put( e.getKey().toLowerCase(), e.getValue() ); } else kvp.put( e.getKey(), e.getValue() ); } } URL endPoint = getGetUrl( WMTSConstants.WMTSRequestType.GetTile.name() ); OwsHttpResponse response = httpClient.doGet( endPoint, kvp, null ); response.assertHttpStatus200(); response.assertNoXmlContentTypeAndExceptionReport(); return new GetTileResponse( response ); } WMTSClient( URL capaUrl, OwsHttpClient httpClient ); List<Layer> getLayers(); Layer getLayer( String layerId ); List<TileMatrixSet> getTileMatrixSets(); TileMatrixSet getTileMatrixSet( String tileMatrixSetId ); GetTileResponse getTile( GetTile request ); GetFeatureInfoResponse getFeatureInfo( GetFeatureInfo request );  }
@Test public void testGetTileOK() throws IOException, OWSExceptionReport, XMLStreamException { URL responseUrl = WMTSClientTest.class.getResource( "gettile_response1.png" ); httpClientMock.setResponse( responseUrl, "image/png", 200 ); GetTile request = buildExampleRequest(); GetTileResponse response = client.getTile( request ); assertNotNull( response ); }
@Test(expected = OWSExceptionReport.class) public void testGetTileHttpStatus500() throws IOException, OWSExceptionReport, XMLStreamException { URL responseUrl = WMTSClientTest.class.getResource( "gettile_response1.png" ); httpClientMock.setResponse( responseUrl, "image/png", 500 ); GetTile request = buildExampleRequest(); client.getTile( request ); }
@Test(expected = OWSExceptionReport.class) public void testGetTileExceptionReport() throws IOException, OWSExceptionReport, XMLStreamException { URL responseUrl = WMTSClientTest.class.getResource( "wmts100_exception_report.xml" ); httpClientMock.setResponse( responseUrl, "text/xml", 200 ); GetTile request = buildExampleRequest(); GetTileResponse response = client.getTile( request ); response.getAsImage(); }