forked from geoserver/geoserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GEOS-10438] ENTITY_RESOLUTION_ALLOWLIST property not parsing empty s…
…etting
- Loading branch information
1 parent
0acbc54
commit 87a7332
Showing
5 changed files
with
147 additions
and
40 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
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
52 changes: 52 additions & 0 deletions
52
src/main/src/test/java/org/geoserver/util/EntityResolverProviderTest.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,52 @@ | ||
/* (c) 2024 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.util; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertNull; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.util.Arrays; | ||
import java.util.Set; | ||
import org.junit.Test; | ||
|
||
public class EntityResolverProviderTest { | ||
|
||
@Test | ||
public void testAllowListDefaults() throws Exception { | ||
Set<String> allowed = EntityResolverProvider.entityResolutionAllowlist(""); | ||
assertNotNull(allowed); | ||
assertEquals(4, allowed.size()); | ||
assertTrue(allowed.contains(AllowListEntityResolver.W3C)); | ||
assertTrue(allowed.contains(AllowListEntityResolver.INSPIRE)); | ||
assertTrue(allowed.containsAll(Arrays.asList(AllowListEntityResolver.OGC.split("\\|")))); | ||
|
||
allowed = EntityResolverProvider.entityResolutionAllowlist(null); | ||
assertNotNull(allowed); | ||
assertEquals(4, allowed.size()); | ||
assertTrue(allowed.contains(AllowListEntityResolver.W3C)); | ||
assertTrue(allowed.contains(AllowListEntityResolver.INSPIRE)); | ||
assertTrue(allowed.containsAll(Arrays.asList(AllowListEntityResolver.OGC.split("\\|")))); | ||
} | ||
|
||
@Test | ||
public void testAllowListWildCard() throws Exception { | ||
Set<String> allowed = EntityResolverProvider.entityResolutionAllowlist("*"); | ||
assertNull(allowed); | ||
} | ||
|
||
@Test | ||
public void testAllowListDomains() throws Exception { | ||
Set<String> allowed = EntityResolverProvider.entityResolutionAllowlist("how2map.com"); | ||
|
||
assertNotNull(allowed); | ||
assertEquals(5, allowed.size()); | ||
assertTrue(allowed.contains(AllowListEntityResolver.W3C)); | ||
assertTrue(allowed.contains(AllowListEntityResolver.INSPIRE)); | ||
assertTrue(allowed.containsAll(Arrays.asList(AllowListEntityResolver.OGC.split("\\|")))); | ||
assertTrue(allowed.contains("how2map.com")); | ||
} | ||
} |