@Test public void testGetRemoteFeatureType() throws Exception { DescribeFeatureTypeRequest req = mock(DescribeFeatureTypeRequest.class); when(wfs.createDescribeFeatureTypeRequest()).thenReturn(req); DescribeFeatureTypeResponse resp = mock(DescribeFeatureTypeResponse.class); when(wfs.issueRequest(same(req))).thenReturn(resp); when(resp.getFeatureType()).thenReturn(featureType2); dataStore = spy(new WFSDataStore(wfs)); assertSame(featureType2, dataStore.getRemoteSimpleFeatureType(TYPE2)); verify(req).setTypeName(eq(TYPE2)); when(wfs.issueRequest(same(req))).thenThrow(new IOException()); try { QName badName = new QName(TYPE1.getNamespaceURI(), TYPE1.getLocalPart() + "2"); dataStore.getRemoteSimpleFeatureType(badName); fail("Expected IOE"); } catch (IOException e) { assertTrue(true); } }
public FeatureType getRemoteFeatureType(final QName remoteTypeName) throws IOException { FeatureType remoteFeatureType; final String lockObj = remoteTypeName.toString().intern(); synchronized (lockObj) { remoteFeatureType = remoteFeatureTypes.get(remoteTypeName); if (remoteFeatureType == null) { DescribeFeatureTypeRequest request = client.createDescribeFeatureTypeRequest(); request.setTypeName(remoteTypeName); DescribeFeatureTypeResponse response = client.issueRequest(request); remoteFeatureType = response.getFeatureType(); remoteFeatureTypes.put(remoteTypeName, remoteFeatureType); } } return remoteFeatureType; }
WFSDataStore extends ContentDataStore { public FeatureType getRemoteFeatureType(final QName remoteTypeName) throws IOException { FeatureType remoteFeatureType; final String lockObj = remoteTypeName.toString().intern(); synchronized (lockObj) { remoteFeatureType = remoteFeatureTypes.get(remoteTypeName); if (remoteFeatureType == null) { DescribeFeatureTypeRequest request = client.createDescribeFeatureTypeRequest(); request.setTypeName(remoteTypeName); DescribeFeatureTypeResponse response = client.issueRequest(request); remoteFeatureType = response.getFeatureType(); remoteFeatureTypes.put(remoteTypeName, remoteFeatureType); } } return remoteFeatureType; } }
WFSDataStore extends ContentDataStore { public FeatureType getRemoteFeatureType(final QName remoteTypeName) throws IOException { FeatureType remoteFeatureType; final String lockObj = remoteTypeName.toString().intern(); synchronized (lockObj) { remoteFeatureType = remoteFeatureTypes.get(remoteTypeName); if (remoteFeatureType == null) { DescribeFeatureTypeRequest request = client.createDescribeFeatureTypeRequest(); request.setTypeName(remoteTypeName); DescribeFeatureTypeResponse response = client.issueRequest(request); remoteFeatureType = response.getFeatureType(); remoteFeatureTypes.put(remoteTypeName, remoteFeatureType); } } return remoteFeatureType; } WFSDataStore(final WFSClient client); }
WFSDataStore extends ContentDataStore { public FeatureType getRemoteFeatureType(final QName remoteTypeName) throws IOException { FeatureType remoteFeatureType; final String lockObj = remoteTypeName.toString().intern(); synchronized (lockObj) { remoteFeatureType = remoteFeatureTypes.get(remoteTypeName); if (remoteFeatureType == null) { DescribeFeatureTypeRequest request = client.createDescribeFeatureTypeRequest(); request.setTypeName(remoteTypeName); DescribeFeatureTypeResponse response = client.issueRequest(request); remoteFeatureType = response.getFeatureType(); remoteFeatureTypes.put(remoteTypeName, remoteFeatureType); } } return remoteFeatureType; } WFSDataStore(final WFSClient client); @Override WFSServiceInfo getInfo(); QName getRemoteTypeName(Name localTypeName); ListStoredQueriesResponseType getStoredQueryListResponse(); boolean supportsStoredQueries(); FeatureType getRemoteFeatureType(final QName remoteTypeName); StoredQueryDescriptionType getStoredQueryDescriptionType(String storedQueryId); SimpleFeatureType getRemoteSimpleFeatureType(final QName remoteTypeName); WFSClient getWfsClient(); Name addStoredQuery(String localName, String storedQueryId); QName getStoredQueryReturnType(String storedQueryId); SimpleFeatureType getStoredQuerySchema(String storedQueryId); Map<String, String> getConfiguredStoredQueries(); void removeStoredQuery(String localName); URL getCapabilitiesURL(); }
WFSDataStore extends ContentDataStore { public FeatureType getRemoteFeatureType(final QName remoteTypeName) throws IOException { FeatureType remoteFeatureType; final String lockObj = remoteTypeName.toString().intern(); synchronized (lockObj) { remoteFeatureType = remoteFeatureTypes.get(remoteTypeName); if (remoteFeatureType == null) { DescribeFeatureTypeRequest request = client.createDescribeFeatureTypeRequest(); request.setTypeName(remoteTypeName); DescribeFeatureTypeResponse response = client.issueRequest(request); remoteFeatureType = response.getFeatureType(); remoteFeatureTypes.put(remoteTypeName, remoteFeatureType); } } return remoteFeatureType; } WFSDataStore(final WFSClient client); @Override WFSServiceInfo getInfo(); QName getRemoteTypeName(Name localTypeName); ListStoredQueriesResponseType getStoredQueryListResponse(); boolean supportsStoredQueries(); FeatureType getRemoteFeatureType(final QName remoteTypeName); StoredQueryDescriptionType getStoredQueryDescriptionType(String storedQueryId); SimpleFeatureType getRemoteSimpleFeatureType(final QName remoteTypeName); WFSClient getWfsClient(); Name addStoredQuery(String localName, String storedQueryId); QName getStoredQueryReturnType(String storedQueryId); SimpleFeatureType getStoredQuerySchema(String storedQueryId); Map<String, String> getConfiguredStoredQueries(); void removeStoredQuery(String localName); URL getCapabilitiesURL(); static final String STORED_QUERY_CONFIGURATION_HINT; }