Skip to content
Closed
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cf431e4
"This recipe is intended to break down the modernization of very old …
gounthar Dec 2, 2023
2a2c15d
"This recipe is intended to break down the modernization of very old …
gounthar Dec 4, 2023
bbbb720
Commons lang
gounthar Dec 14, 2023
ead4dec
More recent version of mockito.
gounthar Dec 14, 2023
e53165f
Compiles
gounthar Dec 14, 2023
6617f38
JDK21
gounthar Dec 14, 2023
d89797d
JDK21
gounthar Dec 14, 2023
414ec48
fdfsfs
gounthar Dec 14, 2023
f55cc8e
Removed SpotBugs issues.
gounthar Dec 15, 2023
556d071
Removed SpotBugs found issues.
gounthar Dec 15, 2023
3a5d59e
Removed SpotBugs found issues.
gounthar Dec 15, 2023
69dd8af
Use https: for scm URL, not git:
gounthar Dec 15, 2023
d7eed45
Corrected SpotBugs found issues.
gounthar Dec 15, 2023
c094980
Increase SpotBugs checks.
gounthar Dec 15, 2023
10cb4ce
The overridable method initJobFilters is being called from the constr…
gounthar Dec 15, 2023
17d873a
Automate dependency updates
gounthar Dec 15, 2023
c6acee7
Publish incremental development artifacts
gounthar Dec 15, 2023
2f06c1f
Merge branch 'master' into jdk8-removal
gounthar Dec 15, 2023
1de0e8a
Update src/main/java/hudson/plugins/sectioned_view/FolderViewSection.…
gounthar Dec 17, 2023
4e89498
Modernization for Java 21.
gounthar Dec 2, 2023
74259d4
Merge branch 'jdk8-removal' of https://github.com/gounthar/sectioned-…
gounthar Dec 17, 2023
1f093fb
Merge branch 'master' into jdk8-removal
gounthar Aug 26, 2024
edcfd3a
Merge branch 'master' into jdk8-removal
basil Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
# Maintain dependencies for your plugin
- package-ecosystem: maven
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 10
target-branch: master
# Maintain dependencies for GitHub Actions
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
7 changes: 7 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.7</version>
</extension>
</extensions>
2 changes: 2 additions & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
13 changes: 9 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env groovy

/* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */
buildPlugin()
/*
See the documentation for more options:
https://github.com/jenkins-infra/pipeline-library/
*/ buildPlugin(
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
])
26 changes: 26 additions & 0 deletions modifications.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/pom.xml b/pom.xml
index 08b78fc..5911846 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,9 +1,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <parent>
+ <parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
- <version>2.23</version>
+ <version>4.51</version>
+ <relativePath/>
</parent>

<artifactId>sectioned-view</artifactId>
@@ -48,7 +49,7 @@
</pluginRepositories>

<properties>
- <jenkins.version>1.580.3</jenkins.version>
+ <jenkins.version>2.346.3</jenkins.version>
<java.version>6</java.version>
<findbugs.failOnError>false</findbugs.failOnError>
</properties>
50 changes: 36 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.23</version>
<version>4.76</version>
<relativePath/>
</parent>

<artifactId>sectioned-view</artifactId>
<packaging>hpi</packaging>
<name>Sectioned View Plugin</name>
<version>1.27-SNAPSHOT</version>
<version>${revision}${changelist}</version>
<url>http://wiki.jenkins-ci.org/display/JENKINS/Sectioned+View+Plugin</url>
<developers>
<developer>
Expand All @@ -28,11 +29,22 @@
</licenses>

<scm>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:[email protected]:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<tag>HEAD</tag>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:[email protected]:${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.401.x</artifactId>
<version>2582.v830625dd636c</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<repositories>
<repository>
Expand All @@ -48,41 +60,51 @@
</pluginRepositories>

<properties>
<jenkins.version>1.580.3</jenkins.version>
<java.version>6</java.version>
<revision>1.26</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/sectioned-view-plugin</gitHubRepo>
<jenkins.version>2.401.3</jenkins.version>
<findbugs.failOnError>false</findbugs.failOnError>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
</properties>

<dependencies>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-lang3-api</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.19</version>
<scope>test</scope>
<exclusions>
<exclusion>
<!-- brought in by io.jenkins.plugins:commons-lang3-api -->
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>antisamy-markup-formatter</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<optional>true</optional>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>5.18</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ public void addChildren(TopLevelItem item, Node node, int baseFolderLevel) {
}

private boolean filter(TopLevelItem item, int baseFolderLevel) {
boolean allow = true;
if (!(item instanceof Folder) & hideJobs) allow = false;
boolean allow = !(!(item instanceof Folder) & hideJobs);
if (regexFilter != null && !regexFilter.isEmpty() && !regexFilterPattern.matcher(item.getName()).matches()) allow = false;
if (folderLevels != null && item.getFullName().length() - item.getFullName().replace("/", "").length() >
(folderLevels + baseFolderLevel)) allow = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public static List<ListViewColumn> getDefaultColumns() {
Descriptor<ListViewColumn> des = all.find(d);
if (des != null) {
try {
r.add(des.newInstance(null, null));
JSONObject json = new JSONObject();
r.add(des.newInstance(null, json));
} catch (FormException e) {
LOGGER.log(Level.WARNING, "Failed to instantiate "+des.clazz,e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package hudson.plugins.sectioned_view;

import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.DescriptorExtensionList;
import hudson.ExtensionPoint;
import hudson.model.Describable;
Expand All @@ -48,16 +49,14 @@
import jenkins.model.Jenkins;
import org.kohsuke.stapler.Stapler;

import javax.annotation.Nonnull;

public abstract class SectionedViewSection implements ExtensionPoint, Describable<SectionedViewSection> {

public SectionedViewSection(String name, Width width, Positioning alignment) {
this.name = name;
this.width = width;
this.alignment = alignment;
determineCss();
initJobFilters();
this.jobFilters = new DescribableList<ViewJobFilter, Descriptor<ViewJobFilter>>(Saveable.NOOP, new ArrayList<ViewJobFilter>());
}

/**
Expand Down Expand Up @@ -97,7 +96,7 @@ public static DescriptorExtensionList<SectionedViewSection, SectionedViewSection
return Hudson.getInstance().<SectionedViewSection, SectionedViewSectionDescriptor>getDescriptorList(SectionedViewSection.class);
}

public @Nonnull String getName() {
public @NonNull String getName() {
return name == null ? "" : name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ public boolean hasJobFilterExtensions() {

@Override
public SectionedViewSection newInstance(StaplerRequest req, JSONObject formData) throws FormException {
assert req != null;
SectionedViewSection section = (SectionedViewSection)req.bindJSON(getClass().getDeclaringClass(), formData);

assert section != null;
if (formData.get("useincluderegex") != null) {
JSONObject merp = formData.getJSONObject("useincluderegex");
try {
section.setIncludeRegex(Util.nullify(merp.getString("includeRegex")));
String merpString = merp.getString("includeRegex");
assert merpString != null;
merpString = Util.nullify(merpString);
assert merpString != null;
section.setIncludeRegex(merpString);
} catch (PatternSyntaxException e) {
throw new FormException("Regular expression is invalid: " + e.getMessage(), e, "includeRegex");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public static final class DescriptorImpl extends SectionedViewSectionDescriptor

@Override
public SectionedViewSection newInstance(StaplerRequest req, JSONObject formData) throws FormException {
assert req != null;
return (SectionedViewSection)req.bindJSON(getClass().getDeclaringClass(), formData);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.mockito.Matchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import com.gargoylesoftware.htmlunit.html.HtmlButton;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlButton;
import org.htmlunit.html.HtmlElement;
import org.htmlunit.html.HtmlForm;
import org.htmlunit.html.HtmlInput;
import org.htmlunit.html.HtmlPage;
import hudson.markup.RawHtmlMarkupFormatter;
import hudson.model.Descriptor;
import hudson.model.ItemGroup;
Expand Down Expand Up @@ -69,8 +69,7 @@ public void doNotEnumerateItemsRepeatedly() throws Exception {

@Test @Issue("JENKINS-44987")
public void htmlUI() throws Exception {
String MARKUP = "<div><b><a href=\"adsf\">LVS</a></b></div>";

String MARKUP = "<div><b><a href=\"adsf\" rel=\"nofollow noopener noreferrer\">LVS</a></b></div>";
j.jenkins.setMarkupFormatter(new RawHtmlMarkupFormatter(false));

SectionedView sw = new SectionedView("SW");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package hudson.plugins.sectioned_view;

import static org.junit.Assert.*;

import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
Expand All @@ -15,23 +13,28 @@

import java.io.IOException;
import java.util.Collections;
import java.util.Objects;
import java.util.regex.Pattern;

import static org.junit.Assert.assertTrue;

/**
* @author ogondza.
*/
public class TestResultViewSectionTest {

public @Rule JenkinsRule j = new JenkinsRule();

@Test
public void showIt() throws Exception {
FreeStyleProject p = j.createFreeStyleProject("test_project");
p.getPublishersList().add(new JUnitResultArchiver("*.xml", false, null, 1));
p.getPublishersList().add(new JUnitResultArchiver("*.xml"));
p.getBuildersList().add(new TestBuilder() {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
build.getWorkspace().child("result.xml").copyFrom(TestResultViewSectionTest.class.getResourceAsStream("junit-report-1472.xml"));
Objects.requireNonNull(build.getWorkspace()).child("result.xml").
copyFrom(Objects.requireNonNull(TestResultViewSectionTest.class.
getResourceAsStream("junit-report-1472.xml")));
return true;
}
});
Expand Down