Update to version 1.10.0
Disable tests Signed-off-by: Didik Supriadi <didiksupriadi41@fedoraproject.org>
This commit is contained in:
parent
549c76103d
commit
6deb2b1825
7 changed files with 445 additions and 56 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
|||
/commons-text-1.9-src.tar.gz
|
||||
/commons-text-1.10.0-src.tar.gz
|
||||
|
|
|
|||
|
|
@ -1,19 +1,23 @@
|
|||
From 4ee3ce3b2890f1a0d6842e1b336a017a348a2508 Mon Sep 17 00:00:00 2001
|
||||
From 3ac7f7d1a58c78088cb4392114caf53a715f3c24 Mon Sep 17 00:00:00 2001
|
||||
From: Didik Supriadi <didiksupriadi41@fedoraproject.org>
|
||||
Date: Sat, 23 Apr 2022 15:53:45 +0700
|
||||
Date: Sat, 24 Jun 2023 18:12:26 +0700
|
||||
Subject: [PATCH] disable-url-lookup
|
||||
|
||||
Signed-off-by: Didik Supriadi <didiksupriadi41@fedoraproject.org>
|
||||
---
|
||||
.../StringSubstitutorWithInterpolatorStringLookupTest.java | 3 +++
|
||||
.../org/apache/commons/text/lookup/UrlStringLookupTest.java | 2 ++
|
||||
2 files changed, 5 insertions(+)
|
||||
...tutorWithInterpolatorStringLookupTest.java | 3 +
|
||||
...WithInterpolatorStringLookupTest.java.orig | 263 ++++++++++++++++++
|
||||
.../text/lookup/UrlStringLookupTest.java | 2 +
|
||||
.../text/lookup/UrlStringLookupTest.java.orig | 83 ++++++
|
||||
4 files changed, 351 insertions(+)
|
||||
create mode 100644 src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java.orig
|
||||
create mode 100644 src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java.orig
|
||||
|
||||
diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java b/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
|
||||
index 1d6a16f..1b0dc2b 100644
|
||||
index f9ccc62..4b851c5 100644
|
||||
--- a/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
|
||||
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
|
||||
@@ -27,6 +27,7 @@ import java.util.Map;
|
||||
@@ -28,6 +28,7 @@ import org.apache.commons.text.lookup.DefaultStringLookup;
|
||||
import org.apache.commons.text.lookup.StringLookup;
|
||||
import org.apache.commons.text.lookup.StringLookupFactory;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
|
@ -21,24 +25,293 @@ index 1d6a16f..1b0dc2b 100644
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class StringSubstitutorWithInterpolatorStringLookupTest {
|
||||
@@ -86,6 +87,7 @@ public class StringSubstitutorWithInterpolatorStringLookupTest {
|
||||
testCustomMapWithDefaults(false);
|
||||
@@ -91,6 +92,7 @@ public class StringSubstitutorWithInterpolatorStringLookupTest {
|
||||
Assertions.assertEquals("${UnknownLookup:key}", strSubst.replace("${UnknownLookup:key}"));
|
||||
}
|
||||
|
||||
+ @Disabled
|
||||
@Test
|
||||
public void testDefaultInterpolator() {
|
||||
// Used to cut and paste into the docs.
|
||||
@@ -141,6 +143,7 @@ public class StringSubstitutorWithInterpolatorStringLookupTest {
|
||||
strSubst.replace("${dns:" + hostName + "}"));
|
||||
public void testCustomMapWithoutDefaults() {
|
||||
testCustomMapWithDefaults(false);
|
||||
@@ -153,6 +155,7 @@ public class StringSubstitutorWithInterpolatorStringLookupTest {
|
||||
Assertions.assertEquals(input, strSubst.replace(input));
|
||||
}
|
||||
|
||||
+ @Disabled
|
||||
@Test
|
||||
public void testDnsLookupAddress() throws UnknownHostException {
|
||||
final StringSubstitutor strSubst = StringSubstitutor.createInterpolator();
|
||||
final StringSubstitutor strSubst =
|
||||
diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java.orig b/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java.orig
|
||||
new file mode 100644
|
||||
index 0000000..f9ccc62
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java.orig
|
||||
@@ -0,0 +1,263 @@
|
||||
+/*
|
||||
+ * Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
+ * contributor license agreements. See the NOTICE file distributed with
|
||||
+ * this work for additional information regarding copyright ownership.
|
||||
+ * The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
+ * (the "License"); you may not use this file except in compliance with
|
||||
+ * the License. You may obtain a copy of the License at
|
||||
+ *
|
||||
+ * http://www.apache.org/licenses/LICENSE-2.0
|
||||
+ *
|
||||
+ * Unless required by applicable law or agreed to in writing, software
|
||||
+ * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
+ * See the License for the specific language governing permissions and
|
||||
+ * limitations under the License.
|
||||
+ */
|
||||
+
|
||||
+package org.apache.commons.text;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
+
|
||||
+import java.net.InetAddress;
|
||||
+import java.net.UnknownHostException;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+
|
||||
+import org.apache.commons.text.lookup.DefaultStringLookup;
|
||||
+import org.apache.commons.text.lookup.StringLookup;
|
||||
+import org.apache.commons.text.lookup.StringLookupFactory;
|
||||
+import org.junit.jupiter.api.Assertions;
|
||||
+import org.junit.jupiter.api.Test;
|
||||
+
|
||||
+public class StringSubstitutorWithInterpolatorStringLookupTest {
|
||||
+
|
||||
+ private static StringLookup createInterpolatorWithLookups(final DefaultStringLookup... lookups) {
|
||||
+ final Map<String, StringLookup> lookupMap = new HashMap<>();
|
||||
+ for (final DefaultStringLookup lookup : lookups) {
|
||||
+ lookupMap.put(lookup.getKey().toLowerCase(), lookup.getStringLookup());
|
||||
+ }
|
||||
+
|
||||
+ return StringLookupFactory.INSTANCE.interpolatorStringLookup(lookupMap, null, false);
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testCustomFunctionWithDefaults() {
|
||||
+ testCustomFunctionWithDefaults(true);
|
||||
+ }
|
||||
+
|
||||
+ private void testCustomFunctionWithDefaults(final boolean addDefaultLookups) {
|
||||
+ final String key = "key";
|
||||
+ final String value = "value";
|
||||
+ final Map<String, String> map = new HashMap<>();
|
||||
+ map.put(key, value);
|
||||
+ final StringLookup mapStringLookup = StringLookupFactory.INSTANCE.functionStringLookup(map::get);
|
||||
+ final Map<String, StringLookup> stringLookupMap = new HashMap<>();
|
||||
+ stringLookupMap.put("customLookup", mapStringLookup);
|
||||
+ final StringSubstitutor strSubst = new StringSubstitutor(
|
||||
+ StringLookupFactory.INSTANCE.interpolatorStringLookup(stringLookupMap, null, addDefaultLookups));
|
||||
+ if (addDefaultLookups) {
|
||||
+ final String spKey = "user.name";
|
||||
+ Assertions.assertEquals(System.getProperty(spKey), strSubst.replace("${sys:" + spKey + "}"));
|
||||
+ }
|
||||
+ Assertions.assertEquals("value", strSubst.replace("${customLookup:key}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testCustomFunctionWithoutDefaults() {
|
||||
+ testCustomFunctionWithDefaults(false);
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testCustomMapWithDefaults() {
|
||||
+ testCustomMapWithDefaults(true);
|
||||
+ }
|
||||
+
|
||||
+ private void testCustomMapWithDefaults(final boolean addDefaultLookups) {
|
||||
+ final String key = "key";
|
||||
+ final String value = "value";
|
||||
+ final Map<String, String> map = new HashMap<>();
|
||||
+ map.put(key, value);
|
||||
+ final StringLookup mapStringLookup = StringLookupFactory.INSTANCE.mapStringLookup(map);
|
||||
+ final Map<String, StringLookup> stringLookupMap = new HashMap<>();
|
||||
+ stringLookupMap.put("customLookup", mapStringLookup);
|
||||
+ final StringSubstitutor strSubst = new StringSubstitutor(
|
||||
+ StringLookupFactory.INSTANCE.interpolatorStringLookup(stringLookupMap, null, addDefaultLookups));
|
||||
+ if (addDefaultLookups) {
|
||||
+ final String spKey = "user.name";
|
||||
+ Assertions.assertEquals(System.getProperty(spKey), strSubst.replace("${sys:" + spKey + "}"));
|
||||
+ }
|
||||
+ Assertions.assertEquals("value", strSubst.replace("${customLookup:key}"));
|
||||
+ Assertions.assertEquals("${UnknownLookup:key}", strSubst.replace("${UnknownLookup:key}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testCustomMapWithoutDefaults() {
|
||||
+ testCustomMapWithDefaults(false);
|
||||
+ }
|
||||
+ @Test
|
||||
+ public void testDefaultInterpolator() {
|
||||
+ // Used to cut and paste into the docs.
|
||||
+ // @formatter:off
|
||||
+ final StringSubstitutor interpolator = StringSubstitutor.createInterpolator();
|
||||
+ final String text = interpolator.replace(
|
||||
+ "Base64 Decoder: ${base64Decoder:SGVsbG9Xb3JsZCE=}\n"
|
||||
+ + "Base64 Encoder: ${base64Encoder:HelloWorld!}\n"
|
||||
+ + "Java Constant: ${const:java.awt.event.KeyEvent.VK_ESCAPE}\n"
|
||||
+ + "Date: ${date:yyyy-MM-dd}\n"
|
||||
+ + "Environment Variable: ${env:USERNAME}\n"
|
||||
+ + "File Content: ${file:UTF-8:src/test/resources/org/apache/commons/text/document.properties}\n"
|
||||
+ + "Java: ${java:version}\n"
|
||||
+ + "Localhost: ${localhost:canonical-name}\n"
|
||||
+ + "Properties File: ${properties:src/test/resources/org/apache/commons/text/document.properties::mykey}\n"
|
||||
+ + "Resource Bundle: ${resourceBundle:org.apache.commons.text.example.testResourceBundleLookup:mykey}\n"
|
||||
+ + "System Property: ${sys:user.dir}\n"
|
||||
+ + "URL Decoder: ${urlDecoder:Hello%20World%21}\n"
|
||||
+ + "URL Encoder: ${urlEncoder:Hello World!}\n"
|
||||
+ + "XML XPath: ${xml:src/test/resources/org/apache/commons/text/document.xml:/root/path/to/node}\n"
|
||||
+ );
|
||||
+ // @formatter:on
|
||||
+ Assertions.assertNotNull(text);
|
||||
+ // TEXT-171:
|
||||
+ Assertions.assertFalse(text.contains("${base64Decoder:SGVsbG9Xb3JsZCE=}"));
|
||||
+ Assertions.assertFalse(text.contains("${base64Encoder:HelloWorld!}"));
|
||||
+ Assertions.assertFalse(text.contains("${urlDecoder:Hello%20World%21}"));
|
||||
+ Assertions.assertFalse(text.contains("${urlEncoder:Hello World!}"));
|
||||
+ Assertions.assertFalse(text.contains("${resourceBundle:org.apache.commons.text.example.testResourceBundleLookup:mykey}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testDefaultValueForMissingKeyInResourceBundle() {
|
||||
+ final StringLookup interpolatorStringLookup = StringLookupFactory.INSTANCE.interpolatorStringLookup(
|
||||
+ StringLookupFactory.INSTANCE.resourceBundleStringLookup("org.apache.commons.text.example.testResourceBundleLookup"));
|
||||
+ assertEquals("${missingKey:-defaultValue}", interpolatorStringLookup.lookup("keyWithMissingKey"));
|
||||
+ final StringSubstitutor stringSubstitutor = new StringSubstitutor(interpolatorStringLookup);
|
||||
+ // The following would throw a MissingResourceException before TEXT-165.
|
||||
+ assertEquals("defaultValue", stringSubstitutor.replace("${keyWithMissingKey}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testDnsLookup() throws UnknownHostException {
|
||||
+ final StringSubstitutor strSubst =
|
||||
+ new StringSubstitutor(createInterpolatorWithLookups(DefaultStringLookup.DNS));
|
||||
+ final String hostName = InetAddress.getLocalHost().getHostName();
|
||||
+ Assertions.assertEquals(InetAddress.getByName(hostName).getHostAddress(),
|
||||
+ strSubst.replace("${dns:" + hostName + "}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testDnsLookup_disabledByDefault() throws UnknownHostException {
|
||||
+ final StringSubstitutor strSubst = StringSubstitutor.createInterpolator();
|
||||
+ final String hostName = InetAddress.getLocalHost().getHostName();
|
||||
+ final String input = "${dns:" + hostName + "}";
|
||||
+ Assertions.assertEquals(input, strSubst.replace(input));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testDnsLookupAddress() throws UnknownHostException {
|
||||
+ final StringSubstitutor strSubst =
|
||||
+ new StringSubstitutor(createInterpolatorWithLookups(DefaultStringLookup.DNS));
|
||||
+ Assertions.assertEquals(InetAddress.getByName("apache.org").getHostAddress(),
|
||||
+ strSubst.replace("${dns:address|apache.org}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testDnsLookupCanonicalName() throws UnknownHostException {
|
||||
+ final StringSubstitutor strSubst =
|
||||
+ new StringSubstitutor(createInterpolatorWithLookups(DefaultStringLookup.DNS));
|
||||
+ final String address = InetAddress.getLocalHost().getHostAddress();
|
||||
+ final InetAddress inetAddress = InetAddress.getByName(address);
|
||||
+ Assertions.assertEquals(inetAddress.getCanonicalHostName(),
|
||||
+ strSubst.replace("${dns:canonical-name|" + address + "}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testDnsLookupName() throws UnknownHostException {
|
||||
+ final StringSubstitutor strSubst =
|
||||
+ new StringSubstitutor(createInterpolatorWithLookups(DefaultStringLookup.DNS));
|
||||
+ final String address = InetAddress.getLocalHost().getHostAddress();
|
||||
+ final InetAddress inetAddress = InetAddress.getByName(address);
|
||||
+ Assertions.assertEquals(inetAddress.getHostName(), strSubst.replace("${dns:name|" + address + "}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testDnsLookupNameUntrimmed() throws UnknownHostException {
|
||||
+ final StringSubstitutor strSubst =
|
||||
+ new StringSubstitutor(createInterpolatorWithLookups(DefaultStringLookup.DNS));
|
||||
+ final String address = InetAddress.getLocalHost().getHostAddress();
|
||||
+ final InetAddress inetAddress = InetAddress.getByName(address);
|
||||
+ Assertions.assertEquals(inetAddress.getHostName(), strSubst.replace("${dns:name| " + address + " }"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testDnsLookupUnknown() {
|
||||
+ final StringSubstitutor strSubst =
|
||||
+ new StringSubstitutor(createInterpolatorWithLookups(DefaultStringLookup.DNS));
|
||||
+ final String unknown = "${dns: u n k n o w n}";
|
||||
+ Assertions.assertEquals(unknown, strSubst.replace(unknown));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testJavaScript() {
|
||||
+ final StringSubstitutor strSubst =
|
||||
+ new StringSubstitutor(createInterpolatorWithLookups(DefaultStringLookup.SCRIPT));
|
||||
+
|
||||
+ Assertions.assertEquals("Hello World!", strSubst.replace("${script:javascript:\"Hello World!\"}"));
|
||||
+ Assertions.assertEquals("7", strSubst.replace("${script:javascript:3 + 4}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testJavaScript_disabledByDefault() {
|
||||
+ final StringSubstitutor strSubst = StringSubstitutor.createInterpolator();
|
||||
+
|
||||
+ Assertions.assertEquals("${script:javascript:3 + 4}", strSubst.replace("${script:javascript:3 + 4}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testLocalHostLookup_Address() throws UnknownHostException {
|
||||
+ final StringSubstitutor strSubst = StringSubstitutor.createInterpolator();
|
||||
+ Assertions.assertEquals(InetAddress.getLocalHost().getHostAddress(), strSubst.replace("${localhost:address}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testLocalHostLookup_CanonicalName() throws UnknownHostException {
|
||||
+ final StringSubstitutor strSubst = StringSubstitutor.createInterpolator();
|
||||
+ Assertions.assertEquals(InetAddress.getLocalHost().getCanonicalHostName(),
|
||||
+ strSubst.replace("${localhost:canonical-name}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testLocalHostLookup_Name() throws UnknownHostException {
|
||||
+ final StringSubstitutor strSubst = StringSubstitutor.createInterpolator();
|
||||
+ Assertions.assertEquals(InetAddress.getLocalHost().getHostName(), strSubst.replace("${localhost:name}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testMapAndSystemProperty() {
|
||||
+ final String key = "key";
|
||||
+ final String value = "value";
|
||||
+ final Map<String, String> map = new HashMap<>();
|
||||
+ map.put(key, value);
|
||||
+ final StringSubstitutor strSubst = new StringSubstitutor(
|
||||
+ StringLookupFactory.INSTANCE.interpolatorStringLookup(map));
|
||||
+ final String spKey = "user.name";
|
||||
+ Assertions.assertEquals(System.getProperty(spKey), strSubst.replace("${sys:" + spKey + "}"));
|
||||
+ Assertions.assertEquals(value, strSubst.replace("${" + key + "}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testSystemProperty() {
|
||||
+ final StringSubstitutor strSubst = StringSubstitutor.createInterpolator();
|
||||
+ final String spKey = "user.name";
|
||||
+ Assertions.assertEquals(System.getProperty(spKey), strSubst.replace("${sys:" + spKey + "}"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testSystemPropertyDefaultStringLookup() {
|
||||
+ final StringSubstitutor strSubst = new StringSubstitutor(
|
||||
+ StringLookupFactory.INSTANCE.interpolatorStringLookup(StringLookupFactory.INSTANCE.systemPropertyStringLookup()));
|
||||
+ final String spKey = "user.name";
|
||||
+ Assertions.assertEquals(System.getProperty(spKey), strSubst.replace("${" + spKey + "}"));
|
||||
+ Assertions.assertEquals(System.getProperty(spKey), strSubst.replace("${sys:" + spKey + "}"));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java
|
||||
index ced97c3..4b8c4ac 100644
|
||||
index 93b83fe..402968b 100644
|
||||
--- a/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java
|
||||
+++ b/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java
|
||||
@@ -26,6 +26,7 @@ import java.nio.file.Path;
|
||||
|
|
@ -50,13 +323,102 @@ index ced97c3..4b8c4ac 100644
|
|||
|
||||
/**
|
||||
@@ -64,6 +65,7 @@ public class UrlStringLookupTest {
|
||||
Assertions.assertEquals(expectedString, UrlStringLookup.INSTANCE.lookup("UTF-8:" + uri.toString()));
|
||||
Assertions.assertNotNull(UrlStringLookup.INSTANCE.lookup("UTF-8:https://www.google.com"));
|
||||
}
|
||||
|
||||
+ @Disabled
|
||||
@Test
|
||||
public void testHttpScheme() throws Exception {
|
||||
Assertions.assertNotNull(UrlStringLookup.INSTANCE.lookup("UTF-8:https://www.apache.org"));
|
||||
public void testMissingUrl() {
|
||||
assertThrows(IllegalArgumentException.class, () -> UrlStringLookup.INSTANCE.lookup("UTF-8"));
|
||||
diff --git a/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java.orig b/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java.orig
|
||||
new file mode 100644
|
||||
index 0000000..93b83fe
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/org/apache/commons/text/lookup/UrlStringLookupTest.java.orig
|
||||
@@ -0,0 +1,83 @@
|
||||
+/*
|
||||
+ * Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
+ * contributor license agreements. See the NOTICE file distributed with
|
||||
+ * this work for additional information regarding copyright ownership.
|
||||
+ * The ASF licenses this file to You under the Apache license, Version 2.0
|
||||
+ * (the "License"); you may not use this file except in compliance with
|
||||
+ * the License. You may obtain a copy of the License at
|
||||
+ *
|
||||
+ * http://www.apache.org/licenses/LICENSE-2.0
|
||||
+ *
|
||||
+ * Unless required by applicable law or agreed to in writing, software
|
||||
+ * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
+ * See the license for the specific language governing permissions and
|
||||
+ * limitations under the license.
|
||||
+ */
|
||||
+
|
||||
+package org.apache.commons.text.lookup;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
+
|
||||
+import java.net.URI;
|
||||
+import java.nio.charset.StandardCharsets;
|
||||
+import java.nio.file.Files;
|
||||
+import java.nio.file.Path;
|
||||
+import java.nio.file.Paths;
|
||||
+
|
||||
+import org.junit.jupiter.api.Assertions;
|
||||
+import org.junit.jupiter.api.Test;
|
||||
+
|
||||
+/**
|
||||
+ * Tests {@link UrlStringLookup}.
|
||||
+ */
|
||||
+public class UrlStringLookupTest {
|
||||
+
|
||||
+ @Test
|
||||
+ public void testBadCharsetName() {
|
||||
+ assertThrows(IllegalArgumentException.class, () -> UrlStringLookup.INSTANCE.lookup("BAD_CHARSET_NAME:BAD_URL"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testBadEncoding() {
|
||||
+ assertThrows(IllegalArgumentException.class, () -> UrlStringLookup.INSTANCE.lookup("FOO:https://www.google.com"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testBadUrl() {
|
||||
+ assertThrows(IllegalArgumentException.class, () -> UrlStringLookup.INSTANCE.lookup("UTF-8:BAD_URL"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testFileScheme() throws Exception {
|
||||
+ final Path path = Paths.get("src/test/resources/org/apache/commons/text/document.properties");
|
||||
+ final URI uri = path.toUri();
|
||||
+ // System.out.println(uri);
|
||||
+ final byte[] expectedBytes = Files.readAllBytes(path);
|
||||
+ final String expectedString = new String(expectedBytes, StandardCharsets.UTF_8);
|
||||
+ Assertions.assertEquals(expectedString, UrlStringLookup.INSTANCE.lookup("UTF-8:" + uri.toString()));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testHttpScheme() {
|
||||
+ Assertions.assertNotNull(UrlStringLookup.INSTANCE.lookup("UTF-8:https://www.apache.org"));
|
||||
+ Assertions.assertNotNull(UrlStringLookup.INSTANCE.lookup("UTF-8:https://www.google.com"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testMissingUrl() {
|
||||
+ assertThrows(IllegalArgumentException.class, () -> UrlStringLookup.INSTANCE.lookup("UTF-8"));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testNull() {
|
||||
+ Assertions.assertNull(UrlStringLookup.INSTANCE.lookup(null));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void testToString() {
|
||||
+ // does not blow up and gives some kind of string.
|
||||
+ Assertions.assertFalse(UrlStringLookup.INSTANCE.toString().isEmpty());
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
--
|
||||
2.35.1
|
||||
2.41.0
|
||||
|
||||
|
|
|
|||
64
KEYS
64
KEYS
|
|
@ -32,7 +32,9 @@ For more details, please see:
|
|||
|
||||
Commons Developers:
|
||||
(echo && pgp -kxa <your name>) >> this file.
|
||||
OR
|
||||
(echo && pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
|
||||
OR
|
||||
(echo && gpg --list-sigs <your name> && gpg --armor --export <your name>) >> this file.
|
||||
|
||||
Note: the echo command adds a blank line
|
||||
|
|
@ -46,7 +48,6 @@ Note: the echo command adds a blank line
|
|||
svn co --depth=files https://dist.apache.org/repos/dist/release/commons/
|
||||
|
||||
DO NOT DELETE A KEY FROM THIS FILE if it has been used for signing/counter-signing a Commons release
|
||||
Instead, add the new key
|
||||
|
||||
************************************************************************************************************
|
||||
|
||||
|
|
@ -6899,45 +6900,29 @@ Ug==
|
|||
=H7xU
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
pub rsa4096 2014-07-11 [SC] [expires: 2020-07-09]
|
||||
pub rsa4096 2014-07-11 [SC] [expires: 2025-01-21]
|
||||
E32D4F1022C616579157F1B11E5AB6D3CF8EBF5F
|
||||
uid [ultimate] Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2019-12-29 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2020-03-10 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2023-01-14 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2020-03-10 Carl Hall <carl@halls.farm>
|
||||
uid [ultimate] Carl Hall <carl.hall@gmail.com>
|
||||
sig 3 X 8418AB8721C8CE0E 2015-09-25 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2019-03-28 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2023-01-14 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2014-07-11 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-01-14 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-01-24 Carl Hall <carl@halls.farm>
|
||||
sig 50A04D0C3B6517F2 2018-06-30 [User ID not found]
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-07-09 Carl Hall <carl@halls.farm>
|
||||
uid [ultimate] Carl Hall <carl@cloudability.com>
|
||||
sig 3 X 8418AB8721C8CE0E 2015-09-25 Carl Hall <carl@halls.farm>
|
||||
sig 3 X 3ADDCD05DAEFE37C 2016-06-07 [User ID not found]
|
||||
sig 3 1E5AB6D3CF8EBF5F 2014-07-11 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2019-03-28 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2014-07-11 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-01-14 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-01-24 Carl Hall <carl@halls.farm>
|
||||
sig 50A04D0C3B6517F2 2018-06-30 [User ID not found]
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-07-09 Carl Hall <carl@halls.farm>
|
||||
uid [ultimate] Carl Hall <carl@hallwaytech.com>
|
||||
sig 3 X 8418AB8721C8CE0E 2015-09-25 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2019-03-28 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2014-07-11 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-01-24 Carl Hall <carl@halls.farm>
|
||||
sig 50A04D0C3B6517F2 2018-06-30 [User ID not found]
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-07-09 Carl Hall <carl@halls.farm>
|
||||
uid [ultimate] Carl Hall <thecarlhall@apache.org>
|
||||
sig 3 X 8418AB8721C8CE0E 2015-09-25 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2019-03-28 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2015-04-16 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-01-24 Carl Hall <carl@halls.farm>
|
||||
sig 50A04D0C3B6517F2 2018-06-30 [User ID not found]
|
||||
t
|
||||
sig 3 1E5AB6D3CF8EBF5F 2017-07-09 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2020-03-10 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2023-01-14 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2018-07-08 Carl Hall <carl@halls.farm>
|
||||
sig 3 1E5AB6D3CF8EBF5F 2018-01-29 Carl Hall <carl@halls.farm>
|
||||
|
||||
|
|
@ -9429,3 +9414,38 @@ CF9l4/Pwg6FwoutWxLDNQsdBqF8tzhu/afOcGsOY8LwnBZOBL+b/+8lIEa3IWAin
|
|||
UJ9MVCU=
|
||||
=yL9f
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
pub ed25519/0x031EE010CA15D1EE 2022-03-10 [C]
|
||||
Key fingerprint = 8378 BFAA D82F E5AA 602A C356 031E E010 CA15 D1EE
|
||||
uid [ultimate] Matt Sicker <mattsicker@apache.org>
|
||||
sig 3 0x031EE010CA15D1EE 2022-03-10 Matt Sicker <mattsicker@apache.org>
|
||||
sub ed25519/0x0181B45EA58677BC 2022-03-10 [S] [expires: 2028-03-08]
|
||||
sig 0x031EE010CA15D1EE 2022-03-10 Matt Sicker <mattsicker@apache.org>
|
||||
sub cv25519/0x944EC8D1A08CF77A 2022-03-10 [E] [expires: 2028-03-08]
|
||||
sig 0x031EE010CA15D1EE 2022-03-10 Matt Sicker <mattsicker@apache.org>
|
||||
sub ed25519/0x11A629398030E936 2022-03-10 [A] [expires: 2028-03-08]
|
||||
sig 0x031EE010CA15D1EE 2022-03-10 Matt Sicker <mattsicker@apache.org>
|
||||
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mDMEYiljShYJKwYBBAHaRw8BAQdA4ativA3OtR15B4YnoRwpm9rRgHdd0A0lzJ4u
|
||||
6q7gsMO0I01hdHQgU2lja2VyIDxtYXR0c2lja2VyQGFwYWNoZS5vcmc+iI4EExYK
|
||||
ADYWIQSDeL+q2C/lqmAqw1YDHuAQyhXR7gUCYiljSgIbAQQLCQgHBBUKCQgFFgID
|
||||
AQACHgECF4AACgkQAx7gEMoV0e4A9QEAwjrT892AmbfW8wz/v+GtePngb3lO1M13
|
||||
rgcvr2RStH0A/Ri4+kkaq8SJ1bKGutGQ1HdVKAezyH43gCElg2PIMBwLuDMEYilj
|
||||
vhYJKwYBBAHaRw8BAQdAZu4+fS/JFKCVTzk4FGQdZUm2jVKoNmUYh4D90N7Md4yI
|
||||
9QQYFgoAJhYhBIN4v6rYL+WqYCrDVgMe4BDKFdHuBQJiKWO+AhsCBQkLRzUAAIEJ
|
||||
EAMe4BDKFdHudiAEGRYKAB0WIQTKYu0TDkBTlEQG32QBgbRepYZ3vAUCYiljvgAK
|
||||
CRABgbRepYZ3vJtnAP0bBbIkexlDKrTeyTW3ah+KV2S1/OjA3WvtZZYdOengTgEA
|
||||
7FxGQxTCEpL7ang6tEf335byU70z+Ctz4VbaoyCQUg0AhgD/SLe+JytxaIYw+VV7
|
||||
WvGj9UzoEFXqo6wAdu+nYEQcw+cBANgFCjQpgGEQCIEIjY/NrklZnMzXlHKZ1Ab8
|
||||
5KTuWCQEuDgEYilkCRIKKwYBBAGXVQEFAQEHQJX5V78g0svo7XH8mYaigbRAt/PY
|
||||
X2A0g6Qxo0XEJD5YAwEIB4h+BBgWCgAmFiEEg3i/qtgv5apgKsNWAx7gEMoV0e4F
|
||||
AmIpZAkCGwwFCQtHNQAACgkQAx7gEMoV0e4ecAD+KQWT2iO1W/EczvSgurkvbCgm
|
||||
CkMeBwTucYVu6Hd0h0gA/2GVDe/McuK65LrqghHPek8PvSbMVtw/iR3OQ3cXyBYG
|
||||
uDMEYilkGBYJKwYBBAHaRw8BAQdAPHx0bsFG7r3Zw3sZCc0GVVIPpxa3AA2YG8xg
|
||||
7QAvNFeIfgQYFgoAJhYhBIN4v6rYL+WqYCrDVgMe4BDKFdHuBQJiKWQYAhsgBQkL
|
||||
RzUAAAoJEAMe4BDKFdHuMZ0BALB9hOZO2olaDYA4UmLx9AQXAXy99Bz5bmt9qVa+
|
||||
Vg+DAP9lmPUPXEdV8ogQBoExOifUOgLUoJ2BTcysUyVRkDvyAw==
|
||||
=oRrk
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
%global jarname commons-text
|
||||
|
||||
Name: apache-%{jarname}
|
||||
Version: 1.9
|
||||
Release: 5%{?dist}
|
||||
Version: 1.10.0
|
||||
Release: 1%{?dist}
|
||||
Summary: Apache Commons Text is a library focused on algorithms working on strings
|
||||
License: Apache-2.0
|
||||
URL: https://commons.apache.org/proper/%{jarname}
|
||||
|
|
@ -15,7 +15,7 @@ Source2: https://archive.apache.org/dist/commons/KEYS
|
|||
Patch0: 0001-disable-url-lookup.patch
|
||||
|
||||
BuildRequires: gnupg2
|
||||
BuildRequires: maven-local-openjdk11
|
||||
BuildRequires: maven-local
|
||||
BuildRequires: mvn(org.apache.commons:commons-parent:pom:)
|
||||
BuildRequires: mvn(org.assertj:assertj-core)
|
||||
BuildRequires: mvn(org.junit.jupiter:junit-jupiter)
|
||||
|
|
@ -41,7 +41,8 @@ escaping of various types.
|
|||
find -type f '(' -name '*.jar' -o -name '*.class' ')' -print -delete
|
||||
|
||||
%build
|
||||
%mvn_build -- -Dmaven.compiler.release=8
|
||||
# disable test: some test deps can't be installed
|
||||
%mvn_build -f -- -Dmaven.compiler.release=8
|
||||
|
||||
%install
|
||||
%mvn_install
|
||||
|
|
@ -51,6 +52,10 @@ find -type f '(' -name '*.jar' -o -name '*.class' ')' -print -delete
|
|||
%doc README.md RELEASE-NOTES.txt
|
||||
|
||||
%changelog
|
||||
* Sat Jun 24 2023 Didik Supriadi <didiksupriadi41@fedoraproject.org> - 1.10.0-1
|
||||
- Update to version 1.10.0
|
||||
- Disable tests
|
||||
|
||||
* Sat Apr 29 2023 Didik Supriadi <didiksupriadi41@fedoraproject.org> - 1.9-5
|
||||
- migrated to SPDX license
|
||||
|
||||
|
|
|
|||
11
commons-text-1.10.0-src.tar.gz.asc
Normal file
11
commons-text-1.10.0-src.tar.gz.asc
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAABCgAdFiEELbTx7w+nYezE6pNchv3H4qESYssFAmMvGsIACgkQhv3H4qES
|
||||
Yss3EggAkT8hrxVGVfRmJOfGgXgZq6z/rDYR2yXT9Fh9C2UFELJiPLWaRoSwwEJx
|
||||
4uI41gjdjeYWDAZCaaMztM/ZIDoxUWVIZNPNyulVZ/Nz/bKUdf3JsXmAZUnVrIpt
|
||||
DEkCv6R9UlSSJIawyLjaaiAwOu7Qo8blIfmDHpCMpHCIF3tc1JkLqq1Jz4/6qkUf
|
||||
eujw0Apxc+CreDa7OOEd9obmxL4XGRNqLRcRzaO1YZjgUbBDCSRkAT8Pe4fOmp0c
|
||||
w79eLP7ICBhl+DejPIaWx3PD7Drdt5IUmApi+5S/3xK8dg1LTVpsldV8rYTCAvhR
|
||||
1yanT2yIrSp9AefzPw1Qs8bGTw6daw==
|
||||
=7Hot
|
||||
-----END PGP SIGNATURE-----
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAABCgAdFiEELbTx7w+nYezE6pNchv3H4qESYssFAl8XUskACgkQhv3H4qES
|
||||
Ysu3bggAheMNmc9jJvyXeFT+Yd5s4fxr8fR+7cWn3Eh7bY2KBojUyMRH/myAv39L
|
||||
NoMHag6TIRVxoWF7qgmjKBsQCtLjug8yLyL4eVpkIzm2QQCnrI1vqWQr7JBqtPAZ
|
||||
u4vgacH4aGOUYZrVPWjeRATEjS4dUBoH5XPTlCS46UEqhrY1FfwmKV2cWFzfESZx
|
||||
9CjnvCxOjzUtwt5IgvRjefUbMD3TW7HAuop7R5+k8O8WWc9bAl775VsdHvEI2/gf
|
||||
PbR8IwXvgmsEjNiSXtr5zEW0AEoKYvKHr64ikai0s/fZMZbKrhE+FJE7R+c1BvYy
|
||||
/kVADZjmRWESOOSMOQ85KdWkiShwGA==
|
||||
=/t3k
|
||||
-----END PGP SIGNATURE-----
|
||||
1
sources
1
sources
|
|
@ -1 +1,2 @@
|
|||
SHA512 (commons-text-1.9-src.tar.gz) = 53f993e79aaa6789d3388aa96b6b2a14cf646b27ff3774524390e511241a85288947cc929519eff61a8734578f25bdf3d9969d84da20c1a749b19d90a55da8ae
|
||||
SHA512 (commons-text-1.10.0-src.tar.gz) = 6bf2dc7dda4429cb1b9ba3a4d383c1d9ffabd5ff35a0adc55216e7cf4c532e51b2b012c9b0f3ea859cd32aef75e05547d892301f34f304a0bfd27c39a28fe04f
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue