2323import org .junit .Test ;
2424import org .jvnet .hudson .test .JenkinsRule ;
2525import org .jvnet .hudson .test .MockAuthorizationStrategy ;
26+ import org .jvnet .hudson .test .MockFolder ;
2627import org .jvnet .hudson .test .WithoutJenkins ;
2728
2829import 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