[
https://issues.apache.org/jira/browse/NUTCH-2971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18041310#comment-18041310
]
ASF GitHub Bot commented on NUTCH-2971:
---------------------------------------
sebastian-nagel commented on code in PR #870:
URL: https://github.com/apache/nutch/pull/870#discussion_r2571801576
##########
build.xml:
##########
@@ -86,6 +86,10 @@
<ivy:dependencytree />
</target>
+ <target name="dependencytests" depends="resolve-test" description="Show unit
tests dependency tree">
Review Comment:
+1
##########
src/plugin/protocol-http/src/test/org/apache/nutch/protocol/http/TestProtocolHttpByProxy.java:
##########
@@ -30,26 +31,43 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.io.IOException;
+import java.net.ServerSocket;
+
/**
* Test cases for protocol-http by proxy
*/
public class TestProtocolHttpByProxy extends AbstractHttpProtocolPluginTest {
public static final String PROXY_HOST = "localhost";
- public static final Integer PROXY_PORT = 8888;
+ public Integer proxyPort = 8888;
public static final String TARGET_HOST = "www.baidu.com";
public static final Integer TARGET_PORT = 443;
+
+ private HttpProxyServer server;
@BeforeEach
public void setUp() throws Exception {
super.setUp();
+ proxyPort = findOpenPort();
conf.set("http.proxy.host", PROXY_HOST);
- conf.set("http.proxy.port", PROXY_PORT.toString());
+ conf.set("http.proxy.port", proxyPort.toString());
http.setConf(conf);
- HttpProxyServer server = DefaultHttpProxyServer.bootstrap()
- .withPort(PROXY_PORT).start();
+ server = DefaultHttpProxyServer.bootstrap()
+ .withPort(proxyPort).start();
+ }
+
+ private Integer findOpenPort() throws IOException {
Review Comment:
Great! This was an annoying issue, the protocol tests failing randomly from
time to time because the port was occupied.
> Unit tests fail with JDK 17
> ---------------------------
>
> Key: NUTCH-2971
> URL: https://issues.apache.org/jira/browse/NUTCH-2971
> Project: Nutch
> Issue Type: Sub-task
> Components: build, test
> Affects Versions: 1.20
> Reporter: Sebastian Nagel
> Priority: Major
> Fix For: 1.22
>
> Attachments: TEST-org.apache.nutch.crawl.TestCrawlDbStates.txt
>
>
> When build and run using JDK 17 unit tests in TestIndexerMapReduce and
> TestCrawlDbStates fail with:
> {noformat}
> java.lang.reflect.InaccessibleObjectException: Unable to make protected final
> java.lang.Class ... accessible: ...
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)