Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing symbol for the issue-totals column #1805

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@
<artifactId>assertj-assertions-generator-maven-plugin</artifactId>
<configuration>
<packages>
<package>io.jenkins.plugins.analysis.core.columns</package>
<package>io.jenkins.plugins.analysis.core.scm</package>
<package>io.jenkins.plugins.analysis.core.model</package>
<package>io.jenkins.plugins.analysis.core.util</package>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.verb.POST;
import org.jenkinsci.Symbol;
import hudson.Extension;
import hudson.model.Job;
import hudson.model.Run;
Expand Down Expand Up @@ -233,6 +234,7 @@ public String getUrl(final Job<?, ?> job) {
* @author Ulli Hafner
*/
@Extension(optional = true)
@Symbol("issueTotalsColumn")
public static class IssuesTablePortletDescriptor extends ListViewColumnDescriptor {
@NonNull
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@
import hudson.model.FreeStyleProject;
import hudson.model.HealthReport;
import hudson.model.TopLevelItem;
import hudson.model.View;
import hudson.tasks.Publisher;
import hudson.util.DescribableList;
import hudson.views.ListViewColumn;

import io.jenkins.plugins.analysis.core.columns.IssuesTotalColumn;
import io.jenkins.plugins.analysis.core.columns.Messages;
import io.jenkins.plugins.analysis.core.model.Tool;
import io.jenkins.plugins.analysis.core.steps.IssuesRecorder;
import io.jenkins.plugins.analysis.core.testutil.IntegrationTestWithJenkinsPerTest;
import io.jenkins.plugins.analysis.core.util.IssuesStatistics.StatisticProperties;
import io.jenkins.plugins.analysis.core.util.TrendChartType;
import io.jenkins.plugins.analysis.core.util.WarningsQualityGate.QualityGateType;
import io.jenkins.plugins.analysis.warnings.Java;
import io.jenkins.plugins.casc.ConfigurationAsCode;
import io.jenkins.plugins.casc.ConfiguratorException;
import io.jenkins.plugins.util.QualityGate.QualityGateCriticality;

import static org.assertj.core.api.Assertions.*;
import static io.jenkins.plugins.analysis.core.assertions.Assertions.*;

/**
* Tests the Job DSL Plugin.
Expand All @@ -30,6 +35,28 @@
* @author Lorenz Munsch
*/
class JobDslITest extends IntegrationTestWithJenkinsPerTest {
/**
* Creates a freestyle job from a YAML file and verifies that issue recorder finds warnings.
*/
@Test
void shouldCreateColumnFromYamlConfiguration() {
configureJenkins("column-dsl.yaml");

View view = getJenkins().getInstance().getView("dsl-view");

assertThat(view).isNotNull();

assertThat(view.getColumns())
.extracting(ListViewColumn::getColumnCaption)
.contains(new IssuesTotalColumn().getColumnCaption());

assertThat(view.getColumns()).first()
.isInstanceOfSatisfying(IssuesTotalColumn.class,
c -> assertThat(c)
.hasColumnCaption(Messages.IssuesTotalColumn_Name())
.hasType(StatisticProperties.TOTAL));
}

/**
* Creates a freestyle job from a YAML file and verifies that issue recorder finds warnings.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
jobs:
- script: >
listView("dsl-view") {
jobs {
regex("^bar")
}
recurse(true)
columns {
issueTotalsColumn()
status()
weather()
name()
lastSuccess()
lastFailure()
lastDuration()
testResult(1)
buildButton()
}
}
Loading