use of nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint in project watchdog by TestRoots.
the class BreakpointCreatorTest method testCreateJavaBreakpointNoHitCount.
@Test
public void testCreateJavaBreakpointNoHitCount() throws CoreException {
IJavaBreakpoint bp = mock(IJavaBreakpoint.class);
when(bp.getHitCount()).thenReturn(-1);
Breakpoint result = BreakpointCreator.createBreakpoint(bp);
assertEquals(-1, result.getHitCount());
}
use of nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint in project watchdog by TestRoots.
the class BreakpointCreatorTest method testCreateJavaLineBreakpointConditionEnabled.
@Test
public void testCreateJavaLineBreakpointConditionEnabled() throws CoreException {
IJavaLineBreakpoint bp = mock(IJavaLineBreakpoint.class);
when(bp.isConditionEnabled()).thenReturn(true);
Breakpoint result = BreakpointCreator.createBreakpoint(bp);
assertTrue(result.isConditionEnabled());
}
use of nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint in project watchdog by TestRoots.
the class BreakpointListener method breakpointRemoved.
@Override
public void breakpointRemoved(@NotNull XBreakpoint xBreakpoint) {
Date timestamp = new Date();
Breakpoint breakpoint = BreakpointCreator.createBreakpoint(xBreakpoint);
breakpoints.remove(breakpoint.getHash());
BreakpointRemoveEvent event = new BreakpointRemoveEvent(breakpoint.getHash(), breakpoint.getBreakpointType(), timestamp);
trackingEventManager.addEvent(event);
}
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 XBreakpoint}.
*/
public static Breakpoint createBreakpoint(XBreakpoint breakpoint) {
Breakpoint result = new Breakpoint(breakpoint.hashCode(), BreakpointClassifier.classify(breakpoint));
// Initialize enabled and SuspendPolicy fields.
result.setEnabled(breakpoint.isEnabled());
result.setSuspendPolicy(breakpoint.getSuspendPolicy().ordinal());
// Initialize hit count field.
result.setHitCount(-1);
if (breakpoint.getProperties() instanceof JavaBreakpointProperties) {
JavaBreakpointProperties properties = (JavaBreakpointProperties) breakpoint.getProperties();
if (properties.isCOUNT_FILTER_ENABLED()) {
result.setHitCount(properties.getCOUNT_FILTER());
}
}
// Initialize condition fields if available.
XExpression condition = breakpoint.getConditionExpression();
if (condition != null) {
result.setCondition(condition.getExpression());
result.setConditionEnabled(true);
}
return result;
}
use of nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint in project watchdog by TestRoots.
the class BreakpointListener method breakpointRemoved.
@Override
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
Date timestamp = new Date();
Breakpoint bp = BreakpointCreator.createBreakpoint(breakpoint);
breakpoints.remove(bp.getHash());
BreakpointRemoveEvent event = new BreakpointRemoveEvent(bp.getHash(), bp.getBreakpointType(), timestamp);
TrackingEventManager.addEvent(event);
}
Aggregations