Skip to content

Commit

Permalink
Upgrade HtmlUnit from 2.x to 3.x (#237)
Browse files Browse the repository at this point in the history
* Upgrade HtmlUnit from 2.x to 3.x

* Fix migration incorrectly modifying code

* Ensure metrics plugin is available during tests

---------

Co-authored-by: Tim Jacomb <timjacomb1@gmail.com>
Co-authored-by: Greybird <arnaud.dev@gmail.com>
  • Loading branch information
3 people authored Jun 5, 2023
1 parent 3b3b4a4 commit e473ab3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.62</version>
<version>4.66</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -209,6 +209,11 @@
<artifactId>workflow-step-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>metrics</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/hudson/plugins/claim/ClaimBFATest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hudson.plugins.claim;

import com.gargoylesoftware.htmlunit.html.*;
import org.htmlunit.html.*;
import com.sonyericsson.jenkins.plugins.bfa.PluginImpl;
import com.sonyericsson.jenkins.plugins.bfa.model.FailureCause;
import hudson.model.Build;
Expand Down Expand Up @@ -38,7 +38,7 @@ public class ClaimBFATest {

@Before
public void setUp() throws Exception {
java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.SEVERE);
java.util.logging.Logger.getLogger("org.htmlunit").setLevel(java.util.logging.Level.SEVERE);

j.jenkins.setAuthorizationStrategy(new FullControlOnceLoggedInAuthorizationStrategy());
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/hudson/plugins/claim/ClaimGroovyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ClaimGroovyTest {

@Before
public void setUp() throws Exception {
java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.SEVERE);
java.util.logging.Logger.getLogger("org.htmlunit").setLevel(java.util.logging.Level.SEVERE);

JenkinsRule.DummySecurityRealm realm = j.createDummySecurityRealm();
realm.loadUserByUsername(ADMIN_WITH_NO_RUN_SCRIPT_RIGHTS);
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/hudson/plugins/claim/ClaimReportTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hudson.plugins.claim;

import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.html.DomElement;
import org.htmlunit.html.HtmlPage;
import hudson.model.FreeStyleProject;
import hudson.model.User;
import org.junit.Before;
Expand All @@ -25,7 +25,7 @@ public class ClaimReportTest {
@Before
public void setUp() throws Exception {

java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.SEVERE);
java.util.logging.Logger.getLogger("org.htmlunit").setLevel(java.util.logging.Level.SEVERE);
}

private FreeStyleProject createFailingJobWithName(String jobName) throws IOException,
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/hudson/plugins/claim/ClaimTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
package hudson.plugins.claim;

import com.gargoylesoftware.htmlunit.html.*;
import org.htmlunit.html.*;
import hudson.model.Build;
import hudson.model.Project;
import hudson.model.Result;
Expand Down Expand Up @@ -53,7 +53,7 @@ public class ClaimTest {

@Before
public void setUp() throws Exception {
java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.SEVERE);
java.util.logging.Logger.getLogger("org.htmlunit").setLevel(java.util.logging.Level.SEVERE);

j.jenkins.setAuthorizationStrategy(new FullControlOnceLoggedInAuthorizationStrategy());
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/hudson/plugins/claim/UserClaimsReportTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hudson.plugins.claim;

import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlPage;
import hudson.model.FreeStyleProject;
import hudson.model.User;
import org.junit.Before;
Expand All @@ -24,7 +24,7 @@ public class UserClaimsReportTest {
@Before
public void setUp() throws Exception {

java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.SEVERE);
java.util.logging.Logger.getLogger("org.htmlunit").setLevel(java.util.logging.Level.SEVERE);
}

private FreeStyleProject createFailingJobWithName(String jobName) throws IOException,
Expand Down

0 comments on commit e473ab3

Please sign in to comment.