Search in sources :

Example 21 with Breakpoint

use of nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint in project watchdog by TestRoots.

the class BreakpointListener method breakpointChanged.

@Override
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
    Date timestamp = new Date();
    Breakpoint bp = BreakpointCreator.createBreakpoint(breakpoint);
    // Replace entry if present, otherwise create new entry.
    Breakpoint old = breakpoints.put(bp.getHash(), bp);
    List<BreakpointChangeType> changes = BreakpointChangeClassifier.classify(old, bp);
    BreakpointChangeEvent event = new BreakpointChangeEvent(bp.getHash(), bp.getBreakpointType(), changes, timestamp);
    TrackingEventManager.addEvent(event);
}
Also used : Breakpoint(nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) BreakpointChangeType(nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType) Date(java.util.Date) BreakpointChangeEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent)

Example 22 with Breakpoint

use of nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint in project watchdog by TestRoots.

the class BreakpointChangeClassifierTest method testClassifySPChanged.

@Test
public void testClassifySPChanged() {
    Breakpoint old = createBreakpoint();
    Breakpoint bp = createBreakpoint();
    old.setSuspendPolicy(0);
    bp.setSuspendPolicy(1);
    List<BreakpointChangeType> result = BreakpointChangeClassifier.classify(old, bp);
    assertEquals(1, result.size());
    assertEquals(BreakpointChangeType.SP_CHANGED, result.get(0));
}
Also used : Breakpoint(nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint) BreakpointChangeType(nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType) Test(org.junit.Test)

Example 23 with Breakpoint

use of nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint in project watchdog by TestRoots.

the class BreakpointChangeClassifierTest method testClassifyBPEnabled.

@Test
public void testClassifyBPEnabled() {
    Breakpoint old = createBreakpoint();
    Breakpoint bp = createBreakpoint();
    old.setEnabled(false);
    bp.setEnabled(true);
    List<BreakpointChangeType> result = BreakpointChangeClassifier.classify(old, bp);
    assertEquals(1, result.size());
    assertEquals(BreakpointChangeType.ENABLED, result.get(0));
}
Also used : Breakpoint(nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint) BreakpointChangeType(nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType) Test(org.junit.Test)

Example 24 with Breakpoint

use of nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint in project watchdog by TestRoots.

the class BreakpointChangeClassifierTest method testClassifyConditionChanged.

@Test
public void testClassifyConditionChanged() {
    Breakpoint old = createBreakpoint();
    Breakpoint bp = createBreakpoint();
    old.setCondition("cond_old");
    bp.setCondition("cond");
    List<BreakpointChangeType> result = BreakpointChangeClassifier.classify(old, bp);
    assertEquals(1, result.size());
    assertEquals(BreakpointChangeType.COND_CHANGED, result.get(0));
}
Also used : Breakpoint(nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint) BreakpointChangeType(nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType) Test(org.junit.Test)

Example 25 with Breakpoint

use of nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint in project watchdog by TestRoots.

the class BreakpointChangeClassifierTest method testClassifyThreeChangesWithCondition.

@Test
public void testClassifyThreeChangesWithCondition() {
    Breakpoint old = createBreakpoint();
    Breakpoint bp = createBreakpoint();
    old.setEnabled(true);
    bp.setEnabled(false);
    old.setConditionEnabled(true);
    bp.setConditionEnabled(false);
    old.setCondition("cond");
    bp.setCondition("cond_old");
    List<BreakpointChangeType> results = BreakpointChangeClassifier.classify(old, bp);
    assertEquals(3, results.size());
    assertTrue(results.contains(BreakpointChangeType.DISABLED));
    assertTrue(results.contains(BreakpointChangeType.COND_DISABLED));
    assertTrue(results.contains(BreakpointChangeType.COND_CHANGED));
}
Also used : Breakpoint(nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint) BreakpointChangeType(nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType) Test(org.junit.Test)

Aggregations

Breakpoint (nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint)38 Test (org.junit.Test)30 BreakpointChangeType (nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType)20 IBreakpoint (org.eclipse.debug.core.model.IBreakpoint)16 IJavaBreakpoint (org.eclipse.jdt.debug.core.IJavaBreakpoint)13 IJavaLineBreakpoint (org.eclipse.jdt.debug.core.IJavaLineBreakpoint)13 Date (java.util.Date)6 XBreakpoint (com.intellij.xdebugger.breakpoints.XBreakpoint)4 BreakpointAddEvent (nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointAddEvent)2 BreakpointChangeEvent (nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent)2 BreakpointRemoveEvent (nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointRemoveEvent)2 XExpression (com.intellij.xdebugger.XExpression)1 CoreException (org.eclipse.core.runtime.CoreException)1 JavaBreakpointProperties (org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties)1