diff --git a/runtime/v2/model/src/main/java/com/walmartlabs/concord/runtime/v2/ProcessDefinitionUtils.java b/runtime/v2/model/src/main/java/com/walmartlabs/concord/runtime/v2/ProcessDefinitionUtils.java index a23bfcba91..5ba5ec7860 100644 --- a/runtime/v2/model/src/main/java/com/walmartlabs/concord/runtime/v2/ProcessDefinitionUtils.java +++ b/runtime/v2/model/src/main/java/com/walmartlabs/concord/runtime/v2/ProcessDefinitionUtils.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -49,7 +49,7 @@ private static boolean containsStep(List steps, Step step) { } for (Step s : steps) { - if (s == step) { + if (s.getLocation().equals(step.getLocation())) { return true; } else if (s instanceof IfStep) { boolean contains = containsStep(((IfStep) s).getThenSteps(), step) @@ -78,4 +78,4 @@ private static boolean containsStep(List steps, Step step) { private ProcessDefinitionUtils() { } -} +} \ No newline at end of file diff --git a/runtime/v2/model/src/main/java/com/walmartlabs/concord/runtime/v2/parser/Atom.java b/runtime/v2/model/src/main/java/com/walmartlabs/concord/runtime/v2/parser/Atom.java index c053a7282b..dc60022081 100644 --- a/runtime/v2/model/src/main/java/com/walmartlabs/concord/runtime/v2/parser/Atom.java +++ b/runtime/v2/model/src/main/java/com/walmartlabs/concord/runtime/v2/parser/Atom.java @@ -54,7 +54,7 @@ public static Atom current(JsonParser p) throws IOException { default: value = null; } - return new Atom(toLocation(p.getTokenLocation()), p.currentToken(), p.getCurrentName(), value); + return new Atom(toLocation(p.currentTokenLocation()), p.currentToken(), p.getCurrentName(), value); } public final Location location; @@ -102,10 +102,6 @@ public String toString() { } private static Location toLocation(JsonLocation tokenLocation) { - if (tokenLocation == null) { - return Location.builder().build(); - } - return Location.builder() .lineNum(tokenLocation.getLineNr()) .column(tokenLocation.getColumnNr()) diff --git a/runtime/v2/model/src/test/java/com/walmartlabs/concord/project/runtime/v2/ProjectSerializerV2Test.java b/runtime/v2/model/src/test/java/com/walmartlabs/concord/project/runtime/v2/ProjectSerializerV2Test.java index ddb5d8a865..dbcbb69934 100644 --- a/runtime/v2/model/src/test/java/com/walmartlabs/concord/project/runtime/v2/ProjectSerializerV2Test.java +++ b/runtime/v2/model/src/test/java/com/walmartlabs/concord/project/runtime/v2/ProjectSerializerV2Test.java @@ -303,6 +303,7 @@ public void testProcessDefinition() throws Exception { Trigger trigger = Trigger.builder() .name("github") + .location(location()) .putConfiguration("entryPoint", "www") .putConfiguration("useInitiator", true) .putConditions("type", "push") @@ -340,7 +341,9 @@ private void assertResult(String resource, String result) throws Exception { } private static Location location() { - return Location.builder().build(); + return Location.builder() + .fileName("test.concord.yml") + .build(); } private static SimpleOptions simpleOptions() { diff --git a/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/MainTest.java b/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/MainTest.java index 5d3ea2932f..25c89f1495 100644 --- a/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/MainTest.java +++ b/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/MainTest.java @@ -1081,6 +1081,12 @@ public void testCurrentFlowName() throws Exception { byte[] log = run(); assertLog(log, ".*default: default.*"); assertLog(log, ".*myFlow: myFlow.*"); + + checkpointService.restore("first", workDir); + + run(); + + assertLogAtLeast(allLogs, 2, ".*after checkpoint: default.*"); } @Test diff --git a/runtime/v2/runner/src/test/resources/com/walmartlabs/concord/runtime/v2/runner/currentFlowName/concord.yml b/runtime/v2/runner/src/test/resources/com/walmartlabs/concord/runtime/v2/runner/currentFlowName/concord.yml index d945f127df..98375256ce 100644 --- a/runtime/v2/runner/src/test/resources/com/walmartlabs/concord/runtime/v2/runner/currentFlowName/concord.yml +++ b/runtime/v2/runner/src/test/resources/com/walmartlabs/concord/runtime/v2/runner/currentFlowName/concord.yml @@ -3,5 +3,8 @@ flows: - log: "default: ${currentFlowName()}" - call: myFlow + - checkpoint: "first" + - log: "after checkpoint: ${currentFlowName()}" + myFlow: - log: "myFlow: ${currentFlowName()}"