Search in sources :

Example 11 with IntervalBase

use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.IntervalBase 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 12 with IntervalBase

use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.IntervalBase in project watchdog by TestRoots.

the class NetworkUtilsTest method testIntervalTransfer.

@Test
@Ignore
public void testIntervalTransfer() {
    JsonTransferer it = new JsonTransferer();
    IntervalBase interval = new IDEOpenInterval(new Date());
    ArrayList<WatchDogItem> intervals = createSampleIntervals(interval);
    String json = it.toJson(intervals);
    try {
        NetworkUtils.transferJsonAndGetResponse(NetworkUtils.buildIntervalsPostURL(fooBarUser, fooBarProject), json);
    } catch (ServerCommunicationException | ServerReturnCodeException e) {
        fail(e.getMessage());
    }
}
Also used : JsonTransferer(nl.tudelft.watchdog.core.logic.network.JsonTransferer) ServerCommunicationException(nl.tudelft.watchdog.core.logic.network.ServerCommunicationException) IntervalBase(nl.tudelft.watchdog.core.logic.interval.intervaltypes.IntervalBase) ServerReturnCodeException(nl.tudelft.watchdog.core.logic.network.ServerReturnCodeException) IDEOpenInterval(nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval) Date(java.util.Date) WatchDogItem(nl.tudelft.watchdog.core.logic.storage.WatchDogItem) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

IntervalBase (nl.tudelft.watchdog.core.logic.interval.intervaltypes.IntervalBase)12 WatchDogItem (nl.tudelft.watchdog.core.logic.storage.WatchDogItem)10 Test (org.junit.Test)7 EditorIntervalBase (nl.tudelft.watchdog.core.logic.interval.intervaltypes.EditorIntervalBase)6 Date (java.util.Date)5 IDEOpenInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval)4 ArrayList (java.util.ArrayList)3 Random (java.util.Random)1 DebugInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.DebugInterval)1 JsonTransferer (nl.tudelft.watchdog.core.logic.network.JsonTransferer)1 ServerCommunicationException (nl.tudelft.watchdog.core.logic.network.ServerCommunicationException)1 ServerReturnCodeException (nl.tudelft.watchdog.core.logic.network.ServerReturnCodeException)1 DateTime (org.joda.time.DateTime)1 Ignore (org.junit.Ignore)1