@Test @DirtiesContext public void testExecute() throws Exception { final String host = "setparamprocessor"; requestFactory.registerHandler( input -> (("" + input.getHost()).contains(host + ".wms")) || input.getAuthority().contains(host + ".wms"), createFileHandler(uri -> { final Multimap<String, String> uppercaseParams = HashMultimap.create(); for (Map.Entry<String, String> entry: URIUtils.getParameters(uri).entries()) { uppercaseParams.put(entry.getKey().toUpperCase(), entry.getValue().toUpperCase()); } assertTrue("SERVICE != WMS: " + uppercaseParams.get("WMS"), uppercaseParams.containsEntry("SERVICE", "WMS")); assertTrue("FORMAT != IMAGE/TIFF: " + uppercaseParams.get("FORMAT"), uppercaseParams.containsEntry("FORMAT", "IMAGE/PNG")); assertTrue("REQUEST != MAP: " + uppercaseParams.get("REQUEST"), uppercaseParams.containsEntry("REQUEST", "MAP")); assertTrue("VERSION != 1.0.0: " + uppercaseParams.get("VERSION"), uppercaseParams.containsEntry("VERSION", "1.0.0")); assertTrue("LAYERS != TIGER-NY: " + uppercaseParams.get("LAYERS"), uppercaseParams.containsEntry("LAYERS", "TIGER-NY")); assertTrue("STYLES != LINE: " + uppercaseParams.get("STYLES"), uppercaseParams.containsEntry("STYLES", "LINE")); assertTrue("CUSTOMP1 != 1: " + uri, uppercaseParams.containsEntry("CUSTOMP1", "1")); assertTrue("CUSTOMP2 != 2", uppercaseParams.containsEntry("CUSTOMP2", "2")); assertTrue("BBOX is missing", uppercaseParams.containsKey("BBOX")); assertTrue("EXCEPTIONS is missing", uppercaseParams.containsKey("EXCEPTIONS")); return "/map-data/tiger-ny.png"; }) ); requestFactory.registerHandler( input -> (("" + input.getHost()).contains(host + ".json")) || input.getAuthority().contains(host + ".json"), createFileHandler(uri -> "/map-data" + uri.getPath()) ); final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config.yaml")); final Template template = config.getTemplate("main"); PJsonObject requestData = loadJsonRequestData(); Values values = new Values("test", requestData, template, getTaskDirectory(), this.requestFactory, new File(".")); forkJoinPool.invoke(template.getProcessorGraph().createTask(values)); @SuppressWarnings("unchecked") List<URI> layerGraphics = (List<URI>) values.getObject("layerGraphics", List.class); assertEquals(1, layerGraphics.size()); new ImageSimilarity(getFile(BASE_DIR + "expectedSimpleImage.png")) .assertSimilarity(layerGraphics, 630, 294, 40); }
@Override public final Void execute(final Input values, final ExecutionContext context) { for (MapLayer layer: values.map.getLayers()) { context.stopIfCanceled(); if (layer instanceof WmsLayer) { ((WmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } else if (layer instanceof TiledWmsLayer) { ((TiledWmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } } return null; }
SetWmsCustomParamProcessor extends AbstractProcessor<SetWmsCustomParamProcessor.Input, Void> { @Override public final Void execute(final Input values, final ExecutionContext context) { for (MapLayer layer: values.map.getLayers()) { context.stopIfCanceled(); if (layer instanceof WmsLayer) { ((WmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } else if (layer instanceof TiledWmsLayer) { ((TiledWmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } } return null; } }
SetWmsCustomParamProcessor extends AbstractProcessor<SetWmsCustomParamProcessor.Input, Void> { @Override public final Void execute(final Input values, final ExecutionContext context) { for (MapLayer layer: values.map.getLayers()) { context.stopIfCanceled(); if (layer instanceof WmsLayer) { ((WmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } else if (layer instanceof TiledWmsLayer) { ((TiledWmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } } return null; } protected  SetWmsCustomParamProcessor(); }
SetWmsCustomParamProcessor extends AbstractProcessor<SetWmsCustomParamProcessor.Input, Void> { @Override public final Void execute(final Input values, final ExecutionContext context) { for (MapLayer layer: values.map.getLayers()) { context.stopIfCanceled(); if (layer instanceof WmsLayer) { ((WmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } else if (layer instanceof TiledWmsLayer) { ((TiledWmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } } return null; } protected  SetWmsCustomParamProcessor(); @Override final Input createInputParameter(); @Override final Void execute(final Input values, final ExecutionContext context); final void setParamName(final String paramName); }
SetWmsCustomParamProcessor extends AbstractProcessor<SetWmsCustomParamProcessor.Input, Void> { @Override public final Void execute(final Input values, final ExecutionContext context) { for (MapLayer layer: values.map.getLayers()) { context.stopIfCanceled(); if (layer instanceof WmsLayer) { ((WmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } else if (layer instanceof TiledWmsLayer) { ((TiledWmsLayer) layer).getParams().setCustomParam(this.paramName, values.value); } } return null; } protected  SetWmsCustomParamProcessor(); @Override final Input createInputParameter(); @Override final Void execute(final Input values, final ExecutionContext context); final void setParamName(final String paramName);  }