Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor AuthorizationService tests #67

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@
import org.geolatte.geom.MultiPolygon;
import org.geolatte.geom.codec.Wkt;
import org.geolatte.geom.jts.JTS;
import org.geoserver.acl.domain.adminrules.AdminRuleAdminService;
import org.geoserver.acl.domain.adminrules.AdminRuleAdminServiceImpl;
import org.geoserver.acl.domain.adminrules.MemoryAdminRuleRepository;
import org.geoserver.acl.domain.rules.CatalogMode;
import org.geoserver.acl.domain.rules.MemoryRuleRepository;
import org.geoserver.acl.domain.rules.Rule;
import org.geoserver.acl.domain.rules.RuleAdminService;
import org.geoserver.acl.domain.rules.RuleAdminServiceImpl;
import org.geoserver.acl.domain.rules.RuleLimits;
import org.geoserver.acl.domain.rules.SpatialFilterType;
import org.junit.jupiter.api.Test;
Expand All @@ -39,7 +33,7 @@
*
* <p>Concrete implementations must supply the required services in {@link ServiceTestBase}
*/
public class AuthorizationServiceImpl_GeomTest extends ServiceTestBase {
public abstract class AuthorizationServiceGeomTest extends AuthorizationServiceTest {
private static final String WKT_WGS84_1 =
"SRID=4326;MultiPolygon (((-1.93327272727272859 5.5959090909090925, 2.22727272727272707 5.67609090909091041, 2.00454545454545441 4.07245454545454599, -1.92436363636363761 4.54463636363636425, -1.92436363636363761 4.54463636363636425, -1.93327272727272859 5.5959090909090925)))";
private static final String WKT_WGS84_2 =
Expand All @@ -56,21 +50,6 @@ public class AuthorizationServiceImpl_GeomTest extends ServiceTestBase {
private static final String WKT_3857 =
"SRID=3857;MULTIPOLYGON(((0.0016139656066815888 -0.0006386457758059581,0.0019599705696027314 -0.0006386457758059581,0.0019599705696027314 -0.0008854090051601674,0.0016139656066815888 -0.0008854090051601674,0.0016139656066815888 -0.0006386457758059581)))";

@Override
protected RuleAdminService getRuleAdminService() {
return new RuleAdminServiceImpl(new MemoryRuleRepository());
}

@Override
protected AdminRuleAdminService getAdminRuleAdminService() {
return new AdminRuleAdminServiceImpl(new MemoryAdminRuleRepository());
}

@Override
protected AuthorizationService getAuthorizationService() {
return new AuthorizationServiceImpl(super.adminruleAdminService, super.ruleAdminService);
}

/**
* Test that the original SRID is present in the allowedArea wkt representation, when retrieving
* it from the AccessInfo object
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* (c) 2023 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.acl.authorization;

import org.geoserver.acl.domain.adminrules.AdminRuleAdminService;
import org.geoserver.acl.domain.adminrules.AdminRuleAdminServiceImpl;
import org.geoserver.acl.domain.adminrules.MemoryAdminRuleRepository;
import org.geoserver.acl.domain.rules.MemoryRuleRepository;
import org.geoserver.acl.domain.rules.RuleAdminService;
import org.geoserver.acl.domain.rules.RuleAdminServiceImpl;

/**
* {@link AuthorizationService} integration/conformance test working with geometries
*
* <p>Concrete implementations must supply the required services in {@link ServiceTestBase}
*/
class AuthorizationServiceImplGeomTest extends AuthorizationServiceGeomTest {

@Override
protected RuleAdminService getRuleAdminService() {
return new RuleAdminServiceImpl(new MemoryRuleRepository());
}

@Override
protected AdminRuleAdminService getAdminRuleAdminService() {
return new AdminRuleAdminServiceImpl(new MemoryAdminRuleRepository());
}

@Override
protected AuthorizationService getAuthorizationService() {
return new AuthorizationServiceImpl(super.adminruleAdminService, super.ruleAdminService);
}
}
Loading
Loading