Skip to content

Commit

Permalink
Debugger breakpoints modify flow variables (#1257)
Browse files Browse the repository at this point in the history
* - added functionality for changing the flow inputs from breakpoint

* - added functionality for changing the flow variables from breakpoint

Co-authored-by: Alexandra <[email protected]>
  • Loading branch information
ilasalexandra and Alexandra authored Nov 5, 2020
1 parent c4dc37b commit b2413f2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public interface ScoreLangConstants {

//debug
String USER_INTERRUPT = "USER_INTERRUPT";
String DEBUGGER_INPUTS = "debuggerInputs";
String DEBUGGER_STEP_INPUTS = "debuggerStepInputs";
String DEBUGGER_FLOW_INPUTS = "debuggerFlowInputs";


}
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@
*******************************************************************************/
package io.cloudslang.lang.runtime.bindings.strategies;

import io.cloudslang.lang.entities.bindings.values.Value;
import io.cloudslang.lang.runtime.env.RunEnvironment;
import io.cloudslang.lang.runtime.events.LanguageEventData;
import io.cloudslang.score.lang.ExecutionRuntimeServices;
import io.cloudslang.score.lang.SystemContext;

import java.util.Map;


public interface DebuggerBreakpointsHandler extends InputHandler {

boolean handleBreakpoints(
SystemContext systemContext,
RunEnvironment runEnv,
ExecutionRuntimeServices runtimeServices,
LanguageEventData.StepType stepType,
String stepName,
String stepId);
SystemContext systemContext,
RunEnvironment runEnv,
ExecutionRuntimeServices runtimeServices,
LanguageEventData.StepType stepType,
String stepName,
String stepId);

Map<String, Value> resolveInputs(SystemContext systemContext);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public boolean resolveInputs(List<Input> newInputs, SystemContext systemContext,
return false;
}

@Override
public Map<String,Value> resolveInputs(SystemContext systemContext) {
return null;
}

@Override
public Map<String, ? extends Value> applyValues(SystemContext systemContext, Collection<Input> inputs) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,22 @@ public void startExecutable(@Param(ScoreLangConstants.EXECUTABLE_INPUTS_KEY) Lis
}
}
}
if (systemContext.containsKey(ScoreLangConstants.DEBUGGER_FLOW_INPUTS)) {

Context flowContext = runEnv.getStack().popContext();
flowContext.putVariables(debuggerBreakpointsHandler.resolveInputs(systemContext));
runEnv.getStack().pushContext(flowContext);
}

executableInputs = Collections.unmodifiableList(mutableInputList);

//restore what was already prompted and add newly prompted values
Map<String, Value> promptedValues = runEnv.removePromptedValues();
promptedValues.putAll(missingInputHandler.applyPromptInputValues(systemContext, executableInputs));

Map<String, Prompt> promptArguments = runEnv.removePromptArguments();

if (systemContext.containsKey(ScoreLangConstants.DEBUGGER_INPUTS)) {
if (systemContext.containsKey(ScoreLangConstants.DEBUGGER_STEP_INPUTS)) {
callArguments.putAll(debuggerBreakpointsHandler.applyValues(systemContext, executableInputs));
}
List<Input> newExecutableInputs =
Expand Down

0 comments on commit b2413f2

Please sign in to comment.