Search in sources :

Example 1 with BreakpointChangeEvent

use of nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent in project watchdog by TestRoots.

the class EventJsonConverterTest method testJsonLineBreakpointChangeEventNoChanges.

@Test
public void testJsonLineBreakpointChangeEventNoChanges() {
    BreakpointChangeEvent event = new BreakpointChangeEvent(1, BreakpointType.LINE, null, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"bh\":1,\"bt\":\"li\",\"et\":\"bc\",\"ts\":1,\"ss\":\"\"," + pasteWDVAndClient() + "}]", transferer.toJson(events));
}
Also used : 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 2 with BreakpointChangeEvent

use of nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent in project watchdog by TestRoots.

the class EventJsonConverterTest method testJsonLineBreakpointChangeEventSingleChange.

@Test
public void testJsonLineBreakpointChangeEventSingleChange() {
    List<BreakpointChangeType> changes = new ArrayList<>();
    changes.add(BreakpointChangeType.ENABLED);
    BreakpointChangeEvent event = new BreakpointChangeEvent(1, BreakpointType.LINE, changes, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"ch\":[\"en\"],\"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 3 with BreakpointChangeEvent

use of nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent in project watchdog by TestRoots.

the class EventJsonConverterTest method testJsonLineBreakpointChangeEventTwoChanges.

@Test
public void testJsonLineBreakpointChangeEventTwoChanges() {
    List<BreakpointChangeType> changes = new ArrayList<>();
    changes.add(BreakpointChangeType.ENABLED);
    changes.add(BreakpointChangeType.HC_ADDED);
    BreakpointChangeEvent event = new BreakpointChangeEvent(1, BreakpointType.LINE, changes, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"ch\":[\"en\",\"ha\"],\"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 4 with BreakpointChangeEvent

use of nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent 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 5 with BreakpointChangeEvent

use of nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent in project watchdog by TestRoots.

the class TrackingEventManagerTest method testAddBreakpointChangeEvent.

@Test
public void testAddBreakpointChangeEvent() {
    BreakpointChangeEvent eventReal = new BreakpointChangeEvent(1, BreakpointType.LINE, null, new Date());
    BreakpointChangeEvent event = Mockito.spy(eventReal);
    trackingEventManager.addEvent(event);
    Mockito.verify(event).setSessionSeed(sessionSeed);
    Mockito.verify(eventsToTransferPersister).save(Mockito.isA(BreakpointChangeEvent.class));
    Mockito.verify(eventsStatisticsPersister).save(Mockito.isA(BreakpointChangeEvent.class));
}
Also used : Date(java.util.Date) BreakpointChangeEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent) Test(org.junit.Test)

Aggregations

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