Skip to content

Commit bbfed25

Browse files
authored
OPENNLP-1760: Make SourceForge URLs in Tests Configurable to Avoid 403/Rate Limiting Issues (#817)
1 parent 2cfc94a commit bbfed25

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

opennlp-core/opennlp-cli/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-core/opennlp-runtime/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.2-2.5.0";

opennlp-extensions/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

opennlp-tools/src/test/java/opennlp/tools/namefind/AbstractNameFinderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ abstract class AbstractNameFinderTest {
4646
protected static final Path OPENNLP_DIR = Paths.get(System.getProperty("OPENNLP_DOWNLOAD_HOME",
4747
System.getProperty("user.home"))).resolve(".opennlp");
4848

49-
private static final String BASE_URL_MODELS_V15 = "https://opennlp.sourceforge.net/models-1.5/";
49+
private static final String BASE_URL_MODELS_V15 = System.getProperty("opennlp.model.v15.base.url", "https://opennlp.sourceforge.net/models-1.5/");
5050

5151
protected static boolean hasOtherAsOutcome(TokenNameFinderModel nameFinderModel) {
5252
SequenceClassificationModel model = nameFinderModel.getNameFinderSequenceModel();

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
<groupId>org.apache.maven.plugins</groupId>
340340
<artifactId>maven-surefire-plugin</artifactId>
341341
<configuration>
342-
<argLine>-Xmx2048m -Dorg.slf4j.simpleLogger.defaultLogLevel=off</argLine>
342+
<argLine>-Xmx2048m -Dorg.slf4j.simpleLogger.defaultLogLevel=off -Dopennlp.model.v15.base.url="${opennlp.model.v15.base.url}"</argLine>
343343
<forkCount>${opennlp.forkCount}</forkCount>
344344
<failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
345345
<excludes>
@@ -364,7 +364,7 @@
364364
</execution>
365365
</executions>
366366
<configuration>
367-
<argLine>-DOPENNLP_DOWNLOAD_HOME=${opennlp.download.home}</argLine>
367+
<argLine>-DOPENNLP_DOWNLOAD_HOME=${opennlp.download.home} -Dopennlp.model.v15.base.url="${opennlp.model.v15.base.url}"</argLine>
368368
<excludes>
369369
<exclude>**/*Test.java</exclude>
370370
</excludes>
@@ -667,6 +667,7 @@
667667
<id>ci</id>
668668
<properties>
669669
<opennlp.download.home>${project.build.directory}</opennlp.download.home>
670+
<opennlp.model.v15.base.url>https://nightlies.apache.org/opennlp/models-1.5/</opennlp.model.v15.base.url>
670671
</properties>
671672
</profile>
672673

0 commit comments

Comments
 (0)