Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1261 from ridethepenguin/backport-2.8.x-app-schem…
…a-layer-preview [GEOS-7226] Default GML links in Layer Preview page do not work for app-schema layers
- Loading branch information
Showing
8 changed files
with
353 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...hema/app-schema-test/src/test/java/org/geoserver/test/web/AbstractMapPreviewPageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* (c) 2015 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
*/ | ||
|
||
package org.geoserver.test.web; | ||
|
||
import static org.junit.Assert.assertArrayEquals; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.apache.wicket.markup.html.link.ExternalLink; | ||
import org.apache.wicket.markup.repeater.data.DataView; | ||
import org.geoserver.web.GeoServerWicketTestSupport; | ||
import org.geoserver.web.demo.MapPreviewPage; | ||
|
||
public class AbstractMapPreviewPageTest extends GeoServerWicketTestSupport { | ||
|
||
protected List<String> EXPECTED_GML_LINKS = new ArrayList<String>(); | ||
|
||
protected AbstractMapPreviewPageTest(List<String> expectedGmlLinks) { | ||
this.EXPECTED_GML_LINKS = expectedGmlLinks; | ||
} | ||
|
||
public void testAppSchemaGmlLinks() { | ||
tester.startPage(MapPreviewPage.class); | ||
tester.assertRenderedPage(MapPreviewPage.class); | ||
|
||
DataView items = (DataView) tester.getComponentFromLastRenderedPage("table:listContainer:items"); | ||
assertNotNull(items); | ||
assertEquals(EXPECTED_GML_LINKS.size(), items.size()); | ||
|
||
// collect GML links model objects | ||
List<String> gmlLinks = new ArrayList<String>(); | ||
for (int i=1; i<=EXPECTED_GML_LINKS.size(); i++) { | ||
ExternalLink gmlLink = (ExternalLink) items.get(i + ":itemProperties:3:component:gml"); | ||
assertNotNull(gmlLink); | ||
gmlLinks.add(gmlLink.getDefaultModelObjectAsString()); | ||
} | ||
|
||
Collections.sort(EXPECTED_GML_LINKS); | ||
Collections.sort(gmlLinks); | ||
// check the two lists match | ||
assertArrayEquals(EXPECTED_GML_LINKS.toArray(new String[] {}), gmlLinks.toArray(new String[] {})); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...sion/app-schema/app-schema-test/src/test/java/org/geoserver/test/web/Gml311LinksTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* (c) 2015 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
*/ | ||
|
||
package org.geoserver.test.web; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.geoserver.data.test.SystemTestData; | ||
import org.geoserver.test.FeatureChainingMockData; | ||
import org.junit.Test; | ||
|
||
public class Gml311LinksTest extends AbstractMapPreviewPageTest { | ||
|
||
public Gml311LinksTest() { | ||
super(Arrays.asList("../ows?service=WFS&version=1.1.0&request=GetFeature&typeName=gsml:MappedFeature&outputFormat=gml3&maxFeatures=50", | ||
"../ows?service=WFS&version=1.1.0&request=GetFeature&typeName=gsml:GeologicUnit&outputFormat=gml3&maxFeatures=50", | ||
"../ows?service=WFS&version=1.1.0&request=GetFeature&typeName=ex:FirstParentFeature&outputFormat=gml3&maxFeatures=50", | ||
"../ows?service=WFS&version=1.1.0&request=GetFeature&typeName=ex:SecondParentFeature&outputFormat=gml3&maxFeatures=50", | ||
"../ows?service=WFS&version=1.1.0&request=GetFeature&typeName=om:Observation&outputFormat=gml3&maxFeatures=50")); | ||
} | ||
|
||
@Override | ||
protected SystemTestData createTestData() throws Exception { | ||
return new FeatureChainingMockData(); | ||
} | ||
|
||
@Test | ||
public void testGml311Links() { | ||
super.testAppSchemaGmlLinks(); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...nsion/app-schema/app-schema-test/src/test/java/org/geoserver/test/web/Gml32LinksTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* (c) 2015 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
*/ | ||
|
||
package org.geoserver.test.web; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.geoserver.data.test.SystemTestData; | ||
import org.geoserver.test.Gsml30MockData; | ||
import org.junit.Test; | ||
|
||
public class Gml32LinksTest extends AbstractMapPreviewPageTest { | ||
|
||
public Gml32LinksTest() { | ||
super(Arrays.asList("../ows?service=WFS&version=1.1.0&request=GetFeature&typeName=gsml:MappedFeature&outputFormat=gml32&maxFeatures=50")); | ||
} | ||
|
||
@Override | ||
protected SystemTestData createTestData() throws Exception { | ||
return new Gsml30MockData(); | ||
} | ||
|
||
@Test | ||
public void testGml32Links() { | ||
super.testAppSchemaGmlLinks(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.