use of org.eclipse.che.api.debug.shared.model.SimpleValue in project che by eclipse.
the class DebuggerPresenter method onExpandVariablesTree.
@Override
public void onExpandVariablesTree() {
List<? extends Variable> rootVariables = selectedVariable.getVariables();
if (rootVariables.isEmpty()) {
Debugger debugger = debuggerManager.getActiveDebugger();
if (debugger != null) {
Promise<SimpleValue> promise = debugger.getValue(selectedVariable);
promise.then(new Operation<SimpleValue>() {
@Override
public void apply(SimpleValue arg) throws OperationException {
selectedVariable.setValue(arg.getValue());
view.setVariablesIntoSelectedVariable(arg.getVariables());
view.updateSelectedVariable();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
notificationManager.notify(constant.failedToGetVariableValueTitle(), arg.getMessage(), FAIL, FLOAT_MODE);
}
});
}
}
}
use of org.eclipse.che.api.debug.shared.model.SimpleValue in project che by eclipse.
the class DebuggerTest method testGetValue.
@Test
public void testGetValue() throws Exception {
final VariableDto variableDto = mock(VariableDto.class);
final Variable variable = mock(Variable.class);
final Promise<SimpleValueDto> promiseValue = mock(Promise.class);
doReturn(variableDto).when(dtoFactory).createDto(VariableDto.class);
doReturn(mock(VariablePathDto.class)).when(dtoFactory).createDto(VariablePathDto.class);
doReturn(mock(VariablePathDto.class)).when(variable).getVariablePath();
doReturn(Collections.emptyList()).when(variable).getVariables();
doReturn(promiseValue).when(service).getValue(SESSION_ID, variableDto);
doReturn(promiseValue).when(promiseValue).then((Function<SimpleValueDto, Object>) any());
doReturn(promiseValue).when(promiseValue).catchError((Operation<PromiseError>) any());
Promise<SimpleValue> result = debugger.getValue(variable);
assertEquals(promiseValue, result);
}
use of org.eclipse.che.api.debug.shared.model.SimpleValue in project che by eclipse.
the class ZendDbgSessionTest method testGetValue.
@Test(groups = { "zendDbg" }, dependsOnGroups = { "checkPHP" })
public void testGetValue() throws Exception {
List<Breakpoint> breakpoints = new ArrayList<>();
Breakpoint bp1 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgClassesFile, 16));
breakpoints.add(bp1);
triggerSession(dbgHelloFile, getDbgSettings(false, false), breakpoints);
awaitBreakpointActivated(bp1);
awaitSuspend(dbgClassesFile, 16);
debugger.dumpStackFrame();
VariablePath variablePath = new VariablePathImpl("0");
SimpleValue simpleValue = debugger.getValue(variablePath);
assertEquals(simpleValue.getVariables().size(), 3);
List<String> path = Arrays.asList("0", "0");
variablePath = new VariablePathImpl(path);
simpleValue = debugger.getValue(variablePath);
assertEquals(simpleValue.getValue(), "\"A\"");
path = Arrays.asList("0", "1");
variablePath = new VariablePathImpl(path);
simpleValue = debugger.getValue(variablePath);
assertEquals(simpleValue.getValue(), "123");
path = Arrays.asList("0", "2");
variablePath = new VariablePathImpl(path);
simpleValue = debugger.getValue(variablePath);
assertEquals(simpleValue.getValue(), "array [3]");
}
use of org.eclipse.che.api.debug.shared.model.SimpleValue in project che by eclipse.
the class GdbDebuggerTest method doSetAndGetValues.
private void doSetAndGetValues() throws DebuggerException {
VariablePath variablePath = new VariablePathImpl("i");
Variable variable = new VariableImpl("int", "i", "2", true, variablePath, Collections.emptyList(), false);
SimpleValue value = gdbDebugger.getValue(variablePath);
assertEquals(value.getValue(), "0");
gdbDebugger.setValue(variable);
value = gdbDebugger.getValue(variablePath);
assertEquals(value.getValue(), "2");
String expression = gdbDebugger.evaluate("i");
assertEquals(expression, "2");
expression = gdbDebugger.evaluate("10 + 10");
assertEquals(expression, "20");
StackFrameDump stackFrameDump = gdbDebugger.dumpStackFrame();
assertTrue(stackFrameDump.getFields().isEmpty());
assertEquals(stackFrameDump.getVariables().size(), 1);
assertEquals(stackFrameDump.getVariables().get(0).getName(), "i");
assertEquals(stackFrameDump.getVariables().get(0).getValue(), "2");
assertEquals(stackFrameDump.getVariables().get(0).getType(), "int");
}
Aggregations