Skip to content
Permalink
Browse files

[JENKINS-25660] - Added a regression test for the issue

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
  • Loading branch information
oleg-nenashev committed Mar 11, 2015
1 parent 29baeb3 commit 51475b3ab12a39f036b453f5da883df825dd8b85
Showing with 18 additions and 2 deletions.
  1. +18 −2 src/test/java/ca/silvermaplesolutions/jenkins/plugins/daxis/DynamicAxisTest.java
@@ -6,7 +6,9 @@
import hudson.model.AbstractBuild;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.StringParameterDefinition;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.FakeChangeLogSCM;
@@ -34,6 +36,11 @@ protected void setUp() throws Exception {
MatrixBuild run = buildAndAssertSuccess(p);
assertEquals(3, run.getExactRuns().size());
}

@Bug(25660)
public @Test void testInjectionWithEscaping() throws Exception {
checkAxesSetup(new String[]{"1", "\"2 3\""});
}

/**
* Runs the test, when an environment contributor uses axis values
@@ -42,16 +49,25 @@ protected void setUp() throws Exception {
*/
@Bug(27243)
public @Test void testInjectionWithAxisValuesUser() throws Exception {
checkAxesSetup(new String[]{"1", "2", "3"});
}

/**
* Sets values from the list and then checks injection results.
* @param values List of values, which should be escaped externally
*/
private void checkAxesSetup(String[] values) throws Exception {
final String valuesString = StringUtils.join(values, " ");
p.addProperty(new ParametersDefinitionProperty(
new StringParameterDefinition("AXIS_VALUES", "1 2 3")));
new StringParameterDefinition("AXIS_VALUES", valuesString)));

// Inject SCM, which implicitly triggers axes rebuild
p.setScm(new AxisValuesUserSCM());

final MatrixBuild run = buildAndAssertSuccess(p);

// No additional values have been injected
assertEquals(3, run.getExactRuns().size());
assertEquals(values.length, run.getExactRuns().size());
}

/**

0 comments on commit 51475b3

Please sign in to comment.
You can’t perform that action at this time.