GetRasterTilesCommand implements CommandHasRequest<GetRasterTilesRequest, GetRasterTilesResponse> { @Override public void execute(GetRasterTilesRequest request, GetRasterTilesResponse response) throws Exception { log.debug("request start layer {}, crs {}", request.getLayerId(), request.getCrs()); String layerId = request.getLayerId(); if (null == layerId) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "layer"); } if (null == request.getCrs()) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "crs"); } if (!securityContext.isLayerVisible(layerId)) { throw new GeomajasSecurityException(ExceptionCode.LAYER_NOT_VISIBLE, layerId, securityContext.getUserId()); } log.debug("execute() : bbox {}", request.getBbox()); List<RasterTile> images = layerService.getTiles(layerId, geoService.getCrs2(request.getCrs()), converterService.toInternal(request.getBbox()), request.getScale()); log.debug("execute() : returning {} images", images.size()); response.setRasterData(images); if (images.size() > 0) { response.setNodeId(layerId + "." + images.get(0).getCode().getTileLevel()); } }  @Override GetRasterTilesRequest getEmptyCommandRequest(); @Override GetRasterTilesResponse getEmptyCommandResponse(); @Override void execute(GetRasterTilesRequest request, GetRasterTilesResponse response);  }
@Test public void testNoLayerIdRequest() throws Exception { GetRasterTilesRequest request = new GetRasterTilesRequest(); request.setCrs(CRS); GetRasterTilesResponse response = (GetRasterTilesResponse) dispatcher.execute( GetRasterTilesRequest.COMMAND, request, null, "en"); Assert.assertTrue(response.isError()); Assert.assertTrue(response.getErrors().get(0) instanceof GeomajasException); Assert.assertEquals(ExceptionCode.PARAMETER_MISSING, ((GeomajasException) response.getErrors().get(0)).getExceptionCode()); }