use of org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl in project che by eclipse.
the class NodeJsDebuggerTest method testManageBreakpoints.
@Test
public void testManageBreakpoints() throws Exception {
List<Breakpoint> breakpoints = debugger.getAllBreakpoints();
assertEquals(breakpoints.size(), 1);
debugger.addBreakpoint(new BreakpointImpl(new LocationImpl("app.js", 2)));
ArgumentCaptor<BreakpointActivatedEvent> breakpointActivated = ArgumentCaptor.forClass(BreakpointActivatedEvent.class);
verify(callback).onEvent(breakpointActivated.capture());
BreakpointActivatedEvent event = breakpointActivated.getValue();
Breakpoint breakpoint = event.getBreakpoint();
assertEquals(breakpoint.getLocation().getTarget(), "app.js");
assertEquals(breakpoint.getLocation().getLineNumber(), 2);
debugger.addBreakpoint(new BreakpointImpl(new LocationImpl("app.js", 5)));
breakpoints = debugger.getAllBreakpoints();
assertEquals(breakpoints.size(), 3);
debugger.deleteBreakpoint(new LocationImpl("app.js", 2));
breakpoints = debugger.getAllBreakpoints();
assertEquals(breakpoints.size(), 2);
debugger.deleteAllBreakpoints();
breakpoints = debugger.getAllBreakpoints();
assertEquals(breakpoints.size(), 1);
}
use of org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl in project che by eclipse.
the class GdbRun method parse.
/**
* Factory method.
*/
public static GdbRun parse(GdbOutput gdbOutput) throws GdbParseException {
String output = gdbOutput.getOutput();
for (String line : output.split("\n")) {
Matcher matcher = GDB_BREAKPOINT.matcher(line);
if (matcher.find()) {
String file = matcher.group(1);
String lineNumber = matcher.group(2);
Location location = new LocationImpl(file, Integer.parseInt(lineNumber));
return new GdbRun(new BreakpointImpl(location));
}
}
return new GdbRun(null);
}
use of org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl in project che by eclipse.
the class GdbDebuggerTest method addBreakpoint.
private void addBreakpoint() throws DebuggerException, InterruptedException {
Location location = new LocationImpl("h.cpp", 7);
Breakpoint breakpoint = new BreakpointImpl(location);
gdbDebugger.addBreakpoint(breakpoint);
assertEquals(events.size(), 1);
DebuggerEvent debuggerEvent = events.take();
assertTrue(debuggerEvent instanceof BreakpointActivatedEvent);
BreakpointActivatedEvent breakpointActivatedEvent = (BreakpointActivatedEvent) debuggerEvent;
assertEquals(breakpointActivatedEvent.getBreakpoint().getLocation().getTarget(), "h.cpp");
assertEquals(breakpointActivatedEvent.getBreakpoint().getLocation().getLineNumber(), 7);
}
use of org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl in project che by eclipse.
the class JavaDebuggerTest method testGetAllBreakpoints.
@Test(priority = 8)
public void testGetAllBreakpoints() throws Exception {
assertFalse(debugger.getAllBreakpoints().isEmpty());
debugger.deleteAllBreakpoints();
assertTrue(debugger.getAllBreakpoints().isEmpty());
debugger.addBreakpoint(new BreakpointImpl(new LocationImpl("com.HelloWorld", 18), false, null));
DebuggerEvent debuggerEvent = events.take();
assertTrue(debuggerEvent instanceof BreakpointActivatedEvent);
assertEquals(debugger.getAllBreakpoints().size(), 1);
Breakpoint breakpoint = debugger.getAllBreakpoints().get(0);
assertEquals(breakpoint.getLocation().getLineNumber(), 18);
assertEquals(breakpoint.getLocation().getTarget(), "com.HelloWorld");
assertTrue(breakpoint.isEnabled());
}
use of org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl in project che by eclipse.
the class ZendDbgSessionTest method testVariables.
@Test(groups = { "zendDbg" }, dependsOnGroups = { "checkPHP" })
public void testVariables() throws Exception {
List<Breakpoint> breakpoints = new ArrayList<>();
Breakpoint bp1 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgClassesFile, 16));
Breakpoint bp2 = new BreakpointImpl(ZendDbgLocationHandler.createDBG(dbgClassesFile, 25));
breakpoints.add(bp1);
breakpoints.add(bp2);
triggerSession(dbgHelloFile, getDbgSettings(false, false), breakpoints);
awaitBreakpointActivated(bp1);
awaitBreakpointActivated(bp2);
awaitSuspend(dbgClassesFile, 16);
StackFrameDump stackFrameDump = debugger.dumpStackFrame();
assertEquals(stackFrameDump.getVariables().size(), 1);
assertEquals(stackFrameDump.getVariables().get(0).getName(), "$this");
assertEquals(stackFrameDump.getVariables().get(0).getValue(), "A");
assertEquals(stackFrameDump.getVariables().get(0).getType(), "object");
debugger.resume(new ResumeActionImpl());
awaitSuspend(dbgClassesFile, 25);
stackFrameDump = debugger.dumpStackFrame();
assertEquals(stackFrameDump.getVariables().size(), 3);
assertEquals(stackFrameDump.getVariables().get(0).getName(), "$this");
assertEquals(stackFrameDump.getVariables().get(0).getValue(), "B");
assertEquals(stackFrameDump.getVariables().get(0).getType(), "object");
assertEquals(stackFrameDump.getVariables().get(1).getName(), "$p");
assertEquals(stackFrameDump.getVariables().get(1).getValue(), "123");
assertEquals(stackFrameDump.getVariables().get(1).getType(), "int");
assertEquals(stackFrameDump.getVariables().get(2).getName(), "$v");
assertEquals(stackFrameDump.getVariables().get(2).getValue(), "\"B\"");
assertEquals(stackFrameDump.getVariables().get(2).getType(), "string");
}
Aggregations