Skip to content

Commit 9ad1d6d

Browse files
committed
OPENNLP-1760: Make SourceForge URLs in Tests Configurable to Avoid 403/Rate Limiting Issues (OpenNLP 2.x)
1 parent adc38fa commit 9ad1d6d

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

opennlp-tools/src/test/java/opennlp/tools/AbstractModelLoaderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public abstract class AbstractModelLoaderTest {
3434

3535
private static final Logger logger = LoggerFactory.getLogger(AbstractModelLoaderTest.class);
3636

37-
private static final String BASE_URL_MODELS_V15 = "https://opennlp.sourceforge.net/models-1.5/";
38-
private static final String BASE_URL_MODELS_V183 = "https://dlcdn.apache.org/opennlp/models/langdetect/1.8.3/";
37+
private static final String BASE_URL_MODELS_V15 = System.getProperty("opennlp.model.v15.base.url", "https://opennlp.sourceforge.net/models-1.5/");
38+
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/");
3939
protected static final Path OPENNLP_DIR = Paths.get(System.getProperty("OPENNLP_DOWNLOAD_HOME",
4040
System.getProperty("user.home"))).resolve(".opennlp");
4141
protected static final String VER = "1.3-2.5.4";

opennlp-uima/src/test/java/opennlp/uima/AbstractIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ abstract class AbstractIT extends AbstractUimaTest {
5353

5454
protected static final String BIN = ".bin";
5555

56-
private static final String BASE_URL_MODELS_V15 = "https://opennlp.sourceforge.net/models-1.5/";
57-
56+
private static final String BASE_URL_MODELS_V15 = System.getProperty("opennlp.model.v15.base.url", "https://opennlp.sourceforge.net/models-1.5/");
57+
5858
@BeforeAll
5959
public static void initEnv() throws IOException {
6060
// ensure referenced UD models are present in download home

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
<groupId>org.apache.maven.plugins</groupId>
294294
<artifactId>maven-surefire-plugin</artifactId>
295295
<configuration>
296-
<argLine>-Xmx2048m -Dorg.slf4j.simpleLogger.defaultLogLevel=off</argLine>
296+
<argLine>-Xmx2048m -Dorg.slf4j.simpleLogger.defaultLogLevel=off -Dopennlp.model.v15.base.url="${opennlp.model.v15.base.url}"</argLine>
297297
<forkCount>${opennlp.forkCount}</forkCount>
298298
<failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
299299
<excludes>
@@ -318,7 +318,7 @@
318318
</execution>
319319
</executions>
320320
<configuration>
321-
<argLine>-DOPENNLP_DOWNLOAD_HOME=${opennlp.download.home}</argLine>
321+
<argLine>-DOPENNLP_DOWNLOAD_HOME=${opennlp.download.home} -Dopennlp.model.v15.base.url="${opennlp.model.v15.base.url}"</argLine>
322322
<excludes>
323323
<exclude>**/*Test.java</exclude>
324324
</excludes>
@@ -621,6 +621,7 @@
621621
<id>ci</id>
622622
<properties>
623623
<opennlp.download.home>${project.build.directory}</opennlp.download.home>
624+
<opennlp.model.v15.base.url>https://nightlies.apache.org/opennlp/models-1.5/</opennlp.model.v15.base.url>
624625
</properties>
625626
</profile>
626627

0 commit comments

Comments
 (0)