Skip to content

Commit

Permalink
[JENKINS-23191] Cannot reproduce problem in HtmlUnit test, but can at…
Browse files Browse the repository at this point in the history
… least guard against other regressions.

(cherry picked from commit e1e7f1b)
  • Loading branch information
jglick authored and olivergondza committed Jul 3, 2014
1 parent 694538e commit 84195ea
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/src/test/java/jenkins/triggers/ReverseBuildTriggerTest.java
Expand Up @@ -36,6 +36,7 @@
import hudson.security.AuthorizationMatrixProperty;
import hudson.security.Permission;
import hudson.security.ProjectMatrixAuthorizationStrategy;
import hudson.tasks.BuildTrigger;
import hudson.tasks.BuildTriggerTest;
import hudson.triggers.Trigger;
import java.util.Arrays;
Expand All @@ -57,6 +58,24 @@ public class ReverseBuildTriggerTest {

@Rule public JenkinsRule r = new JenkinsRule();

@Test public void configRoundtrip() throws Exception {
r.createFreeStyleProject("upstream");
FreeStyleProject downstream = r.createFreeStyleProject("downstream");
FreeStyleProject wayDownstream = r.createFreeStyleProject("wayDownstream");
downstream.addTrigger(new ReverseBuildTrigger("upstream", Result.SUCCESS));
downstream.getPublishersList().add(new BuildTrigger(Collections.singleton(wayDownstream), Result.SUCCESS));
downstream.save();
r.configRoundtrip(downstream);
ReverseBuildTrigger rbt = downstream.getTrigger(ReverseBuildTrigger.class);
assertNotNull(rbt);
assertEquals("upstream", rbt.getUpstreamProjects());
assertEquals(Result.SUCCESS, rbt.getThreshold());
BuildTrigger bt = downstream.getPublishersList().get(BuildTrigger.class);
assertNotNull(bt);
assertEquals(Collections.singletonList(wayDownstream), bt.getChildProjects(downstream));
assertEquals(Result.SUCCESS, bt.getThreshold());
}

/** @see BuildTriggerTest#testDownstreamProjectSecurity */
@Test public void upstreamProjectSecurity() throws Exception {
r.jenkins.setSecurityRealm(r.createDummySecurityRealm());
Expand Down

0 comments on commit 84195ea

Please sign in to comment.