use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceState in project BridgeServer2 by Sage-Bionetworks.
the class EventStreamAdherenceReportGeneratorTest method progression_done.
@Test
public void progression_done() {
AdherenceRecord adherenceRecord = createRecord(STARTED_ON, FINISHED_ON, "sessionInstanceGuid", false);
StudyActivityEvent event = createEvent("sessionStartEventId", NOW.minusDays(14));
AdherenceState state = createState(NOW, META1, event, adherenceRecord, true);
EventStreamAdherenceReport report = INSTANCE.generate(state);
assertEquals(report.getProgression(), ParticipantStudyProgress.DONE);
}
use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceState in project BridgeServer2 by Sage-Bionetworks.
the class EventStreamAdherenceReportGeneratorTest method groupsUnderEventId.
@Test
public void groupsUnderEventId() throws Exception {
AdherenceRecord adherenceRecord = createRecord(STARTED_ON, FINISHED_ON, "gnescr0HRz5T2JEjc0Ad6Q", false);
StudyActivityEvent event = createEvent("study_burst:Main Sequence:01", NOW.minusDays(3));
AdherenceState state = createState(NOW, META2_A, META2_B, event, adherenceRecord, false);
EventStreamAdherenceReport report = INSTANCE.generate(state);
assertNotNull(report.getStreams().get(0).getByDayEntries().get(2));
assertNotNull(report.getStreams().get(0).getByDayEntries().get(4));
assertEquals(getReportStates(report), ImmutableList.of(COMPLETED, NOT_YET_AVAILABLE));
}
use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceState in project BridgeServer2 by Sage-Bionetworks.
the class EventStreamAdherenceReportGeneratorTest method handleNulls.
@Test
public void handleNulls() {
AdherenceState state = new AdherenceState.Builder().withNow(NOW).build();
EventStreamAdherenceReport report = INSTANCE.generate(state);
assertEquals(100, report.getAdherencePercent());
// no time zone adjustment
assertEquals(report.getTimestamp(), NOW);
assertTrue(report.getStreams().isEmpty());
}
use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceState in project BridgeServer2 by Sage-Bionetworks.
the class EventStreamAdherenceReportGeneratorTest method stateCalculation_futureChangesState.
@Test
public void stateCalculation_futureChangesState() throws Exception {
AdherenceRecord adherenceRecord = createRecord(null, null, "sessionInstanceGuid", false);
StudyActivityEvent event = createEvent("sessionStartEventId", NOW);
AdherenceState state = createState(NOW.plusDays(28), META1, event, adherenceRecord);
EventStreamAdherenceReport report = INSTANCE.generate(state);
assertEquals(getReportStates(report), ImmutableList.of(EXPIRED));
}
use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceState in project BridgeServer2 by Sage-Bionetworks.
the class EventStreamAdherenceReportGeneratorTest method persistentSessionWindowsAreIgnored.
@Test
public void persistentSessionWindowsAreIgnored() {
AdherenceRecord adherenceRecord = createRecord(STARTED_ON, FINISHED_ON, "JOQg4yz0lrif7V3HYYzACw", false);
StudyActivityEvent event = createEvent("created_on", NOW);
AdherenceState state = createState(NOW, META_PERSISTENT, event, adherenceRecord);
assertTrue(INSTANCE.generate(state).getStreams().isEmpty());
}
Aggregations