Skip to content

Commit 436c10e

Browse files
committed
Make logging less verbose, explain the project
1 parent 79dc42a commit 436c10e

6 files changed

Lines changed: 72 additions & 5 deletions

File tree

.github/workflows/maven.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@ jobs:
2828
with:
2929
maven-version: ${{ env.MAVEN_VERSION }}
3030
- name: 'Build with Maven'
31-
run: mvn clean install
31+
run: mvn clean install -DskipTests
32+
- name: 'Run WFSGetFeatureUtilTest with Maven'
33+
run: mvn test -Dtest=WFSGetFeatureUtilTest
34+
- name: 'Run WFSGetFeatureControllerTest (Spring Boot) with Maven'
35+
run: mvn test -Dtest=WFSGetFeatureControllerTest

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# entityresolver-issues
2+
3+
Small Spring Boot 4 + GeoTools test application for reproducing and investigating WFS entity resolver behavior and
4+
related integration issues.
5+
6+
The app exposes simple REST endpoints under `/wfs` that fetch one feature from external WFS services, apply an optional
7+
CQL filter, and return feature attributes as JSON while omitting verbose geometry values.
8+
9+
## Endpoints
10+
11+
- `GET|POST /wfs/provincie` - fetches a single `bestuurlijkegebieden:Provinciegebied` feature from PDOK, filtered to
12+
`naam='Gelderland'`.
13+
- `GET|POST /wfs/bak` - fetches a single `postgis:bak` feature from the Tailormap snapshot WFS.
14+
15+
## Tests
16+
17+
All tests should pass when running eg. `mvn test` or `mvn install`.
18+
19+
### POJO (Unit) tests
20+
21+
- `WFSGetFeatureUtilTest#testWFSGetFeatureProvinciegebied` - tests the `WFSGetFeatureUtil#getOneFeature` method with the
22+
PDOK WFS service.
23+
- `WFSGetFeatureUtilTest#testWFSGetFeatureBak` - tests the `WFSGetFeatureUtil#getOneFeature` method with the Tailormap
24+
snapshot WFS service.
25+
26+
Run separately using `mvn test -Dtest=WFSGetFeatureUtilTest`.
27+
28+
### REST (Spring Boot) tests
29+
30+
- `GET /wfs/test/provincie` - is tested in `WFSGetFeatureControllerTest#getProvincieFeature`.
31+
- `GET /wfs/test/bak` - is tested in `WFSGetFeatureControllerTest#getBakFeature`.
32+
33+
Run separately using `mvn test -Dtest=WFSGetFeatureControllerTest`.
34+
35+
## Run
36+
37+
```bash
38+
./mvnw spring-boot:run
39+
```

src/main/java/nl/b3partners/entityresolverissues/WFSGetFeatureController.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
import org.springframework.web.bind.annotation.RequestMapping;
1717
import org.springframework.web.bind.annotation.RestController;
1818

19+
/**
20+
* A REST controller that gets a single feature from a WFS service using a CQL filter. The feature attributes are
21+
* returned as a JSON object, with the geometry attribute value omitted. The parameters for the WFS requests are
22+
* hardcoded.
23+
*/
1924
@RestController
2025
@RequestMapping(path = "/wfs", produces = MediaType.APPLICATION_JSON_VALUE)
2126
public class WFSGetFeatureController {
@@ -28,6 +33,13 @@ public class WFSGetFeatureController {
2833
"https://snapshot.tailormap.nl/geoserver/ows?service=WFS&acceptversions=2.0.0&request=GetCapabilities";
2934
private static final String TM_WFS_TYPE_NAME = "postgis:bak";
3035

36+
/**
37+
* get a "provincie" feature.
38+
*
39+
* @return the feature attributes as a JSON encoded map, with the geometry attribute value omitted
40+
* @throws IOException when WFS request fails
41+
* @throws CQLException when filter parsing fails
42+
*/
3143
@RequestMapping(
3244
method = {GET, POST},
3345
path = "/provincie")
@@ -41,6 +53,13 @@ public ResponseEntity<?> getProvincieFeature() throws IOException, CQLException
4153
}
4254
}
4355

56+
/**
57+
* Get a "bak" feature.
58+
*
59+
* @return the feature attributes as a JSON encoded map, with the geometry attribute value omitted
60+
* @throws IOException when WFS request fails
61+
* @throws CQLException when filter parsing fails
62+
*/
4463
@RequestMapping(
4564
method = {GET, POST},
4665
path = "/bak")

src/main/java/nl/b3partners/entityresolverissues/WFSGetFeatureUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public WFSGetFeatureUtil(String capabilitiesUrl) {
3636

3737
/**
3838
* Get 1 feature from a WFS service using the provided filter.
39-
* @param typeName the featture type name
39+
*
40+
* @param typeName the feature type name
4041
* @param cqlFilter an optional filter, may be @{code null}
4142
* @return a map of the attributes, keyed with attribute name, geometry value is omitted
4243
* @throws CQLException when filter parsing fails
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
spring.application.name=@project.artifactId@
2-
debug=true
2+
#debug=true
33

44
server.address=0.0.0.0
55
server.http2.enabled=true
66

77
logging.file.name=target/entityresolver-issues.log
88
logging.include-application-name=false
99

10-
# log all GeoTools
1110
logging.level.org.geotools=DEBUG
11+
logging.level.org.geotools.data.util=INFO
12+
logging.level.org.geotools.referencing.factory=WARN
13+
logging.level.org.geotools.factory=WARN
14+
logging.level.org.geotools.util.factory=WARN
15+
logging.level.org.geotools.referencing=WARN
1216
logging.level.nl.b3partners.entityresolverissues=DEBUG

src/test/java/nl/b3partners/entityresolverissues/WFSGetFeatureUtilIntegrationTest.java renamed to src/test/java/nl/b3partners/entityresolverissues/WFSGetFeatureUtilTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.slf4j.Logger;
1818
import org.slf4j.LoggerFactory;
1919

20-
public class WFSGetFeatureUtilIntegrationTest {
20+
public class WFSGetFeatureUtilTest {
2121
private static final Logger logger =
2222
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
2323

0 commit comments

Comments
 (0)