Search in sources :

Example 11 with WatchDogItem

use of nl.tudelft.watchdog.core.logic.storage.WatchDogItem in project watchdog by TestRoots.

the class EventJsonConverterTest method testJsonStepOverEvent.

@Test
public void testJsonStepOverEvent() {
    DebugEventBase event = new DebugEventBase(TrackingEventType.STEP_OVER, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"et\":\"so\",\"ts\":1,\"ss\":\"\"," + pasteWDVAndClient() + "}]", transferer.toJson(events));
}
Also used : Date(java.util.Date) DebugEventBase(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.DebugEventBase) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Test(org.junit.Test)

Example 12 with WatchDogItem

use of nl.tudelft.watchdog.core.logic.storage.WatchDogItem 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 13 with WatchDogItem

use of nl.tudelft.watchdog.core.logic.storage.WatchDogItem in project watchdog by TestRoots.

the class EventJsonConverterTest method testJsonResumeClientEvent.

@Test
public void testJsonResumeClientEvent() {
    DebugEventBase event = new DebugEventBase(TrackingEventType.RESUME_CLIENT, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"et\":\"rc\",\"ts\":1,\"ss\":\"\"," + pasteWDVAndClient() + "}]", transferer.toJson(events));
}
Also used : Date(java.util.Date) DebugEventBase(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.DebugEventBase) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Test(org.junit.Test)

Example 14 with WatchDogItem

use of nl.tudelft.watchdog.core.logic.storage.WatchDogItem in project watchdog by TestRoots.

the class EventJsonConverterTest method createSampleEvents.

private ArrayList<WatchDogItem> createSampleEvents(EventBase event) {
    ArrayList<WatchDogItem> events = new ArrayList<WatchDogItem>();
    event.setTimestamp(new Date(1));
    event.setSessionSeed("");
    events.add(event);
    return events;
}
Also used : ArrayList(java.util.ArrayList) Date(java.util.Date) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem)

Example 15 with WatchDogItem

use of nl.tudelft.watchdog.core.logic.storage.WatchDogItem in project watchdog by TestRoots.

the class EventPersisterTest method testInteraction.

private void testInteraction(int items) {
    List<EventBase> generatedEvents = generateEventList(items);
    // Shuffle the generated events to test for
    // correct ordering of returned values
    Collections.shuffle(generatedEvents);
    Collections.sort(generatedEvents);
    for (EventBase event : generatedEvents) {
        persister.save(event);
    }
    List<WatchDogItem> readEvents = new ArrayList<WatchDogItem>(persister.readItems());
    assertEquals(readEvents.size(), items);
    // Test order of returned results
    assertEquals(readEvents, generatedEvents);
}
Also used : EventBase(nl.tudelft.watchdog.core.logic.event.eventtypes.EventBase) ArrayList(java.util.ArrayList) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem)

Aggregations

WatchDogItem (nl.tudelft.watchdog.core.logic.storage.WatchDogItem)43 Test (org.junit.Test)35 Date (java.util.Date)32 ArrayList (java.util.ArrayList)14 IntervalBase (nl.tudelft.watchdog.core.logic.interval.intervaltypes.IntervalBase)10 Document (nl.tudelft.watchdog.core.logic.document.Document)6 BreakpointAddEvent (nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointAddEvent)6 DebugEventBase (nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.DebugEventBase)6 TypingInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.TypingInterval)6 EditorWrapper (nl.tudelft.watchdog.eclipse.logic.document.EditorWrapper)6 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)6 BreakpointChangeEvent (nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent)5 EditorIntervalBase (nl.tudelft.watchdog.core.logic.interval.intervaltypes.EditorIntervalBase)5 BreakpointChangeType (nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType)4 EventBase (nl.tudelft.watchdog.core.logic.event.eventtypes.EventBase)4 IDEOpenInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval)3 BreakpointRemoveEvent (nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointRemoveEvent)1 DebugInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.DebugInterval)1 ReadingInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.ReadingInterval)1 JsonTransferer (nl.tudelft.watchdog.core.logic.network.JsonTransferer)1