@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTBranch that = (ModelASTBranch) o; if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) { return false; } return getSteps() != null ? getSteps().equals(that.getSteps()) : that.getSteps() == null; }
@Override public void removeSourceLocation() { super.removeSourceLocation(); branch.removeSourceLocation(); }
@Override public String toGroovy() { return condition + " {\n" + branch.toGroovy() + "\n}\n"; }
assertNull(firstBranch.getSourceLocation()); assertNotNull(firstBranch); assertEquals(1, firstBranch.getSteps().size()); ModelASTStep firstStep = firstBranch.getSteps().get(0); assertNull(firstStep.getSourceLocation()); assertEquals("junit", firstStep.getName());
private ModelASTBranch branchForName(String name, List<ModelASTBranch> branches) { for (ModelASTBranch branch : branches) { if (branch.getName().equals(name)) { return branch; } } return null; }
/** * Construct the new {@link BlockStatement} for the given branch. */ @Nonnull public final BlockStatement handleBranch(@Nonnull ModelASTBranch branch) { BlockStatement newBlock = block(); for (ModelASTStep s : branch.getSteps()) { // Don't process script blocks or a step that for some reason isn't an expression statement at all if (s instanceof AbstractModelASTCodeBlock || !(s.getSourceLocation() instanceof ExpressionStatement)) { newBlock.addStatement((Statement)s.getSourceLocation()); } else { ExpressionStatement es = (ExpressionStatement) s.getSourceLocation(); if (es.getExpression() instanceof MethodCallExpression) { MethodCallExpression methodCall = (MethodCallExpression) es.getExpression(); newBlock.addStatement(stmt(handleStep(s, methodCall))); } else { newBlock.addStatement(es); } } } return newBlock; }
@Override public void validate(@Nonnull ModelValidator validator) { validator.validateElement(this); branch.validate(validator); }
@Override public JSONObject toJSON() { return new JSONObject().accumulate("condition", condition).accumulate("branch", branch.toJSON()); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (getCondition() != null ? getCondition().hashCode() : 0); result = 31 * result + (getBranch() != null ? getBranch().hashCode() : 0); return result; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTBuildCondition that = (ModelASTBuildCondition) o; if (getCondition() != null ? !getCondition().equals(that.getCondition()) : that.getCondition() != null) { return false; } return getBranch() != null ? getBranch().equals(that.getBranch()) : that.getBranch() == null; }
assertNull(firstBranch.getSourceLocation()); assertNotNull(firstBranch); assertEquals(1, firstBranch.getSteps().size()); ModelASTStep firstStep = firstBranch.getSteps().get(0); assertNull(firstStep.getSourceLocation()); assertEquals("echo", firstStep.getName()); assertNull(secondBranch.getSourceLocation()); assertEquals(2, secondBranch.getSteps().size()); ModelASTStep scriptStep = secondBranch.getSteps().get(0); assertNull(scriptStep.getSourceLocation()); assertTrue(scriptStep instanceof ModelASTScriptBlock); assertNull(scriptVal.getSourceLocation()); ModelASTStep timeoutStep = secondBranch.getSteps().get(1); assertNull(timeoutStep.getSourceLocation()); assertTrue(timeoutStep instanceof ModelASTTreeStep);
newParallelMap.addMapEntryExpression(constX(b.getName()), closureX(handleBranch(b)));
@Override public void validate(ModelValidator validator) { validator.validateElement(this); branch.validate(validator); }
@Override public JSONObject toJSON() { return new JSONObject().accumulate("condition", condition).accumulate("branch", branch.toJSON()); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (getCondition() != null ? getCondition().hashCode() : 0); result = 31 * result + (getBranch() != null ? getBranch().hashCode() : 0); return result; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTBuildCondition that = (ModelASTBuildCondition) o; if (getCondition() != null ? !getCondition().equals(that.getCondition()) : that.getCondition() != null) { return false; } return getBranch() != null ? getBranch().equals(that.getBranch()) : that.getBranch() == null; }
public void validate(final ModelValidator validator, boolean isNested) { validator.validateElement(this, isNested); for (ModelASTBranch branch : branches) { branch.validate(validator); } if (parallel != null) { parallel.validate(validator, true); } if (agent != null) { agent.validate(validator); } if (when != null) { when.validate(validator); } if (post != null) { post.validate(validator); } if (tools != null) { tools.validate(validator); } if (environment != null) { environment.validate(validator); } }