Search in sources :

Example 21 with BreakpointChangeType

use of nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType 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 22 with BreakpointChangeType

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

the class EventJsonConverterTest method testJsonLineBreakpointChangeEventUnknownChange.

@Test
public void testJsonLineBreakpointChangeEventUnknownChange() {
    List<BreakpointChangeType> changes = new ArrayList<>();
    changes.add(BreakpointChangeType.UNKNOWN);
    BreakpointChangeEvent event = new BreakpointChangeEvent(1, BreakpointType.LINE, changes, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"ch\":[\"un\"],\"bh\":1,\"bt\":\"li\",\"et\":\"bc\",\"ts\":1,\"ss\":\"\"," + pasteWDVAndClient() + "}]", transferer.toJson(events));
}
Also used : BreakpointChangeType(nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType) ArrayList(java.util.ArrayList) Date(java.util.Date) BreakpointChangeEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Test(org.junit.Test)

Example 23 with BreakpointChangeType

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

the class EventJsonConverterTest method testJsonLineBreakpointChangeEventThreeChanges.

@Test
public void testJsonLineBreakpointChangeEventThreeChanges() {
    List<BreakpointChangeType> changes = new ArrayList<>();
    changes.add(BreakpointChangeType.DISABLED);
    changes.add(BreakpointChangeType.COND_DISABLED);
    changes.add(BreakpointChangeType.COND_CHANGED);
    BreakpointChangeEvent event = new BreakpointChangeEvent(1, BreakpointType.LINE, changes, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"ch\":[\"ds\",\"cd\",\"cc\"],\"bh\":1,\"bt\":\"li\",\"et\":\"bc\",\"ts\":1,\"ss\":\"\"," + pasteWDVAndClient() + "}]", transferer.toJson(events));
}
Also used : BreakpointChangeType(nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType) ArrayList(java.util.ArrayList) Date(java.util.Date) BreakpointChangeEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Test(org.junit.Test)

Example 24 with BreakpointChangeType

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

the class BreakpointListener method breakpointChanged.

@Override
public void breakpointChanged(@NotNull XBreakpoint xBreakpoint) {
    Date timestamp = new Date();
    Breakpoint breakpoint = BreakpointCreator.createBreakpoint(xBreakpoint);
    // Replace entry if present, otherwise create new entry.
    Breakpoint oldBreakpoint = breakpoints.put(breakpoint.getHash(), breakpoint);
    List<BreakpointChangeType> changes = BreakpointChangeClassifier.classify(oldBreakpoint, breakpoint);
    BreakpointChangeEvent event = new BreakpointChangeEvent(breakpoint.getHash(), breakpoint.getBreakpointType(), changes, timestamp);
    trackingEventManager.addEvent(event);
}
Also used : Breakpoint(nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint) BreakpointChangeType(nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType) Date(java.util.Date) BreakpointChangeEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent)

Aggregations

BreakpointChangeType (nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType)24 Test (org.junit.Test)22 Breakpoint (nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint)20 Date (java.util.Date)6 BreakpointChangeEvent (nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent)6 ArrayList (java.util.ArrayList)4 WatchDogItem (nl.tudelft.watchdog.core.logic.storage.WatchDogItem)4 XBreakpoint (com.intellij.xdebugger.breakpoints.XBreakpoint)1 IBreakpoint (org.eclipse.debug.core.model.IBreakpoint)1