use of org.eclipse.che.api.debug.shared.dto.VariableDto in project che by eclipse.
the class AbstractDebugger method asDto.
private VariableDto asDto(Variable variable) {
VariableDto dto = dtoFactory.createDto(VariableDto.class);
dto.withValue(variable.getValue());
dto.withVariablePath(asDto(variable.getVariablePath()));
dto.withPrimitive(variable.isPrimitive());
dto.withType(variable.getType());
dto.withName(variable.getName());
dto.withExistInformation(variable.isExistInformation());
dto.withVariables(asDto(variable.getVariables()));
return dto;
}
use of org.eclipse.che.api.debug.shared.dto.VariableDto 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.dto.VariableDto in project che by eclipse.
the class DebuggerTest method testChangeVariableValue.
@Test
public void testChangeVariableValue() throws Exception {
final List<String> path = mock(List.class);
final String newValue = "new-value";
VariablePath variablePath = mock(VariablePathDto.class);
doReturn(path).when(variablePath).getPath();
VariableDto variableDto = mock(VariableDto.class);
doReturn(variableDto).when(dtoFactory).createDto(VariableDto.class);
Variable variable = mock(Variable.class);
doReturn(mock(VariablePathDto.class)).when(dtoFactory).createDto(VariablePathDto.class);
doReturn(variablePath).when(variable).getVariablePath();
doReturn(newValue).when(variable).getValue();
doReturn(Collections.emptyList()).when(variable).getVariables();
doReturn(promiseVoid).when(service).setValue(SESSION_ID, variableDto);
doReturn(promiseVoid).when(promiseVoid).then((Operation<Void>) any());
debugger.setValue(variable);
verify(promiseVoid).then(operationVoidCaptor.capture());
operationVoidCaptor.getValue().apply(null);
verify(observer).onValueChanged(path, newValue);
verify(promiseVoid).catchError(operationPromiseErrorCaptor.capture());
operationPromiseErrorCaptor.getValue().apply(promiseError);
verify(promiseError).getMessage();
}
Aggregations