diff --git a/pom.xml b/pom.xml index 4cbf125e..3b627538 100644 --- a/pom.xml +++ b/pom.xml @@ -11,16 +11,15 @@ org.jenkins-ci.plugins plugin - 4.19 + 4.24 2.0.2 -SNAPSHOT - 2.222.4 + 2.277.4 8 3.1.1 - 1.35 @@ -75,31 +74,28 @@ https://repo.jenkins-ci.org/public + org.slf4j log4j-over-slf4j - 1.7.30 org.slf4j jcl-over-slf4j - 1.7.30 org.slf4j slf4j-api - 1.7.30 org.slf4j slf4j-jdk14 - 1.7.30 com.sonyericsson.hudson.plugins.gerrit gerrit-trigger - 2.27.5 + 2.35.0 true @@ -111,6 +107,18 @@ org.apache.httpcomponents httpclient + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + @@ -144,7 +152,6 @@ org.jenkins-ci.plugins token-macro - 2.5 true @@ -162,17 +169,14 @@ org.jenkins-ci.plugins matrix-project - 1.14 org.jenkins-ci.plugins junit - 1.28 org.jenkins-ci.plugins apache-httpcomponents-client-4-api - 4.5.3-2.0 org.mongodb @@ -193,24 +197,21 @@ com.fasterxml.jackson.core jackson-annotations + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + org.jenkins-ci.plugins jackson2-api - 2.11.0 org.jenkins-ci.plugins.workflow workflow-api - 2.42 true - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - 2.11.0 - com.google.guava guava @@ -225,7 +226,7 @@ commons-net commons-net - 3.6 + 3.8.0 com.axis.system.jenkins.plugins.downstream @@ -236,50 +237,42 @@ org.jenkins-ci.plugins.workflow workflow-cps - 2.24 test org.jenkins-ci.plugins.workflow workflow-durable-task-step - 2.15 test org.jenkinsci.plugins pipeline-model-definition - 1.0 test org.jenkins-ci.plugins.workflow workflow-scm-step - 2.3 test io.jenkins configuration-as-code - ${configuration-as-code.version} test io.jenkins.configuration-as-code test-harness - ${configuration-as-code.version} test org.jenkins-ci.plugins structs - 1.20 true org.jenkins-ci.plugins cloudbees-folder - 5.12 true @@ -298,49 +291,41 @@ org.jenkins-ci.plugins credentials - 2.2.0 true org.jenkins-ci.plugins matrix-auth - 1.2 true org.jenkins-ci.plugins.workflow workflow-job - 2.41 true org.jenkins-ci.plugins scm-api - 2.6.4 true org.jenkins-ci.plugins script-security - 1.75 true org.jenkins-ci.plugins.workflow workflow-step-api - 2.23 true org.jenkins-ci.plugins.workflow workflow-support - 3.8 test org.jenkins-ci.plugins pipeline-build-step - 2.5.1 test @@ -367,7 +352,6 @@ org.jenkins-ci.plugins git-client - 1.21.0 test @@ -382,6 +366,37 @@ 4.0.2.6 + + + + io.jenkins.tools.bom + bom-2.277.x + 950.v396cb834de1e + import + pom + + + org.apache.commons + commons-compress + 1.20 + + + org.json + json + 20210307 + + + joda-time + joda-time + 2.10.2 + + + com.google.code.gson + gson + 2.8.6 + + + @@ -446,14 +461,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - org.apache.maven.plugins maven-checkstyle-plugin diff --git a/src/test/java/com/sonyericsson/jenkins/plugins/bfa/PluginImplHudsonTest.java b/src/test/java/com/sonyericsson/jenkins/plugins/bfa/PluginImplHudsonTest.java index f947beef..0f9bac3a 100644 --- a/src/test/java/com/sonyericsson/jenkins/plugins/bfa/PluginImplHudsonTest.java +++ b/src/test/java/com/sonyericsson/jenkins/plugins/bfa/PluginImplHudsonTest.java @@ -29,10 +29,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlSelect; -import com.gargoylesoftware.htmlunit.html.HtmlTable; -import com.gargoylesoftware.htmlunit.html.HtmlTableCell; import com.gargoylesoftware.htmlunit.html.HtmlTextInput; - import com.sonyericsson.jenkins.plugins.bfa.db.KnowledgeBase; import com.sonyericsson.jenkins.plugins.bfa.db.LocalFileKnowledgeBase; import com.sonyericsson.jenkins.plugins.bfa.db.MongoDBKnowledgeBase; @@ -43,6 +40,7 @@ import hudson.ExtensionList; import hudson.util.Secret; import net.sf.json.JSONObject; +import org.apache.commons.lang.StringUtils; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.JenkinsRule; @@ -52,18 +50,17 @@ import org.kohsuke.stapler.WebApp; import org.powermock.reflect.Whitebox; -import java.util.Collections; -import java.util.List; - import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; +import java.util.Collections; +import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; - import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isA; @@ -89,6 +86,7 @@ public class PluginImplHudsonTest { /** * Tests that boolean configure parameters are persisted. + * * @throws Exception if so */ @Test @@ -229,6 +227,7 @@ public void testConfigureConvertSameType() throws Exception { /** * Tests {@link PluginImpl#configure(org.kohsuke.stapler.StaplerRequest, net.sf.json.JSONObject)}. * Tests that a LocalFileKnowledgebase is preserved through a reconfigure without changes. + * * @throws Exception if so. */ @Test @@ -286,16 +285,17 @@ public void testConfigureIdenticalMongoKB() throws Exception { private void assertConfigPageRendering(DifferentKnowledgeBase knowledgeBase, HtmlPage page) { //Check that the select box has the correct value HtmlElement element = getStorageTypeRow(page); - HtmlElement settingsMainElement = element.getOneHtmlElementByAttribute("td", "class", "setting-main"); + assertNotNull("Should have found the base div", element); + HtmlElement settingsMainElement = element.getOneHtmlElementByAttribute("div", "class", "setting-main"); HtmlSelect select = (HtmlSelect)settingsMainElement.getChildElements().iterator().next(); assertEquals(knowledgeBase.getDescriptor().getDisplayName(), select.getSelectedOptions().get(0).getText()); //Check that it has the someString input field with correct value - DomNode container = settingsMainElement.getEnclosingElement("tr").getNextSibling(); - HtmlTable table = page.getDocumentElement().getOneHtmlElementByAttribute("table", "name", "knowledgeBase"); + DomNode container = settingsMainElement.getEnclosingElement("div").getNextSibling(); + HtmlElement table = page.getDocumentElement().getOneHtmlElementByAttribute("div", "name", "knowledgeBase"); assertSame("The table should be inside the dropDownContainer", container, table.getParentNode().getParentNode()); - HtmlTableCell cell = table.getCellAt(1, 2); - HtmlTextInput someStringInput = (HtmlTextInput)cell.getHtmlElementDescendants().iterator().next(); + final HtmlTextInput someStringInput = table.getOneHtmlElementByAttribute("input", "name", "_.someString"); + assertNotNull("Should have found some text input", someStringInput); assertEquals(knowledgeBase.getSomeString(), someStringInput.getText()); } @@ -306,10 +306,11 @@ private void assertConfigPageRendering(DifferentKnowledgeBase knowledgeBase, Htm * @return the table row. */ private HtmlElement getStorageTypeRow(HtmlPage page) { - List elements = page.getDocumentElement().getElementsByAttribute("td", "class", "setting-name"); + List elements = page.getDocumentElement().getElementsByAttribute( + "div", "class", "setting-name help-sibling"); for (HtmlElement element : elements) { - if ("Storage type".equals(element.getTextContent())) { - return element.getEnclosingElement("tr"); + if ("Storage type".equals(StringUtils.trim(element.getTextContent()))) { + return element.getEnclosingElement("div"); } } return null; @@ -320,7 +321,7 @@ private HtmlElement getStorageTypeRow(HtmlPage page) { * * @param expectedNoCauseMessage the text for noCausesMessage. * @param convert if convertion should be run or not, set to null no not put the value in the form. - * @param nrOfScanThreads the number of threads. + * @param nrOfScanThreads the number of threads. * @return the form data. */ private JSONObject createForm(String expectedNoCauseMessage, int nrOfScanThreads, Boolean convert) {