Search in sources :

Example 31 with WatchDogItem

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

the class IntervalPersisterTestSingleInterval method test1WriteInterval.

@Test
public void test1WriteInterval() {
    interval = IntervalPersisterTest.createRandomInterval();
    interval.close();
    persister.save(interval);
    WatchDogItem savedItem = new ArrayList<>(persister.readItems()).get(0);
    assertTrue(savedItem instanceof IntervalBase);
    IntervalBase savedInterval = (IntervalBase) savedItem;
    assertEquals(interval.getType(), savedInterval.getType());
    assertEquals(interval.getStart(), savedInterval.getStart());
    assertEquals(interval.getEnd(), savedInterval.getEnd());
    assertEquals(interval.getDuration(), savedInterval.getDuration());
    assertEquals(interval.isClosed(), savedInterval.isClosed());
}
Also used : IntervalBase(nl.tudelft.watchdog.core.logic.interval.intervaltypes.IntervalBase) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Test(org.junit.Test)

Example 32 with WatchDogItem

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

the class IntervalPersisterTestSingleInterval method test2CompareIntervalAfterWrite.

@Test
public void test2CompareIntervalAfterWrite() {
    WatchDogItem savedItem = new ArrayList<>(persister.readItems()).get(0);
    assertTrue(savedItem instanceof IntervalBase);
    IntervalBase savedInterval = (IntervalBase) savedItem;
    assertEquals(interval.getType(), savedInterval.getType());
    assertEquals(interval.getStart(), savedInterval.getStart());
    assertEquals(interval.getEnd(), savedInterval.getEnd());
}
Also used : IntervalBase(nl.tudelft.watchdog.core.logic.interval.intervaltypes.IntervalBase) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Test(org.junit.Test)

Example 33 with WatchDogItem

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

the class EventJsonConverterTest method testJsonMethodBreakpointAddEventRepresentation.

@Test
public void testJsonMethodBreakpointAddEventRepresentation() {
    BreakpointAddEvent event = new BreakpointAddEvent(1, BreakpointType.METHOD, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"bh\":1,\"bt\":\"me\",\"et\":\"ba\",\"ts\":1,\"ss\":\"\"," + pasteWDVAndClient() + "}]", transferer.toJson(events));
}
Also used : BreakpointAddEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointAddEvent) Date(java.util.Date) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Test(org.junit.Test)

Example 34 with WatchDogItem

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

the class EventJsonConverterTest method testJsonSuspendBreakpointEvent.

@Test
public void testJsonSuspendBreakpointEvent() {
    DebugEventBase event = new DebugEventBase(TrackingEventType.SUSPEND_BREAKPOINT, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"et\":\"sb\",\"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 35 with WatchDogItem

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

the class EventJsonConverterTest method testJsonExceptionBreakpointAddEventRepresentation.

@Test
public void testJsonExceptionBreakpointAddEventRepresentation() {
    BreakpointAddEvent event = new BreakpointAddEvent(1, BreakpointType.EXCEPTION, new Date());
    ArrayList<WatchDogItem> events = createSampleEvents(event);
    assertEquals("[{\"bh\":1,\"bt\":\"ex\",\"et\":\"ba\",\"ts\":1,\"ss\":\"\"," + pasteWDVAndClient() + "}]", transferer.toJson(events));
}
Also used : BreakpointAddEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointAddEvent) Date(java.util.Date) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Test(org.junit.Test)

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