Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Commit 6f9944b

Browse files
committed
add the test of triggering remote jobs in a folder
1 parent 55caec6 commit 6f9944b

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/test/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfigurationTest.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.junit.Test;
2424
import org.jvnet.hudson.test.JenkinsRule;
2525
import org.jvnet.hudson.test.MockAuthorizationStrategy;
26+
import org.jvnet.hudson.test.MockFolder;
2627
import org.jvnet.hudson.test.WithoutJenkins;
2728

2829
import hudson.AbortException;
@@ -85,7 +86,7 @@ public void testRemoteBuildWithCrumb() throws Exception {
8586
_testRemoteBuild(false);
8687
}
8788

88-
private void _testRemoteBuild(boolean authenticate) throws Exception {
89+
private void _testRemoteBuild(boolean authenticate, FreeStyleProject remoteProject) throws Exception {
8990

9091
String remoteUrl = jenkinsRule.getURL().toString();
9192
RemoteJenkinsServer remoteJenkinsServer = new RemoteJenkinsServer();
@@ -95,11 +96,6 @@ private void _testRemoteBuild(boolean authenticate) throws Exception {
9596
jenkinsRule.jenkins.getDescriptorByType(RemoteBuildConfiguration.DescriptorImpl.class);
9697
descriptor.setRemoteSites(remoteJenkinsServer);
9798

98-
FreeStyleProject remoteProject = jenkinsRule.createFreeStyleProject();
99-
remoteProject.addProperty(new ParametersDefinitionProperty(
100-
new StringParameterDefinition("parameterName1", "default1"),
101-
new StringParameterDefinition("parameterName2", "default2")));
102-
10399
FreeStyleProject project = jenkinsRule.createFreeStyleProject();
104100
RemoteBuildConfiguration configuration = new RemoteBuildConfiguration();
105101
configuration.setJob(remoteProject.getFullName());
@@ -135,6 +131,14 @@ private void _testRemoteBuild(boolean authenticate) throws Exception {
135131
assertEquals("value2", remoteEnv.get("parameterName2"));
136132
}
137133

134+
private void _testRemoteBuild(boolean authenticate) throws Exception {
135+
FreeStyleProject remoteProject = jenkinsRule.createFreeStyleProject();
136+
remoteProject.addProperty(
137+
new ParametersDefinitionProperty(new StringParameterDefinition("parameterName1", "default1"),
138+
new StringParameterDefinition("parameterName2", "default2")));
139+
_testRemoteBuild(authenticate, remoteProject);
140+
}
141+
138142
@Test @WithoutJenkins
139143
public void testDefaults() throws IOException {
140144

@@ -416,5 +420,17 @@ public void testGenerateJobUrl() throws MalformedURLException, AbortException {
416420

417421
}
418422

423+
@Test
424+
public void testRemoteFolderedBuild() throws Exception {
425+
disableAuth();
426+
427+
MockFolder remoteJobFolder = jenkinsRule.createFolder("someJobFolder");
428+
FreeStyleProject remoteProject = remoteJobFolder.createProject(FreeStyleProject.class, "someJobName");
429+
remoteProject.addProperty(
430+
new ParametersDefinitionProperty(new StringParameterDefinition("parameterName1", "default1"),
431+
new StringParameterDefinition("parameterName2", "default2")));
432+
433+
this._testRemoteBuild(false, remoteProject);
434+
}
419435

420436
}

0 commit comments

Comments
 (0)