This is an automated email from the ASF dual-hosted git repository. rzo1 pushed a commit to branch allow-base-url-configuration-based-on-properties in repository https://gitbox.apache.org/repos/asf/opennlp.git
commit c4e46399548cdf933f3002a3e3b8d78e38e0ce20 Author: Richard Zowalla <[email protected]> AuthorDate: Tue Jul 8 20:14:01 2025 +0200 OPENNLP-1760 - Make SourceForge URLs in Tests Configurable to Avoid 403/Rate Limiting Issues --- .../src/test/java/opennlp/tools/AbstractModelLoaderTest.java | 4 ++-- .../src/test/java/opennlp/tools/AbstractModelLoaderTest.java | 4 ++-- .../opennlp-uima/src/test/java/opennlp/uima/AbstractIT.java | 4 ++-- .../src/test/java/opennlp/tools/namefind/AbstractNameFinderTest.java | 2 +- pom.xml | 5 +++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractModelLoaderTest.java b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractModelLoaderTest.java index c83fe781..53ec0298 100644 --- a/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractModelLoaderTest.java +++ b/opennlp-core/opennlp-cli/src/test/java/opennlp/tools/AbstractModelLoaderTest.java @@ -34,8 +34,8 @@ public abstract class AbstractModelLoaderTest { private static final Logger logger = LoggerFactory.getLogger(AbstractModelLoaderTest.class); - private static final String BASE_URL_MODELS_V15 = "https://opennlp.sourceforge.net/models-1.5/"; - private static final String BASE_URL_MODELS_V183 = "https://dlcdn.apache.org/opennlp/models/langdetect/1.8.3/"; + private static final String BASE_URL_MODELS_V15 = System.getProperty("opennlp.model.v15.base.url", "https://opennlp.sourceforge.net/models-1.5/"); + private static final String BASE_URL_MODELS_V183 = System.getProperty("opennlp.model.v183.base.url", "https://dlcdn.apache.org/opennlp/models/langdetect/1.8.3/"); protected static final Path OPENNLP_DIR = Paths.get(System.getProperty("OPENNLP_DOWNLOAD_HOME", System.getProperty("user.home"))).resolve(".opennlp"); protected static final String VER = "1.3-2.5.4"; diff --git a/opennlp-core/opennlp-runtime/src/test/java/opennlp/tools/AbstractModelLoaderTest.java b/opennlp-core/opennlp-runtime/src/test/java/opennlp/tools/AbstractModelLoaderTest.java index db0ae96d..b8c57656 100644 --- a/opennlp-core/opennlp-runtime/src/test/java/opennlp/tools/AbstractModelLoaderTest.java +++ b/opennlp-core/opennlp-runtime/src/test/java/opennlp/tools/AbstractModelLoaderTest.java @@ -34,8 +34,8 @@ public abstract class AbstractModelLoaderTest { private static final Logger logger = LoggerFactory.getLogger(AbstractModelLoaderTest.class); - private static final String BASE_URL_MODELS_V15 = "https://opennlp.sourceforge.net/models-1.5/"; - private static final String BASE_URL_MODELS_V183 = "https://dlcdn.apache.org/opennlp/models/langdetect/1.8.3/"; + private static final String BASE_URL_MODELS_V15 = System.getProperty("opennlp.model.v15.base.url", "https://opennlp.sourceforge.net/models-1.5/"); + private static final String BASE_URL_MODELS_V183 = System.getProperty("opennlp.model.v183.base.url", "https://dlcdn.apache.org/opennlp/models/langdetect/1.8.3/"); protected static final Path OPENNLP_DIR = Paths.get(System.getProperty("OPENNLP_DOWNLOAD_HOME", System.getProperty("user.home"))).resolve(".opennlp"); protected static final String VER = "1.2-2.5.0"; diff --git a/opennlp-extensions/opennlp-uima/src/test/java/opennlp/uima/AbstractIT.java b/opennlp-extensions/opennlp-uima/src/test/java/opennlp/uima/AbstractIT.java index 39c27387..4e0c45ef 100644 --- a/opennlp-extensions/opennlp-uima/src/test/java/opennlp/uima/AbstractIT.java +++ b/opennlp-extensions/opennlp-uima/src/test/java/opennlp/uima/AbstractIT.java @@ -53,8 +53,8 @@ abstract class AbstractIT extends AbstractUimaTest { protected static final String BIN = ".bin"; - private static final String BASE_URL_MODELS_V15 = "https://opennlp.sourceforge.net/models-1.5/"; - + private static final String BASE_URL_MODELS_V15 = System.getProperty("opennlp.model.v15.base.url", "https://opennlp.sourceforge.net/models-1.5/"); + @BeforeAll public static void initEnv() throws IOException { // ensure referenced UD models are present in download home diff --git a/opennlp-tools/src/test/java/opennlp/tools/namefind/AbstractNameFinderTest.java b/opennlp-tools/src/test/java/opennlp/tools/namefind/AbstractNameFinderTest.java index 8c27bb63..47fa4d72 100644 --- a/opennlp-tools/src/test/java/opennlp/tools/namefind/AbstractNameFinderTest.java +++ b/opennlp-tools/src/test/java/opennlp/tools/namefind/AbstractNameFinderTest.java @@ -46,7 +46,7 @@ abstract class AbstractNameFinderTest { protected static final Path OPENNLP_DIR = Paths.get(System.getProperty("OPENNLP_DOWNLOAD_HOME", System.getProperty("user.home"))).resolve(".opennlp"); - private static final String BASE_URL_MODELS_V15 = "https://opennlp.sourceforge.net/models-1.5/"; + private static final String BASE_URL_MODELS_V15 = System.getProperty("opennlp.model.v15.base.url", "https://opennlp.sourceforge.net/models-1.5/"); protected static boolean hasOtherAsOutcome(TokenNameFinderModel nameFinderModel) { SequenceClassificationModel model = nameFinderModel.getNameFinderSequenceModel(); diff --git a/pom.xml b/pom.xml index e4798840..bfb90e98 100644 --- a/pom.xml +++ b/pom.xml @@ -339,7 +339,7 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <argLine>-Xmx2048m -Dorg.slf4j.simpleLogger.defaultLogLevel=off</argLine> + <argLine>-Xmx2048m -Dorg.slf4j.simpleLogger.defaultLogLevel=off -Dopennlp.model.v15.base.url="${opennlp.model.v15.base.url}"</argLine> <forkCount>${opennlp.forkCount}</forkCount> <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests> <excludes> @@ -364,7 +364,7 @@ </execution> </executions> <configuration> - <argLine>-DOPENNLP_DOWNLOAD_HOME=${opennlp.download.home}</argLine> + <argLine>-DOPENNLP_DOWNLOAD_HOME=${opennlp.download.home} -Dopennlp.model.v15.base.url="${opennlp.model.v15.base.url}"</argLine> <excludes> <exclude>**/*Test.java</exclude> </excludes> @@ -667,6 +667,7 @@ <id>ci</id> <properties> <opennlp.download.home>${project.build.directory}</opennlp.download.home> + <opennlp.model.v15.base.url>https://nightlies.apache.org/opennlp/models-1.5/</opennlp.model.v15.base.url> </properties> </profile>
