Skip to content

Commit

Permalink
[java] enabled and fixed unit tests of the http client
Browse files Browse the repository at this point in the history
  • Loading branch information
joerg1985 committed Aug 19, 2024
1 parent 25c8376 commit f4ef7be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion java/test/org/openqa/selenium/remote/http/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ load("//java:version.bzl", "TOOLS_JAVA_VERSION")
java_test_suite(
name = "small-tests",
size = "small",
srcs = glob(["*.java"]),
srcs = glob([
"*.java",
"jdk/*.java",
]),
javacopts = [
"--release",
TOOLS_JAVA_VERSION,
Expand All @@ -15,6 +18,7 @@ java_test_suite(
"//java/src/org/openqa/selenium:core",
"//java/src/org/openqa/selenium/remote/http",
"//java/test/org/openqa/selenium/environment",
"//java/test/org/openqa/selenium/remote/internal:test-lib",
"//java/test/org/openqa/selenium/testing:annotations",
artifact("org.assertj:assertj-core"),
artifact("com.google.guava:guava"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,19 @@ public void shouldAllowConfigurationFromSystemProperties() {
delegate =
req -> {
try {
Thread.sleep(1100);
Thread.sleep(3000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return new HttpResponse().setContent(Contents.utf8String("Connection timed out"));
};
try {
System.setProperty("webdriver.httpclient.connectionTimeout", "1");
System.setProperty("webdriver.httpclient.readTimeout", "300");
System.setProperty("webdriver.httpclient.readTimeout", "2");
System.setProperty("webdriver.httpclient.version", "HTTP_1_1");
ClientConfig clientConfig = ClientConfig.defaultConfig();
assertThat(clientConfig.connectionTimeout()).isEqualTo(Duration.ofSeconds(1));
assertThat(clientConfig.readTimeout()).isEqualTo(Duration.ofSeconds(300));
assertThat(clientConfig.readTimeout()).isEqualTo(Duration.ofSeconds(2));
assertThat(clientConfig.version()).isEqualTo("HTTP_1_1");
HttpClient client =
createFactory().createClient(clientConfig.baseUri(URI.create(server.whereIs("/"))));
Expand Down

0 comments on commit f4ef7be

Please sign in to comment.