Search in sources :

Example 1 with BreakpointActivatedEvent

use of org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent 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);
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) BreakpointImpl(org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) BreakpointActivatedEvent(org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent) Test(org.testng.annotations.Test)

Example 2 with BreakpointActivatedEvent

use of org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent in project che by eclipse.

the class JavaDebuggerTest method testAddBreakpoint.

@Test(priority = 3)
public void testAddBreakpoint() throws Exception {
    int breakpointsCount = debugger.getAllBreakpoints().size();
    debugger.addBreakpoint(new BreakpointImpl(new LocationImpl("com.HelloWorld", 18), false, null));
    DebuggerEvent debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof BreakpointActivatedEvent);
    Breakpoint breakpoint = ((BreakpointActivatedEvent) debuggerEvent).getBreakpoint();
    assertEquals(breakpoint.getLocation().getLineNumber(), 18);
    assertEquals(breakpoint.getLocation().getTarget(), "com.HelloWorld");
    assertTrue(breakpoint.isEnabled());
    assertEquals(debugger.getAllBreakpoints().size(), breakpointsCount + 1);
}
Also used : Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) BreakpointImpl(org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) BreakpointActivatedEvent(org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent) DebuggerEvent(org.eclipse.che.api.debug.shared.model.event.DebuggerEvent) Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) Test(org.testng.annotations.Test)

Example 3 with BreakpointActivatedEvent

use of org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent in project che by eclipse.

the class JavaDebuggerTest method testStartDebugger.

@Test(priority = 2)
public void testStartDebugger() throws Exception {
    BreakpointImpl breakpoint = new BreakpointImpl(new LocationImpl("com.HelloWorld", 17), false, null);
    debugger.start(new StartActionImpl(singletonList(breakpoint)));
    DebuggerEvent debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof BreakpointActivatedEvent);
    debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof SuspendEvent);
    Location location = ((SuspendEvent) debuggerEvent).getLocation();
    assertEquals(location.getLineNumber(), 17);
    assertEquals(location.getTarget(), "com.HelloWorld");
}
Also used : BreakpointImpl(org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl) SuspendEvent(org.eclipse.che.api.debug.shared.model.event.SuspendEvent) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) BreakpointActivatedEvent(org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent) StartActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.StartActionImpl) DebuggerEvent(org.eclipse.che.api.debug.shared.model.event.DebuggerEvent) Location(org.eclipse.che.api.debug.shared.model.Location) Test(org.testng.annotations.Test)

Example 4 with BreakpointActivatedEvent

use of org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent in project che by eclipse.

the class JavaDebuggerTest method testSteps.

@Test(priority = 9)
public void testSteps() throws Exception {
    debugger.deleteAllBreakpoints();
    debugger.addBreakpoint(new BreakpointImpl(new LocationImpl("com.HelloWorld", 20), false, null));
    assertTrue(events.take() instanceof BreakpointActivatedEvent);
    debugger.resume(new ResumeActionImpl());
    DebuggerEvent debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof SuspendEvent);
    Location location = ((SuspendEvent) debuggerEvent).getLocation();
    assertEquals(location.getTarget(), "com.HelloWorld");
    assertEquals(location.getLineNumber(), 20);
    assertEquals(location.getExternalResourceId(), -1);
    assertEquals(location.getResourceProjectPath(), "/test");
    assertEquals(location.getResourcePath(), "/test/src/com/HelloWorld.java");
    debugger.stepInto(new StepIntoActionImpl());
    debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof SuspendEvent);
    location = ((SuspendEvent) debuggerEvent).getLocation();
    assertEquals(location.getTarget(), "com.HelloWorld");
    assertEquals(location.getLineNumber(), 28);
    debugger.stepOut(new StepOutActionImpl());
    debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof SuspendEvent);
    location = ((SuspendEvent) debuggerEvent).getLocation();
    assertEquals(location.getTarget(), "com.HelloWorld");
    assertEquals(location.getLineNumber(), 20);
    debugger.stepOver(new StepOverActionImpl());
    debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof SuspendEvent);
    location = ((SuspendEvent) debuggerEvent).getLocation();
    assertEquals(location.getTarget(), "com.HelloWorld");
    assertEquals(location.getLineNumber(), 21);
    debugger.stepOver(new StepOverActionImpl());
    debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof SuspendEvent);
    location = ((SuspendEvent) debuggerEvent).getLocation();
    assertEquals(location.getTarget(), "com.HelloWorld");
    assertEquals(location.getLineNumber(), 23);
    debugger.stepOver(new StepOverActionImpl());
    debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof SuspendEvent);
    location = ((SuspendEvent) debuggerEvent).getLocation();
    assertEquals(location.getTarget(), "com.HelloWorld");
    assertEquals(location.getLineNumber(), 24);
}
Also used : BreakpointImpl(org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl) StepIntoActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.StepIntoActionImpl) StepOverActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.StepOverActionImpl) SuspendEvent(org.eclipse.che.api.debug.shared.model.event.SuspendEvent) LocationImpl(org.eclipse.che.api.debug.shared.model.impl.LocationImpl) BreakpointActivatedEvent(org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent) ResumeActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.ResumeActionImpl) StepOutActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.StepOutActionImpl) DebuggerEvent(org.eclipse.che.api.debug.shared.model.event.DebuggerEvent) Location(org.eclipse.che.api.debug.shared.model.Location) Test(org.testng.annotations.Test)

Example 5 with BreakpointActivatedEvent

use of org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent in project che by eclipse.

the class AbstractZendDbgSessionTest method awaitBreakpointActivated.

protected void awaitBreakpointActivated(Breakpoint breakpoint) throws Exception {
    DebuggerEvent debuggerEvent = dbgEvents.poll(5, TimeUnit.SECONDS);
    if (debuggerEvent == null) {
        throw new Exception("Breakpoint activated event timeout occurred.");
    }
    assertTrue(debuggerEvent instanceof BreakpointActivatedEvent);
    BreakpointActivatedEvent bpActivatedEvent = (BreakpointActivatedEvent) debuggerEvent;
    assertEquals(bpActivatedEvent.getBreakpoint(), breakpoint);
}
Also used : BreakpointActivatedEvent(org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent) DebuggerEvent(org.eclipse.che.api.debug.shared.model.event.DebuggerEvent)

Aggregations

BreakpointActivatedEvent (org.eclipse.che.api.debug.shared.model.event.BreakpointActivatedEvent)7 DebuggerEvent (org.eclipse.che.api.debug.shared.model.event.DebuggerEvent)6 BreakpointImpl (org.eclipse.che.api.debug.shared.model.impl.BreakpointImpl)6 LocationImpl (org.eclipse.che.api.debug.shared.model.impl.LocationImpl)6 Test (org.testng.annotations.Test)5 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)4 Location (org.eclipse.che.api.debug.shared.model.Location)3 SuspendEvent (org.eclipse.che.api.debug.shared.model.event.SuspendEvent)2 ResumeActionImpl (org.eclipse.che.api.debug.shared.model.impl.action.ResumeActionImpl)1 StartActionImpl (org.eclipse.che.api.debug.shared.model.impl.action.StartActionImpl)1 StepIntoActionImpl (org.eclipse.che.api.debug.shared.model.impl.action.StepIntoActionImpl)1 StepOutActionImpl (org.eclipse.che.api.debug.shared.model.impl.action.StepOutActionImpl)1 StepOverActionImpl (org.eclipse.che.api.debug.shared.model.impl.action.StepOverActionImpl)1