@Test public void integrationTest() throws GeomajasException { WfsGetCapabilitiesRequest request = new WfsGetCapabilitiesRequest("http: WfsGetCapabilitiesResponse response = new WfsGetCapabilitiesResponse(); command.execute(request, response); List<WfsFeatureTypeInfo> featureTypes = response.getGetCapabilitiesDto().getFeatureTypeList().getFeatureTypes(); Assert.assertEquals(7, featureTypes.size()); WfsFeatureTypeInfo type = featureTypes.get(0); Assert.assertEquals("dov-pub-bodem:Bodemkundig_erfgoed", type.getName()); Assert.assertEquals("! URL gewijzigd. Bodemkundig erfgoed", type.getTitle()); Assert.assertEquals("Nieuwe URL: http: Assert.assertEquals("EPSG:31370", type.getDefaultCrs()); Assert.assertEquals(Arrays.asList("Soil", "bodem"), type.getKeywords()); Assert.assertTrue(BboxService.equals(new Bbox(2.534012015078217, 50.694051222131925, 3.14929925489, 0.67934318463), type.getWGS84BoundingBox(), 0.00001)); }
@Override public void execute(WfsGetCapabilitiesRequest request, WfsGetCapabilitiesResponse response) throws GeomajasException { try { String sourceUrl = request.getBaseUrl(); URL targetUrl = httpClientFactory.getTargetUrl(sourceUrl); URL url = URLBuilder.createWfsURL(targetUrl, request.getVersion(), "GetCapabilities"); String capa = url.toExternalForm(); Map<String, Serializable> connectionParameters = new HashMap<String, Serializable>(); connectionParameters.put(WFSDataStoreFactory.URL.key, capa); connectionParameters.put(WFSDataStoreFactory.TIMEOUT.key, 10000); if (request.getStrategy() != null) { connectionParameters.put(WFSDataStoreFactory.WFS_STRATEGY.key, request.getStrategy()); } WFSDataStore wfs = dataStoreFactory.createDataStore(connectionParameters, httpClientFactory.create(sourceUrl)); WfsFeatureTypeListDto wfsFeatureTypeListDto = null; String vs = wfs.getWfsClient().getInfo().getVersion(); WfsVersion version = WfsVersion.fromString(vs); switch (version) { case V1_0_0: case V1_1_0: wfsFeatureTypeListDto = create1xxFeatureTypeList(wfs); break; case V2_0_0: default: wfsFeatureTypeListDto = create200FeatureTypeList(wfs); break; } WfsGetCapabilitiesDto getCapabilitiesDto = new WfsGetCapabilitiesDto(wfsFeatureTypeListDto); response.setGetCapabilitiesDto(getCapabilitiesDto); } catch (Exception e) { log.error("GetCapabilities failed for " + request.getBaseUrl(), e); throw new GeomajasException(ExceptionCode.UNEXPECTED_PROBLEM, e.getMessage()); } }
WfsGetCapabilitiesCommand implements
		CommandHasRequest<WfsGetCapabilitiesRequest, WfsGetCapabilitiesResponse> { @Override public void execute(WfsGetCapabilitiesRequest request, WfsGetCapabilitiesResponse response) throws GeomajasException { try { String sourceUrl = request.getBaseUrl(); URL targetUrl = httpClientFactory.getTargetUrl(sourceUrl); URL url = URLBuilder.createWfsURL(targetUrl, request.getVersion(), "GetCapabilities"); String capa = url.toExternalForm(); Map<String, Serializable> connectionParameters = new HashMap<String, Serializable>(); connectionParameters.put(WFSDataStoreFactory.URL.key, capa); connectionParameters.put(WFSDataStoreFactory.TIMEOUT.key, 10000); if (request.getStrategy() != null) { connectionParameters.put(WFSDataStoreFactory.WFS_STRATEGY.key, request.getStrategy()); } WFSDataStore wfs = dataStoreFactory.createDataStore(connectionParameters, httpClientFactory.create(sourceUrl)); WfsFeatureTypeListDto wfsFeatureTypeListDto = null; String vs = wfs.getWfsClient().getInfo().getVersion(); WfsVersion version = WfsVersion.fromString(vs); switch (version) { case V1_0_0: case V1_1_0: wfsFeatureTypeListDto = create1xxFeatureTypeList(wfs); break; case V2_0_0: default: wfsFeatureTypeListDto = create200FeatureTypeList(wfs); break; } WfsGetCapabilitiesDto getCapabilitiesDto = new WfsGetCapabilitiesDto(wfsFeatureTypeListDto); response.setGetCapabilitiesDto(getCapabilitiesDto); } catch (Exception e) { log.error("GetCapabilities failed for " + request.getBaseUrl(), e); throw new GeomajasException(ExceptionCode.UNEXPECTED_PROBLEM, e.getMessage()); } } }
WfsGetCapabilitiesCommand implements
		CommandHasRequest<WfsGetCapabilitiesRequest, WfsGetCapabilitiesResponse> { @Override public void execute(WfsGetCapabilitiesRequest request, WfsGetCapabilitiesResponse response) throws GeomajasException { try { String sourceUrl = request.getBaseUrl(); URL targetUrl = httpClientFactory.getTargetUrl(sourceUrl); URL url = URLBuilder.createWfsURL(targetUrl, request.getVersion(), "GetCapabilities"); String capa = url.toExternalForm(); Map<String, Serializable> connectionParameters = new HashMap<String, Serializable>(); connectionParameters.put(WFSDataStoreFactory.URL.key, capa); connectionParameters.put(WFSDataStoreFactory.TIMEOUT.key, 10000); if (request.getStrategy() != null) { connectionParameters.put(WFSDataStoreFactory.WFS_STRATEGY.key, request.getStrategy()); } WFSDataStore wfs = dataStoreFactory.createDataStore(connectionParameters, httpClientFactory.create(sourceUrl)); WfsFeatureTypeListDto wfsFeatureTypeListDto = null; String vs = wfs.getWfsClient().getInfo().getVersion(); WfsVersion version = WfsVersion.fromString(vs); switch (version) { case V1_0_0: case V1_1_0: wfsFeatureTypeListDto = create1xxFeatureTypeList(wfs); break; case V2_0_0: default: wfsFeatureTypeListDto = create200FeatureTypeList(wfs); break; } WfsGetCapabilitiesDto getCapabilitiesDto = new WfsGetCapabilitiesDto(wfsFeatureTypeListDto); response.setGetCapabilitiesDto(getCapabilitiesDto); } catch (Exception e) { log.error("GetCapabilities failed for " + request.getBaseUrl(), e); throw new GeomajasException(ExceptionCode.UNEXPECTED_PROBLEM, e.getMessage()); } } WfsGetCapabilitiesCommand(); }
WfsGetCapabilitiesCommand implements
		CommandHasRequest<WfsGetCapabilitiesRequest, WfsGetCapabilitiesResponse> { @Override public void execute(WfsGetCapabilitiesRequest request, WfsGetCapabilitiesResponse response) throws GeomajasException { try { String sourceUrl = request.getBaseUrl(); URL targetUrl = httpClientFactory.getTargetUrl(sourceUrl); URL url = URLBuilder.createWfsURL(targetUrl, request.getVersion(), "GetCapabilities"); String capa = url.toExternalForm(); Map<String, Serializable> connectionParameters = new HashMap<String, Serializable>(); connectionParameters.put(WFSDataStoreFactory.URL.key, capa); connectionParameters.put(WFSDataStoreFactory.TIMEOUT.key, 10000); if (request.getStrategy() != null) { connectionParameters.put(WFSDataStoreFactory.WFS_STRATEGY.key, request.getStrategy()); } WFSDataStore wfs = dataStoreFactory.createDataStore(connectionParameters, httpClientFactory.create(sourceUrl)); WfsFeatureTypeListDto wfsFeatureTypeListDto = null; String vs = wfs.getWfsClient().getInfo().getVersion(); WfsVersion version = WfsVersion.fromString(vs); switch (version) { case V1_0_0: case V1_1_0: wfsFeatureTypeListDto = create1xxFeatureTypeList(wfs); break; case V2_0_0: default: wfsFeatureTypeListDto = create200FeatureTypeList(wfs); break; } WfsGetCapabilitiesDto getCapabilitiesDto = new WfsGetCapabilitiesDto(wfsFeatureTypeListDto); response.setGetCapabilitiesDto(getCapabilitiesDto); } catch (Exception e) { log.error("GetCapabilities failed for " + request.getBaseUrl(), e); throw new GeomajasException(ExceptionCode.UNEXPECTED_PROBLEM, e.getMessage()); } } WfsGetCapabilitiesCommand(); void setDataStoreFactory(WfsDataStoreFactory dataStoreFactory); void setHttpClientFactory(WfsHttpClientFactory httpClientFactory); @Override void execute(WfsGetCapabilitiesRequest request, WfsGetCapabilitiesResponse response); @Override WfsGetCapabilitiesRequest getEmptyCommandRequest(); @Override WfsGetCapabilitiesResponse getEmptyCommandResponse(); }
WfsGetCapabilitiesCommand implements
		CommandHasRequest<WfsGetCapabilitiesRequest, WfsGetCapabilitiesResponse> { @Override public void execute(WfsGetCapabilitiesRequest request, WfsGetCapabilitiesResponse response) throws GeomajasException { try { String sourceUrl = request.getBaseUrl(); URL targetUrl = httpClientFactory.getTargetUrl(sourceUrl); URL url = URLBuilder.createWfsURL(targetUrl, request.getVersion(), "GetCapabilities"); String capa = url.toExternalForm(); Map<String, Serializable> connectionParameters = new HashMap<String, Serializable>(); connectionParameters.put(WFSDataStoreFactory.URL.key, capa); connectionParameters.put(WFSDataStoreFactory.TIMEOUT.key, 10000); if (request.getStrategy() != null) { connectionParameters.put(WFSDataStoreFactory.WFS_STRATEGY.key, request.getStrategy()); } WFSDataStore wfs = dataStoreFactory.createDataStore(connectionParameters, httpClientFactory.create(sourceUrl)); WfsFeatureTypeListDto wfsFeatureTypeListDto = null; String vs = wfs.getWfsClient().getInfo().getVersion(); WfsVersion version = WfsVersion.fromString(vs); switch (version) { case V1_0_0: case V1_1_0: wfsFeatureTypeListDto = create1xxFeatureTypeList(wfs); break; case V2_0_0: default: wfsFeatureTypeListDto = create200FeatureTypeList(wfs); break; } WfsGetCapabilitiesDto getCapabilitiesDto = new WfsGetCapabilitiesDto(wfsFeatureTypeListDto); response.setGetCapabilitiesDto(getCapabilitiesDto); } catch (Exception e) { log.error("GetCapabilities failed for " + request.getBaseUrl(), e); throw new GeomajasException(ExceptionCode.UNEXPECTED_PROBLEM, e.getMessage()); } } WfsGetCapabilitiesCommand(); void setDataStoreFactory(WfsDataStoreFactory dataStoreFactory); void setHttpClientFactory(WfsHttpClientFactory httpClientFactory); @Override void execute(WfsGetCapabilitiesRequest request, WfsGetCapabilitiesResponse response); @Override WfsGetCapabilitiesRequest getEmptyCommandRequest(); @Override WfsGetCapabilitiesResponse getEmptyCommandResponse();  }