Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding a way to remove a layer to clean up after tests adding new ones

  • Loading branch information...
commit 915ca0525e3ac92c85d847f370c5501fc35dd9fd 1 parent f882f8d
@aaime aaime authored
View
22 src/main/src/test/java/org/geoserver/test/GeoServerSpringTestSupport.java
@@ -1,6 +1,7 @@
package org.geoserver.test;
-import static junit.framework.Assert.*;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.fail;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -46,16 +47,18 @@
import org.apache.xml.serialize.XMLSerializer;
import org.geoserver.catalog.CascadeDeleteVisitor;
import org.geoserver.catalog.Catalog;
+import org.geoserver.catalog.CoverageInfo;
import org.geoserver.catalog.FeatureTypeInfo;
import org.geoserver.catalog.LayerGroupInfo;
+import org.geoserver.catalog.LayerInfo;
import org.geoserver.catalog.NamespaceInfo;
+import org.geoserver.catalog.ResourceInfo;
import org.geoserver.catalog.StoreInfo;
import org.geoserver.catalog.StyleInfo;
import org.geoserver.catalog.WorkspaceInfo;
import org.geoserver.config.GeoServer;
import org.geoserver.config.GeoServerDataDirectory;
import org.geoserver.config.GeoServerLoaderProxy;
-import org.geoserver.data.test.SystemTestData;
import org.geoserver.data.test.TestData;
import org.geoserver.logging.LoggingUtils;
import org.geoserver.ows.util.CaseInsensitiveMap;
@@ -448,6 +451,21 @@ protected void removeStore(String workspaceName, String name) {
CascadeDeleteVisitor v = new CascadeDeleteVisitor(getCatalog());
store.accept(v);
}
+
+ protected void removeLayer(String workspaceName, String name) {
+ Catalog cat = getCatalog();
+ ResourceInfo resource = cat.getResourceByName(workspaceName, name, ResourceInfo.class);
+ if (resource == null) {
+ return;
+ }
+ CascadeDeleteVisitor v = new CascadeDeleteVisitor(getCatalog());
+ for (LayerInfo layer : cat.getLayers()) {
+ if(resource.equals(layer.getResource())) {
+ layer.accept(v);
+ }
+ }
+
+ }
protected void removeStyle(String workspaceName, String name) throws IOException {
Catalog cat = getCatalog();
View
3  src/security/jdbc/src/test/java/org/geoserver/security/jdbc/JDBCConnectAuthProviderTest.java
@@ -25,9 +25,6 @@
public class JDBCConnectAuthProviderTest extends AbstractAuthenticationProviderTest {
-
-
-
protected JDBCConnectAuthProviderConfig createAuthConfg(String name, String userGroupServiceName) {
JDBCConnectAuthProviderConfig config = new JDBCConnectAuthProviderConfig();
config.setName(name);
Please sign in to comment.
Something went wrong with that request. Please try again.