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));
}
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));
}
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));
}
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;
}
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);
}
Aggregations