Skip to content

Commit

Permalink
fixed test issues and added null check for getfeature
Browse files Browse the repository at this point in the history
  • Loading branch information
turingtestfail committed Feb 25, 2025
1 parent 35bdbb3 commit 30e3eea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,6 @@ public static Mapml featureCollectionToMapML(
}
boolean useTileLinks = false;
if (featureCollectionInfoSimplifier.getLayerInfo() != null) {
if (useTiles(getMapRequest)) {
String crs = extractCRS(getMapRequest.getRawKvp());
useTileLinks = gwc.hasTileLayer(featureCollectionInfoSimplifier.getLayerInfo())
&& gwc.getTileLayer(featureCollectionInfoSimplifier.getLayerInfo())
.getGridSubset(crs)
!= null;
}
MapMLGenerator featureBuilder = new MapMLGenerator();
featureBuilder.setNumDecimals(featureCollectionInfoSimplifier.getNumDecimals());
featureBuilder.setForcedDecimal(featureCollectionInfoSimplifier.isForcedDecimal());
Expand Down Expand Up @@ -250,7 +243,7 @@ public static Mapml featureCollectionToMapML(
}
}
} else if (featureCollectionInfoSimplifier.getCoverageInfo() != null && request != null) {
if (useTiles(getMapRequest)) {
if (getMapRequest != null && useTiles(getMapRequest)) {
String crs = extractCRS(getMapRequest.getRawKvp());
useTileLinks = gwc.hasTileLayer(featureCollectionInfoSimplifier.getCoverageInfo())
&& gwc.getTileLayer(featureCollectionInfoSimplifier.getCoverageInfo())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected void onSetUp(SystemTestData testData) throws Exception {
catalog.add(lg);

LayerGroupInfo lgWithRaster = catalog.getFactory().createLayerGroup();
lgWithRaster.setName("layerGroupWithRaster");
lgWithRaster.setName("layerGroupWithRaster2");
lgWithRaster.getLayers().add(catalog.getLayerByName(basicPolygons));
lgWithRaster.getLayers().add(catalog.getLayerByName(world));
builder.calculateLayerGroupBounds(lgWithRaster, DefaultGeographicCRS.WGS84);
Expand Down Expand Up @@ -157,7 +157,7 @@ public void testMapMLUseFeatures() throws Exception {
public void testMapMLUseFeaturesLayerGroupRaster() throws Exception {

Mapml mapmlFeatures = new MapMLWMSRequest()
.name("layerGroupWithRaster")
.name("layerGroupWithRaster2")
.bbox("-180,-90,180,90")
.srs("EPSG:4326")
.feature(true)
Expand All @@ -170,7 +170,7 @@ public void testMapMLUseFeaturesLayerGroupRaster() throws Exception {
assertEquals("0.0,-90.0,180.0,90.0", request2.getParameter("BBOX"));

Mapml mapmlFeatures2 = new MapMLWMSRequest()
.name("layerGroupWithRaster")
.name("layerGroupWithRaster2")
.bbox("-89,-44,-87,-42")
.srs("EPSG:4326")
.feature(true)
Expand All @@ -192,7 +192,7 @@ public void testUseFeaturesRasterTileCache() throws Exception {
Catalog cat = getCatalog();
enableTileCaching(MockData.WORLD, cat);
Mapml mapmlFeatures3 = new MapMLWMSRequest()
.name("layerGroupWithRaster")
.name("layerGroupWithRaster2")
.bbox("-89,-44,-87,-42")
.srs("EPSG:4326")
.feature(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ public void testLayerGroupGetFeatureInfoMapML() throws Exception {
requestResponse.response.getContentAsString().getBytes()),
true);
// check that each of the layers in the group is represented as a feature
assertXpathEvaluatesTo("3", "count(//html:map-feature)", doc);
assertXpathEvaluatesTo("2", "count(//html:map-feature)", doc);
}

private static HashMap<String, String> getRequestVars(String world, String bbox, String srs) {
Expand Down

0 comments on commit 30e3eea

Please sign in to comment.