Skip to content

Commit

Permalink
tests updated without xml escape
Browse files Browse the repository at this point in the history
  • Loading branch information
turingtestfail committed Jul 3, 2024
1 parent 7025e70 commit 933f898
Showing 1 changed file with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.geoserver.mapml.xml.MultiPolygon;
import org.geoserver.mapml.xml.Point;
import org.geoserver.mapml.xml.Polygon;
import org.geoserver.mapml.xml.Span;
import org.geoserver.wms.GetMapRequest;
import org.geoserver.wms.MapLayerInfo;
import org.geoserver.wms.WMSMapContent;
Expand Down Expand Up @@ -367,7 +368,7 @@ public void testMapMLFeaturePointHasClass() throws Exception {
+ " <map-geometry>"
+ " <map-point>"
+ " <map-coordinates><#list gattribute.rawValue.coordinates as coord>"
+ " <#if coord?index == 0><![CDATA[<map-span class=\"desired\">]]>${coord.x} ${coord.y}<![CDATA[</map-span>]]><#else>${coord.x} ${coord.y}</#if></#list></map-coordinates></map-point>"
+ " <#if coord?index == 0><map-span class=\"desired\">${coord.x} ${coord.y}</map-span><#else>${coord.x} ${coord.y}</#if></#list></map-coordinates></map-point>"
+ " </map-geometry>"
+ " </#if>\n"
+ " </#list>\n"
Expand All @@ -389,8 +390,8 @@ public void testMapMLFeaturePointHasClass() throws Exception {
.getFeatures()
.get(0); // get the second feature, which has a class
Point featurePoint = (Point) feature2.getGeometry().getGeometryContent().getValue();
String coords = featurePoint.getCoordinates().get(0).getCoordinates().get(0).toString();
assertTrue(coords.contains("<map-span class=\"desired\">"));
Span span = ((Span) featurePoint.getCoordinates().get(0).getCoordinates().get(0));
assertEquals("desired", span.getClazz());
} finally {
if (template != null) {
template.delete();
Expand Down Expand Up @@ -421,7 +422,7 @@ public void testMapMLFeatureLineHasClass() throws Exception {
+ "<map-feature>\n"
+ " <#list attributes as attribute>\n"
+ " <#if attribute.isGeometry>\n"
+ " <map-geometry><map-linestring><map-coordinates><#list attribute.rawValue.coordinates as coord><#if coord?index == 3> <![CDATA[<map-span class=\"desired\">]]>${coord.x} ${coord.y}<#elseif coord?index == 4>${coord.x} ${coord.y}<![CDATA[</map-span>]]><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates></map-linestring></map-geometry>\n"
+ " <map-geometry><map-linestring><map-coordinates><#list attribute.rawValue.coordinates as coord><#if coord?index == 3> <map-span class=\"desired\">${coord.x} ${coord.y}</map-span><#elseif coord?index == 4>${coord.x} ${coord.y}</map-span><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates></map-linestring></map-geometry>\n"
+ " </#if>\n"
+ " </#list>\n"
+ "</map-feature>\n"
Expand All @@ -443,8 +444,8 @@ public void testMapMLFeatureLineHasClass() throws Exception {
.get(0); // get the second feature, which has a class
LineString featureLine =
(LineString) feature2.getGeometry().getGeometryContent().getValue();
String coords = featureLine.getCoordinates().get(0).getCoordinates().get(0).toString();
assertTrue(coords.contains("<map-span class=\"desired\">"));
Span span = (Span) featureLine.getCoordinates().get(0).getCoordinates().get(1);
assertEquals("desired", span.getClazz());
} finally {
if (template != null) {
template.delete();
Expand Down Expand Up @@ -477,9 +478,9 @@ public void testMapMLFeaturePolygonHasClass() throws Exception {
+ " <#if attribute.isGeometry>\n"
+ " <map-geometry>\n"
+ " <map-polygon>"
+ " <#assign shell = attribute.rawValue.getExteriorRing()><map-coordinates><#list shell.coordinates as coord><#if coord?index == 0><![CDATA[<map-span class=\"desired\">]]>${coord.x} ${coord.y}<#elseif coord?index == 4> ${coord.x} ${coord.y}<![CDATA[</map-span>]]><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates>"
+ " <#assign shell = attribute.rawValue.getExteriorRing()><map-coordinates><#list shell.coordinates as coord><#if coord?index == 0><map-span class=\"desired\">${coord.x} ${coord.y}<#elseif coord?index == 4> ${coord.x} ${coord.y}</map-span><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates>"
+ " <#list 0 ..< attribute.rawValue.getNumInteriorRing() as index>"
+ " <#assign hole = attribute.rawValue.getInteriorRingN(index)><map-coordinates><#list hole.coordinates as coord><#if coord?index == 0><![CDATA[<map-span class=\"desired\">]]>${coord.x} ${coord.y} <#elseif coord?index == 4> ${coord.x} ${coord.y}<![CDATA[</map-span>]]><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates></#list>"
+ " <#assign hole = attribute.rawValue.getInteriorRingN(index)><map-coordinates><#list hole.coordinates as coord><#if coord?index == 0><map-span class=\"desired\">${coord.x} ${coord.y} <#elseif coord?index == 4> ${coord.x} ${coord.y}</map-span><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates></#list>"
+ " </map-polygon>"
+ " </map-geometry>\n"
+ " </#if>\n"
Expand All @@ -503,14 +504,14 @@ public void testMapMLFeaturePolygonHasClass() throws Exception {
.get(0); // get the second feature, which has a class
Polygon featurePolygon =
(Polygon) feature2.getGeometry().getGeometryContent().getValue();
String coords =
featurePolygon
.getThreeOrMoreCoordinatePairs()
.get(0)
.getCoordinates()
.get(0)
.toString();
assertTrue(coords.contains("<map-span class=\"desired\">"));
Span span =
(Span)
featurePolygon
.getThreeOrMoreCoordinatePairs()
.get(0)
.getCoordinates()
.get(0);
assertEquals("desired", span.getClazz());
} finally {
if (template != null) {
template.delete();
Expand Down Expand Up @@ -547,9 +548,9 @@ public void testMapMLFeatureMultiPolygonHasClass() throws Exception {
+ " <#list 0 ..< attribute.rawValue.getNumGeometries() as index>"
+ " <#assign polygon = attribute.rawValue.getGeometryN(index)>"
+ " <map-polygon>"
+ " <#assign shell = polygon.getExteriorRing()><map-coordinates><#list shell.coordinates as coord><#if coord?index == 0><![CDATA[<map-span class=\"desired\">]]>${coord.x} ${coord.y}<#elseif coord?index == 4> ${coord.x} ${coord.y}<![CDATA[</map-span>]]><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates>"
+ " <#assign shell = polygon.getExteriorRing()><map-coordinates><#list shell.coordinates as coord><#if coord?index == 0><map-span class=\"desired\">${coord.x} ${coord.y}<#elseif coord?index == 4> ${coord.x} ${coord.y}</map-span><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates>"
+ " <#list 0 ..< polygon.getNumInteriorRing() as index>"
+ " <#assign hole = polygon.getInteriorRingN(index)><map-coordinates><#list hole.coordinates as coord><#if coord?index == 0><![CDATA[<map-span class=\"desired\">]]>${coord.x} ${coord.y} <#elseif coord?index == 4> ${coord.x} ${coord.y}<![CDATA[</map-span>]]><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates></#list>"
+ " <#assign hole = polygon.getInteriorRingN(index)><map-coordinates><#list hole.coordinates as coord><#if coord?index == 0><map-span class=\"desired\">${coord.x} ${coord.y} <#elseif coord?index == 4> ${coord.x} ${coord.y}</map-span><#else> ${coord.x} ${coord.y}</#if></#list></map-coordinates></#list>"
+ " </map-polygon>"
+ " </#list>"
+ " </map-multipolygon>"
Expand Down Expand Up @@ -593,16 +594,16 @@ public void testMapMLFeatureMultiPolygonHasClass() throws Exception {
.get(0); // get the first feature, which has a class
MultiPolygon featureMultiPolygon =
(MultiPolygon) feature2.getGeometry().getGeometryContent().getValue();
String coords =
featureMultiPolygon
.getPolygon()
.get(0)
.getThreeOrMoreCoordinatePairs()
.get(0)
.getCoordinates()
.get(0)
.toString();
assertTrue(coords.contains("<map-span class=\"desired\">"));
Span span =
(Span)
featureMultiPolygon
.getPolygon()
.get(0)
.getThreeOrMoreCoordinatePairs()
.get(0)
.getCoordinates()
.get(0);
assertEquals("desired", span.getClazz());
} finally {
if (template != null) {
template.delete();
Expand Down

0 comments on commit 933f898

Please sign in to comment.