GetVectorTileCommand implements CommandHasRequest<GetVectorTileRequest, GetVectorTileResponse> { @Override public void execute(GetVectorTileRequest request, GetVectorTileResponse response) throws Exception { String layerId = request.getLayerId(); log.debug("request start layer {}, crs {}", layerId, request.getCrs()); if (null == layerId) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "layer"); } if (null == request.getCrs()) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "crs"); } response.setTile(converter.toDto(layerService.getTile(request))); }  @Override GetVectorTileRequest getEmptyCommandRequest(); @Override GetVectorTileResponse getEmptyCommandResponse(); @Override void execute(GetVectorTileRequest request, GetVectorTileResponse response);  }
@Test public void testGetVectorTile() throws Exception { GetVectorTileRequest request = new GetVectorTileRequest(); request.setCrs(CRS); request.setLayerId(LAYER_ID); request.setCode(new TileCode(0, 0, 0)); request.setPanOrigin(new Coordinate(0, 0)); request.setRenderer(GetVectorTileRequest.PARAM_SVG_RENDERER); request.setScale(1.0); GetVectorTileResponse response = (GetVectorTileResponse) dispatcher.execute( GetVectorTileRequest.COMMAND, request, null, "en"); if (response.isError()) { response.getErrors().get(0).printStackTrace(); } Assert.assertFalse(response.isError()); VectorTile tile = response.getTile(); Assert.assertNotNull(tile); Assert.assertNotNull(tile.getFeatureContent()); Assert.assertEquals( "<g id=\"countries.features.0-0-0\">" + "<g style=\"fill:#995500;fill-opacity:0.6;stroke:#995500;stroke-opacity:0.3;stroke-width:1px;\" " + "id=\"countries.features.0-0-0.0\">" + "<path fill-rule=\"evenodd\" d=\"M0 1l1 0 0 -1 -1 0 0 1 Z\" id=\"4\">" + "</path><path fill-rule=\"evenodd\" d=\"M-1 0l1 0 0 -1 -1 0 0 1 Z\" id=\"3\">" + "</path><path fill-rule=\"evenodd\" d=\"M-1 1l1 0 0 -1 -1 0 0 1 Z\" id=\"2\">" + "</path><path fill-rule=\"evenodd\" d=\"M0 0l1 0 0 -1 -1 0 0 1 Z\" id=\"1\"/></g></g>", tile.getFeatureContent()); Assert.assertEquals(171, tile.getScreenHeight()); Assert.assertEquals(171, tile.getScreenWidth()); }