forked from morficus/Parameterized-Remote-Trigger-Plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from wgreven/dont-fail-on-404
Don't fail on a 404 status
- Loading branch information
Showing
2 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...t/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.jenkinsci.plugins.ParameterizedRemoteTrigger; | ||
|
||
import hudson.model.FreeStyleProject; | ||
import net.sf.json.JSONObject; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
public class RemoteBuildConfigurationTest { | ||
@Rule | ||
public JenkinsRule jenkinsRule = new JenkinsRule(); | ||
|
||
@Test | ||
public void testRemoteBuild() throws Exception { | ||
jenkinsRule.jenkins.setCrumbIssuer(null); | ||
|
||
JSONObject authenticationMode = new JSONObject(); | ||
authenticationMode.put("value", "none"); | ||
JSONObject auth = new JSONObject(); | ||
auth.put("authenticationMode", authenticationMode); | ||
|
||
String remoteUrl = jenkinsRule.getURL().toString(); | ||
RemoteJenkinsServer remoteJenkinsServer = | ||
new RemoteJenkinsServer(remoteUrl, "JENKINS", false, auth); | ||
RemoteBuildConfiguration.DescriptorImpl descriptor = | ||
jenkinsRule.jenkins.getDescriptorByType(RemoteBuildConfiguration.DescriptorImpl.class); | ||
descriptor.setRemoteSites(remoteJenkinsServer); | ||
|
||
FreeStyleProject remoteProject = jenkinsRule.createFreeStyleProject(); | ||
|
||
FreeStyleProject project = jenkinsRule.createFreeStyleProject(); | ||
RemoteBuildConfiguration remoteBuildConfiguration = new RemoteBuildConfiguration( | ||
remoteJenkinsServer.getDisplayName(), false, remoteProject.getFullName(), "", | ||
"", null, null, false, true, 1); | ||
project.getBuildersList().add(remoteBuildConfiguration); | ||
|
||
jenkinsRule.buildAndAssertSuccess(project); | ||
} | ||
} |