Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-8985] Allow multiple ParameterizedDependencys for upst…
…ream:downstream.

Override equals and hashCode in ParameterizedDependency - Dependency's
equals and hashCode methods only pay any attention to the upstream and
downstream projects, which means that until now, if you had multiple
ParameterizedDependencys between the same upstream/downstream
projects, only the first would actually get added.

However, to actually have multiple triggers between the same projects
work, this depends on a related fix in Jenkins core, which should be
live in 1.414.
  • Loading branch information
abayer committed May 20, 2011
1 parent 440065d commit d22c738
Showing 1 changed file with 19 additions and 0 deletions.
Expand Up @@ -30,6 +30,25 @@ public static void add(AbstractProject upstream, AbstractProject downstream,
graph.addDependency(new ParameterizedDependency(upstream, downstream, config));
}

@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;

final ParameterizedDependency that = (ParameterizedDependency) obj;
return this.getUpstreamProject() == that.getUpstreamProject() || this.getDownstreamProject() == that.getDownstreamProject()
|| this.config == that.config;
}

@Override
public int hashCode() {
int hash = 7;
hash = 23 * hash + this.getUpstreamProject().hashCode();
hash = 23 * hash + this.getDownstreamProject().hashCode();
hash = 23 * hash + this.config.hashCode();
return hash;
}

@Override
public boolean shouldTriggerBuild(AbstractBuild build, TaskListener listener, List<Action> actions) {
if (!config.getCondition().isMet(build.getResult())){
Expand Down

0 comments on commit d22c738

Please sign in to comment.