Search in sources :

Example 1 with SuspendEvent

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

the class GdbDebuggerTest method resume.

private void resume() throws DebuggerException, InterruptedException {
    gdbDebugger.resume(new ResumeActionImpl());
    DebuggerEvent debuggerEvent = events.take();
    assertTrue(debuggerEvent instanceof SuspendEvent);
    SuspendEvent suspendEvent = (SuspendEvent) debuggerEvent;
    assertEquals(suspendEvent.getLocation().getTarget(), "h.cpp");
    assertEquals(suspendEvent.getLocation().getLineNumber(), 7);
}
Also used : SuspendEvent(org.eclipse.che.api.debug.shared.model.event.SuspendEvent) ResumeActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.ResumeActionImpl) DebuggerEvent(org.eclipse.che.api.debug.shared.model.event.DebuggerEvent)

Example 2 with SuspendEvent

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

the class NodeJsDebuggerTest method testOver.

@Test
public void testOver() throws Exception {
    debugger.stepOver(new StepOverActionImpl());
    ArgumentCaptor<SuspendEvent> suspendEventCaptor = ArgumentCaptor.forClass(SuspendEvent.class);
    verify(callback, timeout(1000)).onEvent(suspendEventCaptor.capture());
    SuspendEvent suspendEvent = suspendEventCaptor.getValue();
    assertEquals(suspendEvent.getLocation().getLineNumber(), 2);
    assertTrue(suspendEvent.getLocation().getTarget().endsWith("app.js"));
}
Also used : StepOverActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.StepOverActionImpl) SuspendEvent(org.eclipse.che.api.debug.shared.model.event.SuspendEvent) Test(org.testng.annotations.Test)

Example 3 with SuspendEvent

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

the class NodeJsDebuggerTest method testIntoAndOut.

@Test
public void testIntoAndOut() throws Exception {
    ArgumentCaptor<SuspendEvent> suspendEventCaptor = ArgumentCaptor.forClass(SuspendEvent.class);
    debugger.stepInto(new StepIntoActionImpl());
    verify(callback).onEvent(suspendEventCaptor.capture());
    SuspendEvent suspendEvent = suspendEventCaptor.getValue();
    assertEquals(suspendEvent.getLocation().getLineNumber(), 2);
    assertTrue(suspendEvent.getLocation().getTarget().endsWith("app.js"));
    Mockito.reset(callback);
    debugger.stepInto(new StepIntoActionImpl());
    verify(callback, timeout(1000)).onEvent(suspendEventCaptor.capture());
    suspendEvent = suspendEventCaptor.getValue();
    assertEquals(suspendEvent.getLocation().getLineNumber(), 5);
    assertTrue(suspendEvent.getLocation().getTarget().endsWith("app.js"));
    Mockito.reset(callback);
    debugger.stepOut(new StepOutActionImpl());
    verify(callback, timeout(1000)).onEvent(suspendEventCaptor.capture());
    suspendEvent = suspendEventCaptor.getValue();
    assertEquals(suspendEvent.getLocation().getLineNumber(), 9);
    assertTrue(suspendEvent.getLocation().getTarget().endsWith("app.js"));
}
Also used : StepIntoActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.StepIntoActionImpl) SuspendEvent(org.eclipse.che.api.debug.shared.model.event.SuspendEvent) StepOutActionImpl(org.eclipse.che.api.debug.shared.model.impl.action.StepOutActionImpl) Test(org.testng.annotations.Test)

Example 4 with SuspendEvent

use of org.eclipse.che.api.debug.shared.model.event.SuspendEvent 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 5 with SuspendEvent

use of org.eclipse.che.api.debug.shared.model.event.SuspendEvent 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)

Aggregations

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