Search in sources :

Example 26 with Breakpoint

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

the class BreakpointChangeClassifierTest method testClassifyConditionNoChanges.

@Test
public void testClassifyConditionNoChanges() {
    Breakpoint old = createBreakpoint();
    Breakpoint bp = createBreakpoint();
    old.setCondition("cond");
    bp.setCondition("cond");
    List<BreakpointChangeType> result = BreakpointChangeClassifier.classify(old, bp);
    assertEquals(1, result.size());
    assertEquals(BreakpointChangeType.UNKNOWN, 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 27 with Breakpoint

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

the class BreakpointChangeClassifierTest method testClassifyHCRemoved.

@Test
public void testClassifyHCRemoved() {
    Breakpoint old = createBreakpoint();
    Breakpoint bp = createBreakpoint();
    old.setHitCount(1);
    bp.setHitCount(-1);
    List<BreakpointChangeType> result = BreakpointChangeClassifier.classify(old, bp);
    assertEquals(1, result.size());
    assertEquals(BreakpointChangeType.HC_REMOVED, 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 28 with Breakpoint

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

the class BreakpointChangeClassifierTest method testClassifyNoChanges.

@Test
public void testClassifyNoChanges() {
    Breakpoint bp = createBreakpoint();
    List<BreakpointChangeType> result = BreakpointChangeClassifier.classify(bp, bp);
    assertEquals(1, result.size());
    assertEquals(BreakpointChangeType.UNKNOWN, 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 29 with Breakpoint

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

the class BreakpointCreator method createBreakpoint.

/**
 * Factory method that creates and returns a {@link Breakpoint} from a given
 * {@link IBreakpoint}.
 */
public static Breakpoint createBreakpoint(IBreakpoint breakpoint) {
    Breakpoint result = new Breakpoint(breakpoint.hashCode(), BreakpointClassifier.classify(breakpoint));
    try {
        result.setEnabled(breakpoint.isEnabled());
        // Make sure the hit count and suspend policy are initialized.
        result.setHitCount(-1);
        if (breakpoint instanceof IJavaBreakpoint) {
            IJavaBreakpoint bp = (IJavaBreakpoint) breakpoint;
            result.setSuspendPolicy(bp.getSuspendPolicy());
            result.setHitCount(bp.getHitCount());
        }
        // Initialize condition fields if available.
        if (breakpoint instanceof IJavaLineBreakpoint) {
            IJavaLineBreakpoint bp = (IJavaLineBreakpoint) breakpoint;
            result.setConditionEnabled(bp.isConditionEnabled());
            result.setCondition(bp.getCondition());
        }
    } catch (CoreException exception) {
        exception.printStackTrace();
    }
    return result;
}
Also used : IJavaBreakpoint(org.eclipse.jdt.debug.core.IJavaBreakpoint) Breakpoint(nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) IJavaLineBreakpoint(org.eclipse.jdt.debug.core.IJavaLineBreakpoint) IJavaBreakpoint(org.eclipse.jdt.debug.core.IJavaBreakpoint) IJavaLineBreakpoint(org.eclipse.jdt.debug.core.IJavaLineBreakpoint) CoreException(org.eclipse.core.runtime.CoreException)

Example 30 with Breakpoint

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

the class BreakpointListener method breakpointAdded.

@Override
public void breakpointAdded(IBreakpoint breakpoint) {
    Date timestamp = new Date();
    Breakpoint bp = BreakpointCreator.createBreakpoint(breakpoint);
    breakpoints.put(bp.getHash(), bp);
    BreakpointAddEvent event = new BreakpointAddEvent(bp.getHash(), bp.getBreakpointType(), timestamp);
    TrackingEventManager.addEvent(event);
}
Also used : Breakpoint(nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) BreakpointAddEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointAddEvent) Date(java.util.Date)

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