@Test @Ignore("Depends on an outside resource") public void testGetFeatures() throws Exception { String id = "10"; OskariLayer layer = new OskariLayer(); layer.setId(Integer.parseInt(id)); layer.setType(OskariLayer.TYPE_WFS); layer.setUrl("https: layer.setName("tilastointialueet:kunta1000k"); CoordinateReferenceSystem webMercator = CRS.decode("EPSG:3857", true); PropertyUtil.addProperty("oskari.native.srs", "EPSG:3067", true); Envelope envelope = new Envelope(2775356, 2875356, 8441866, 8541866); ReferencedEnvelope bbox = new ReferencedEnvelope(envelope, webMercator); SimpleFeatureCollection sfc = handler.featureClient.getFeatures(id, layer, bbox, webMercator, Optional.empty()); CoordinateReferenceSystem actualCRS = sfc.getSchema().getGeometryDescriptor().getCoordinateReferenceSystem(); assertTrue(CRS.equalsIgnoreMetadata(webMercator, actualCRS)); }
private SimpleFeatureCollection getFeatures(String id, OskariLayer layer, ReferencedEnvelope bbox, CoordinateReferenceSystem targetCRS, Optional<UserLayerService> contentProcessor) throws ActionException { try { return featureClient.getFeatures(id, layer, bbox, targetCRS, contentProcessor); } catch (HystrixRuntimeException e) { if (e.getFailureType() == FailureType.SHORTCIRCUIT) { throw new ActionCommonException(ERR_SHORT_CIRCUIT); } if (e.getFailureType() == FailureType.TIMEOUT) { throw new ActionCommonException(ERR_TIMEOUT); } if (e.getCause() != null) { if (e.getCause() instanceof ServiceRuntimeException) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } } throw new ActionException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } catch (ServiceRuntimeException e) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } }
GetWFSFeaturesHandler extends AbstractWFSFeaturesHandler { private SimpleFeatureCollection getFeatures(String id, OskariLayer layer, ReferencedEnvelope bbox, CoordinateReferenceSystem targetCRS, Optional<UserLayerService> contentProcessor) throws ActionException { try { return featureClient.getFeatures(id, layer, bbox, targetCRS, contentProcessor); } catch (HystrixRuntimeException e) { if (e.getFailureType() == FailureType.SHORTCIRCUIT) { throw new ActionCommonException(ERR_SHORT_CIRCUIT); } if (e.getFailureType() == FailureType.TIMEOUT) { throw new ActionCommonException(ERR_TIMEOUT); } if (e.getCause() != null) { if (e.getCause() instanceof ServiceRuntimeException) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } } throw new ActionException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } catch (ServiceRuntimeException e) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } } }
GetWFSFeaturesHandler extends AbstractWFSFeaturesHandler { private SimpleFeatureCollection getFeatures(String id, OskariLayer layer, ReferencedEnvelope bbox, CoordinateReferenceSystem targetCRS, Optional<UserLayerService> contentProcessor) throws ActionException { try { return featureClient.getFeatures(id, layer, bbox, targetCRS, contentProcessor); } catch (HystrixRuntimeException e) { if (e.getFailureType() == FailureType.SHORTCIRCUIT) { throw new ActionCommonException(ERR_SHORT_CIRCUIT); } if (e.getFailureType() == FailureType.TIMEOUT) { throw new ActionCommonException(ERR_TIMEOUT); } if (e.getCause() != null) { if (e.getCause() instanceof ServiceRuntimeException) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } } throw new ActionException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } catch (ServiceRuntimeException e) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } }  }
GetWFSFeaturesHandler extends AbstractWFSFeaturesHandler { private SimpleFeatureCollection getFeatures(String id, OskariLayer layer, ReferencedEnvelope bbox, CoordinateReferenceSystem targetCRS, Optional<UserLayerService> contentProcessor) throws ActionException { try { return featureClient.getFeatures(id, layer, bbox, targetCRS, contentProcessor); } catch (HystrixRuntimeException e) { if (e.getFailureType() == FailureType.SHORTCIRCUIT) { throw new ActionCommonException(ERR_SHORT_CIRCUIT); } if (e.getFailureType() == FailureType.TIMEOUT) { throw new ActionCommonException(ERR_TIMEOUT); } if (e.getCause() != null) { if (e.getCause() instanceof ServiceRuntimeException) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } } throw new ActionException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } catch (ServiceRuntimeException e) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } }  @Override void handleAction(ActionParameters params); }
GetWFSFeaturesHandler extends AbstractWFSFeaturesHandler { private SimpleFeatureCollection getFeatures(String id, OskariLayer layer, ReferencedEnvelope bbox, CoordinateReferenceSystem targetCRS, Optional<UserLayerService> contentProcessor) throws ActionException { try { return featureClient.getFeatures(id, layer, bbox, targetCRS, contentProcessor); } catch (HystrixRuntimeException e) { if (e.getFailureType() == FailureType.SHORTCIRCUIT) { throw new ActionCommonException(ERR_SHORT_CIRCUIT); } if (e.getFailureType() == FailureType.TIMEOUT) { throw new ActionCommonException(ERR_TIMEOUT); } if (e.getCause() != null) { if (e.getCause() instanceof ServiceRuntimeException) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } } throw new ActionException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } catch (ServiceRuntimeException e) { throw new ActionCommonException(ERR_FAILED_TO_RETRIEVE_FEATURES, e); } }  @Override void handleAction(ActionParameters params);  }