Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<version>5.5</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -35,8 +35,8 @@
<revision>1.0</revision>
<changelist>-SNAPSHOT</changelist>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.452</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<jenkins.baseline>2.479</jenkins.baseline>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete ⇨ #788

<jenkins.version>${jenkins.baseline}.3</jenkins.version>
#if( $hostOnJenkinsGitHub == "true" )
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
#end
Expand All @@ -53,7 +53,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package $package;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

import org.htmlunit.html.HtmlForm;
import org.htmlunit.html.HtmlTextInput;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsSessionRule;
import org.junit.jupiter.api.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.junit.jupiter.WithJenkins;

public class SampleConfigurationTest {

@Rule
public JenkinsSessionRule sessions = new JenkinsSessionRule();
@WithJenkins
class SampleConfigurationTest {

/**
* Tries to exercise enough code paths to catch common mistakes:
Expand All @@ -23,23 +21,18 @@ public class SampleConfigurationTest {
* </ul>
*/
@Test
public void uiAndStorage() throws Throwable {
sessions.then(r -> {
assertNull("not set initially", SampleConfiguration.get().getLabel());
HtmlForm config = r.createWebClient().goTo("configure").getFormByName("config");
void uiAndStorage(JenkinsRule jenkins) throws Throwable {
assertNull(SampleConfiguration.get().getLabel(), "not set initially");
try (JenkinsRule.WebClient client = jenkins.createWebClient()) {
HtmlForm config = client.goTo("configure").getFormByName("config");
HtmlTextInput textbox = config.getInputByName("_.label");
textbox.setText("hello");
r.submit(config);
assertEquals(
"global config page let us edit it",
"hello",
SampleConfiguration.get().getLabel());
});
sessions.then(r -> {
assertEquals(
"still there after restart of Jenkins",
"hello",
SampleConfiguration.get().getLabel());
});
jenkins.submit(config);
assertEquals("hello", SampleConfiguration.get().getLabel(), "global config page let us edit it");
}

jenkins.restart();

assertEquals("hello", SampleConfiguration.get().getLabel(), "still there after restart of Jenkins");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.junit.jupiter.WithJenkins;

public class HelloWorldBuilderTest {

@Rule
public JenkinsRule jenkins = new JenkinsRule();
@WithJenkins
class HelloWorldBuilderTest {

final String name = "Bobby";

@Test
public void testConfigRoundtrip() throws Exception {
void testConfigRoundtrip(JenkinsRule jenkins) throws Exception {
FreeStyleProject project = jenkins.createFreeStyleProject();
project.getBuildersList().add(new HelloWorldBuilder(name));
project = jenkins.configRoundtrip(project);
Expand All @@ -27,7 +25,7 @@ public void testConfigRoundtrip() throws Exception {
}

@Test
public void testConfigRoundtripFrench() throws Exception {
void testConfigRoundtripFrench(JenkinsRule jenkins) throws Exception {
FreeStyleProject project = jenkins.createFreeStyleProject();
HelloWorldBuilder builder = new HelloWorldBuilder(name);
builder.setUseFrench(true);
Expand All @@ -40,7 +38,7 @@ public void testConfigRoundtripFrench() throws Exception {
}

@Test
public void testBuild() throws Exception {
void testBuild(JenkinsRule jenkins) throws Exception {
FreeStyleProject project = jenkins.createFreeStyleProject();
HelloWorldBuilder builder = new HelloWorldBuilder(name);
project.getBuildersList().add(builder);
Expand All @@ -50,8 +48,7 @@ public void testBuild() throws Exception {
}

@Test
public void testBuildFrench() throws Exception {

void testBuildFrench(JenkinsRule jenkins) throws Exception {
FreeStyleProject project = jenkins.createFreeStyleProject();
HelloWorldBuilder builder = new HelloWorldBuilder(name);
builder.setUseFrench(true);
Expand All @@ -62,7 +59,7 @@ public void testBuildFrench() throws Exception {
}

@Test
public void testScriptedPipeline() throws Exception {
void testScriptedPipeline(JenkinsRule jenkins) throws Exception {
String agentLabel = "my-agent";
jenkins.createOnlineSlave(Label.get(agentLabel));
WorkflowJob job = jenkins.createProject(WorkflowJob.class, "test-scripted-pipeline");
Expand Down