Browse Source

Upgrade to HtmlUnit 4.2.0 and Selenium HtmlUnit 4.20

Closes gh-41178
Closes gh-41179
pull/41208/head
Stéphane Nicoll 2 years ago committed by Andy Wilkinson
parent
commit
17ca0421e7
  1. 8
      spring-boot-project/spring-boot-dependencies/build.gradle
  2. 8
      spring-boot-project/spring-boot-docs/build.gradle
  3. 4
      spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/springmvctests/MyHtmlUnitTests.java
  4. 4
      spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/springbootapplications/springmvctests/MyHtmlUnitTests.kt
  5. 6
      spring-boot-project/spring-boot-test-autoconfigure/build.gradle
  6. 4
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/AutoConfigureMockMvc.java
  7. 4
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcWebClientAutoConfiguration.java
  8. 4
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcWebDriverAutoConfiguration.java
  9. 6
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebClientIntegrationTests.java
  10. 6
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverIntegrationTests.java
  11. 4
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWithAutoConfigureMockMvcIntegrationTests.java
  12. 8
      spring-boot-project/spring-boot-test/build.gradle
  13. 8
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClient.java
  14. 4
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriver.java
  15. 10
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClientTests.java
  16. 16
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java
  17. 4
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/build.gradle
  18. 6
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/test/java/smoketest/test/web/UserVehicleControllerHtmlUnitTests.java

8
spring-boot-project/spring-boot-dependencies/build.gradle

@ -563,8 +563,8 @@ bom { @@ -563,8 +563,8 @@ bom {
]
}
}
library("HtmlUnit", "2.70.0") {
group("net.sourceforge.htmlunit") {
library("HtmlUnit", "4.2.0") {
group("org.htmlunit") {
modules = [
"htmlunit" {
exclude group: "commons-logging", module: "commons-logging"
@ -1826,10 +1826,10 @@ bom { @@ -1826,10 +1826,10 @@ bom {
releaseNotes("https://github.com/SeleniumHQ/selenium/releases/tag/selenium-{version}")
}
}
library("Selenium HtmlUnit", "4.13.0") {
library("Selenium HtmlUnit", "4.20.0") {
group("org.seleniumhq.selenium") {
modules = [
"htmlunit-driver"
"htmlunit3-driver"
]
}
links {

8
spring-boot-project/spring-boot-docs/build.gradle

@ -80,10 +80,6 @@ dependencies { @@ -80,10 +80,6 @@ dependencies {
implementation("jakarta.persistence:jakarta.persistence-api")
implementation("jakarta.servlet:jakarta.servlet-api")
implementation("jakarta.validation:jakarta.validation-api")
implementation("net.sourceforge.htmlunit:htmlunit") {
exclude group: "commons-logging", module: "commons-logging"
exclude group: "xml-apis", module: "xml-apis"
}
implementation("org.apache.httpcomponents.client5:httpclient5")
implementation("org.apache.commons:commons-dbcp2") {
exclude group: "commons-logging", module: "commons-logging"
@ -102,6 +98,10 @@ dependencies { @@ -102,6 +98,10 @@ dependencies {
exclude group: "javax.xml.bind", module: "jaxb-api"
exclude group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec"
}
implementation("org.htmlunit:htmlunit") {
exclude group: "commons-logging", module: "commons-logging"
exclude group: "xml-apis", module: "xml-apis"
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jooq:jooq") {
exclude group: "javax.xml.bind", module: "jaxb-api"

4
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/springmvctests/MyHtmlUnitTests.java

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
package org.springframework.boot.docs.testing.springbootapplications.springmvctests;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlPage;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

4
spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/springbootapplications/springmvctests/MyHtmlUnitTests.kt

@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
package org.springframework.boot.docs.features.testing.springbootapplications.springmvctests
import com.gargoylesoftware.htmlunit.WebClient
import com.gargoylesoftware.htmlunit.html.HtmlPage
import org.assertj.core.api.Assertions.assertThat
import org.htmlunit.WebClient
import org.htmlunit.html.HtmlPage
import org.junit.jupiter.api.Test
import org.mockito.BDDMockito.given
import org.springframework.beans.factory.annotation.Autowired

6
spring-boot-project/spring-boot-test-autoconfigure/build.gradle

@ -20,12 +20,12 @@ dependencies { @@ -20,12 +20,12 @@ dependencies {
optional("com.google.code.gson:gson")
optional("com.jayway.jsonpath:json-path")
optional("com.sun.xml.messaging.saaj:saaj-impl")
optional("net.sourceforge.htmlunit:htmlunit") {
optional("org.hibernate.orm:hibernate-core")
optional("org.htmlunit:htmlunit") {
exclude group: "commons-logging", module: "commons-logging"
}
optional("org.hibernate.orm:hibernate-core")
optional("org.junit.jupiter:junit-jupiter-api")
optional("org.seleniumhq.selenium:htmlunit-driver") {
optional("org.seleniumhq.selenium:htmlunit3-driver") {
exclude(group: "commons-logging", module: "commons-logging")
exclude(group: "com.sun.activation", module: "jakarta.activation")
}

4
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/AutoConfigureMockMvc.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@ import java.lang.annotation.Retention; @@ -23,7 +23,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.gargoylesoftware.htmlunit.WebClient;
import org.htmlunit.WebClient;
import org.openqa.selenium.WebDriver;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;

4
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcWebClientAutoConfiguration.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.web.servlet;
import com.gargoylesoftware.htmlunit.WebClient;
import org.htmlunit.WebClient;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;

4
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcWebDriverAutoConfiguration.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,7 +18,7 @@ package org.springframework.boot.test.autoconfigure.web.servlet; @@ -18,7 +18,7 @@ package org.springframework.boot.test.autoconfigure.web.servlet;
import java.util.concurrent.Executors;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import org.htmlunit.BrowserVersion;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

6
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebClientIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
package org.springframework.boot.test.autoconfigure.web.servlet.mockmvc;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlPage;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

6
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWebDriverIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,7 +20,7 @@ import org.junit.jupiter.api.MethodOrderer; @@ -20,7 +20,7 @@ import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchWindowException;
import org.openqa.selenium.NoSuchSessionException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@ -59,7 +59,7 @@ class WebMvcTestWebDriverIntegrationTests { @@ -59,7 +59,7 @@ class WebMvcTestWebDriverIntegrationTests {
this.webDriver.get("/html");
WebElement element = this.webDriver.findElement(By.tagName("body"));
assertThat(element.getText()).isEqualTo("Hello");
assertThatExceptionOfType(NoSuchWindowException.class).isThrownBy(previousWebDriver::getWindowHandle);
assertThatExceptionOfType(NoSuchSessionException.class).isThrownBy(previousWebDriver::getWindowHandle);
assertThat(previousWebDriver).isNotNull().isNotSameAs(this.webDriver);
}

4
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestWithAutoConfigureMockMvcIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.boot.test.autoconfigure.web.servlet.mockmvc;
import com.gargoylesoftware.htmlunit.WebClient;
import org.htmlunit.WebClient;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.WebDriver;

8
spring-boot-project/spring-boot-test/build.gradle

@ -23,12 +23,15 @@ dependencies { @@ -23,12 +23,15 @@ dependencies {
optional("org.assertj:assertj-core")
optional("org.hamcrest:hamcrest-core")
optional("org.hamcrest:hamcrest-library")
optional("org.htmlunit:htmlunit") {
exclude(group: "commons-logging", module: "commons-logging")
}
optional("org.jetbrains.kotlin:kotlin-stdlib")
optional("org.jetbrains.kotlin:kotlin-reflect")
optional("org.junit.jupiter:junit-jupiter-api")
optional("org.mockito:mockito-core")
optional("org.skyscreamer:jsonassert")
optional("org.seleniumhq.selenium:htmlunit-driver") {
optional("org.seleniumhq.selenium:htmlunit3-driver") {
exclude(group: "commons-logging", module: "commons-logging")
exclude(group: "com.sun.activation", module: "jakarta.activation")
}
@ -36,9 +39,6 @@ dependencies { @@ -36,9 +39,6 @@ dependencies {
optional("org.springframework:spring-web")
optional("org.springframework:spring-webflux")
optional("org.springframework.graphql:spring-graphql-test")
optional("net.sourceforge.htmlunit:htmlunit") {
exclude(group: "commons-logging", module: "commons-logging")
}
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation("io.mockk:mockk")

8
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClient.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,9 +18,9 @@ package org.springframework.boot.test.web.htmlunit; @@ -18,9 +18,9 @@ package org.springframework.boot.test.web.htmlunit;
import java.io.IOException;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;
import org.htmlunit.FailingHttpStatusCodeException;
import org.htmlunit.Page;
import org.htmlunit.WebClient;
import org.springframework.core.env.Environment;
import org.springframework.util.Assert;

4
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.boot.test.web.htmlunit.webdriver;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import org.htmlunit.BrowserVersion;
import org.openqa.selenium.Capabilities;
import org.springframework.core.env.Environment;

10
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/LocalHostWebClientTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,10 +19,10 @@ package org.springframework.boot.test.web.htmlunit; @@ -19,10 +19,10 @@ package org.springframework.boot.test.web.htmlunit;
import java.io.IOException;
import java.net.URL;
import com.gargoylesoftware.htmlunit.StringWebResponse;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebConnection;
import com.gargoylesoftware.htmlunit.WebResponse;
import org.htmlunit.StringWebResponse;
import org.htmlunit.WebClient;
import org.htmlunit.WebConnection;
import org.htmlunit.WebResponse;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;

16
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,13 +18,13 @@ package org.springframework.boot.test.web.htmlunit.webdriver; @@ -18,13 +18,13 @@ package org.springframework.boot.test.web.htmlunit.webdriver;
import java.net.URL;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.TopLevelWindow;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebClientOptions;
import com.gargoylesoftware.htmlunit.WebConsole;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebWindow;
import org.htmlunit.BrowserVersion;
import org.htmlunit.TopLevelWindow;
import org.htmlunit.WebClient;
import org.htmlunit.WebClientOptions;
import org.htmlunit.WebConsole;
import org.htmlunit.WebRequest;
import org.htmlunit.WebWindow;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentMatcher;

4
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/build.gradle

@ -12,12 +12,12 @@ dependencies { @@ -12,12 +12,12 @@ dependencies {
runtimeOnly("com.h2database:h2")
testImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test"))
testImplementation("net.sourceforge.htmlunit:htmlunit") {
testImplementation("org.htmlunit:htmlunit") {
exclude group: "commons-logging", module: "commons-logging"
}
testImplementation("org.mockito:mockito-junit-jupiter")
testImplementation("org.seleniumhq.selenium:selenium-api")
testImplementation("org.seleniumhq.selenium:htmlunit-driver") {
testImplementation("org.seleniumhq.selenium:htmlunit3-driver") {
exclude group: "commons-logging", module: "commons-logging"
exclude(group: "com.sun.activation", module: "jakarta.activation")
}

6
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-test/src/test/java/smoketest/test/web/UserVehicleControllerHtmlUnitTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
package smoketest.test.web;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.WebClient;
import org.htmlunit.html.HtmlPage;
import org.junit.jupiter.api.Test;
import smoketest.test.service.VehicleDetails;

Loading…
Cancel
Save