use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval in project watchdog by TestRoots.
the class IntervalJsonConverterTest method testContainsIDEHost.
/**
* Tests the format of the returned Json representation, manually setting an
* IDE host.
*/
@Test
public void testContainsIDEHost() {
IntervalBase interval = new IDEOpenInterval(new Date());
ArrayList<WatchDogItem> intervals = createSampleIntervals(interval);
assertEquals("[{\"it\":\"eo\",\"ts\":1,\"te\":2,\"ss\":\"\"," + pasteWDVAndClient() + "}]", transferer.toJson(intervals));
}
use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval in project watchdog by TestRoots.
the class IntervalComparisonTest method testComparisonEqualIntervalsDifferentObjectsDifferentType.
@Test
public void testComparisonEqualIntervalsDifferentObjectsDifferentType() {
Date start = new Date();
UserActiveInterval interval1 = new UserActiveInterval(start);
IDEOpenInterval interval2 = new IDEOpenInterval(start);
interval1.close();
interval2.close();
interval2.setEndTime(interval1.getEnd());
assertEquals(1, interval1.compareTo(interval2));
assertEquals(-1, interval2.compareTo(interval1));
}
use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval in project watchdog by TestRoots.
the class IntervalComparisonTest method testComparisonTwoDifferentIntervalsDifferentType.
@Test
public void testComparisonTwoDifferentIntervalsDifferentType() {
UserActiveInterval interval1 = new UserActiveInterval(new Date(1));
IDEOpenInterval interval2 = new IDEOpenInterval(new Date(2));
interval1.close();
interval1.setEndTime(new Date(2));
interval2.close();
interval2.setEndTime(new Date(3));
assertEquals(-1, interval1.compareTo(interval2));
assertEquals(1, interval2.compareTo(interval1));
}
use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval in project watchdog by TestRoots.
the class IntervalJsonConverterTest method testJsonSessionIntervalRepresentation.
/**
* Tests the format of the returned Json representation.
*/
@Test
public void testJsonSessionIntervalRepresentation() {
IntervalBase interval = new IDEOpenInterval(new Date());
ArrayList<WatchDogItem> intervals = createSampleIntervals(interval);
assertEquals("[{\"it\":\"eo\",\"ts\":1,\"te\":2,\"ss\":\"\"," + pasteWDVAndClient() + "}]", transferer.toJson(intervals));
}
use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval in project watchdog by TestRoots.
the class IntervalPersisterTest method createRandomInterval.
public static IntervalBase createRandomInterval() {
IntervalBase interval = new IDEOpenInterval(new Date());
interval.setSessionSeed("444");
interval.setStartTime(new Date(interval.getStart().getTime() + (new Random()).nextInt(100000)));
interval.setEndTime(new Date(interval.getStart().getTime() + (new Random()).nextInt(100000)));
return interval;
}
Aggregations