nastra commented on code in PR #14808:
URL: https://github.com/apache/iceberg/pull/14808#discussion_r2614432605
##########
core/src/test/java/org/apache/iceberg/rest/TestResourcePaths.java:
##########
@@ -110,6 +110,47 @@ public void testNamespaceWithDot(String
namespaceSeparator) {
.isEqualTo("v1/namespaces/" + namespace);
}
+ @Test
+ public void testDecodeNamespaceContainingLegacySeparators() {
+ Namespace namespace = Namespace.of("first", "second", "third");
+ String legacySeparator = RESTUtil.NAMESPACE_SEPARATOR_URLENCODED_UTF_8;
+ String newSeparator =
RESTCatalogAdapter.NAMESPACE_SEPARATOR_URLENCODED_UTF_8;
+
+ // legacy separator is always used by default, so no need to configure it
+ ResourcePaths pathsWithLegacySeparator =
ResourcePaths.forCatalogProperties(ImmutableMap.of());
+
+ // Encode namespace using legacy separator. No need to provide the
separator to encodeNamespace
+ String legacyEncodedNamespace = RESTUtil.encodeNamespace(namespace);
+ assertThat(pathsWithLegacySeparator.namespace(namespace))
+ .contains(legacyEncodedNamespace)
+ .contains(legacySeparator);
+
+ // Decode the namespace containing legacy separator without providing the
separator
+
assertThat(RESTUtil.decodeNamespace(legacyEncodedNamespace)).isEqualTo(namespace);
+
+ // Decode the namespace containing legacy separator with providing the new
separator
+ assertThat(RESTUtil.decodeNamespace(legacyEncodedNamespace,
newSeparator)).isEqualTo(namespace);
+ }
+
+ @Test
+ public void testDecodeNamespaceContainingNewSeparators() {
Review Comment:
```suggestion
public void nestedNamespaceWithNewSeparator() {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]