Skip to content
Permalink
Browse files

Merge pull request #67 from jglick/test-update

Simpler workaround for map iteration JENKINS-27421
  • Loading branch information
jglick committed Sep 22, 2016
2 parents d35a7e0 + 4a65e41 commit 32c98dbbe54172b342f790443e9fec820fc125e3
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/test/java/org/jenkinsci/plugins/workflow/SerializationTest.java
@@ -194,21 +194,21 @@ public void stop(Throwable cause) throws Exception {
ScriptApproval.get().approveSignature("method java.util.Map entrySet");
p.setDefinition(new CpsFlowDefinition(
"def map = [one: 1, two: 2]\n" +
"@NonCPS def entries(m) {m.collect {k, v -> [k, v]}}; mapE = entries(map); for (int i = 0; i < mapE.size(); i++) {def e = mapE[i]; echo \"running C-style loop on ${e[0]} → ${e[1]}\"; semaphore \"C-${e[0]}\"}\n" +
"@NonCPS def entries(m) {m.collect {k, v -> [k, v]}}; for (def e in entries(map)) {echo \"running flattened loop on ${e[0]} → ${e[1]}\"; semaphore \"C-${e[0]}\"}\n" +
"for (def e : map.entrySet()) {echo \"running new-style loop on ${e.key} → ${e.value}\"; semaphore \"new-${e.key}\"}"
// TODO check also keySet(), values()
, true));
startBuilding();
SemaphoreStep.waitForStart("C-one/1", b);
story.j.waitForMessage("running C-style loop on one → 1", b);
story.j.waitForMessage("running flattened loop on one → 1", b);
}
});
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
rebuildContext(story.j);
SemaphoreStep.success("C-one/1", null);
SemaphoreStep.success("C-two/1", null);
story.j.waitForMessage("running C-style loop on two → 2", b);
story.j.waitForMessage("running flattened loop on two → 2", b);
SemaphoreStep.waitForStart("new-one/1", b);
story.j.waitForMessage("running new-style loop on one → 1", b);
}

0 comments on commit 32c98db

Please sign in to comment.