use of org.pmiops.workbench.db.model.CohortReview in project workbench by all-of-us.
the class CohortReviewDaoTest method findCohortReviewByCohortIdAndCdrVersionId.
@Test
public void findCohortReviewByCohortIdAndCdrVersionId() throws Exception {
CohortReview cohortReview = createCohortReview();
cohortReviewDao.save(cohortReview);
assertEquals(cohortReview, cohortReviewDao.findCohortReviewByCohortIdAndCdrVersionId(cohortReview.getCohortId(), cohortReview.getCdrVersionId()));
}
use of org.pmiops.workbench.db.model.CohortReview in project workbench by all-of-us.
the class CohortReviewDaoTest method createCohortReview.
private CohortReview createCohortReview() {
final Sort sort = new Sort(Sort.Direction.ASC, "status");
final PageRequest pageRequest = new PageRequest(0, 25, sort);
Gson gson = new Gson();
return new CohortReview().cohortId(cohortId).cdrVersionId(CDR_VERSION_ID).creationTime(new Timestamp(Calendar.getInstance().getTimeInMillis())).lastModifiedTime(new Timestamp(Calendar.getInstance().getTimeInMillis())).matchedParticipantCount(100).reviewedCount(10);
}
use of org.pmiops.workbench.db.model.CohortReview in project workbench by all-of-us.
the class CohortReviewServiceImplTest method saveCohortReview.
@Test
public void saveCohortReview() throws Exception {
CohortReview cohortReview = new CohortReview();
when(cohortReviewDao.save(cohortReview)).thenReturn(cohortReview);
assertEquals(cohortReview, cohortReviewService.saveCohortReview(cohortReview));
verify(cohortReviewDao).save(cohortReview);
verifyNoMoreMockInteractions();
}
use of org.pmiops.workbench.db.model.CohortReview in project workbench by all-of-us.
the class CohortReviewServiceImplTest method findCohortReviewCohortIdAndCdrVersionId.
@Test
public void findCohortReviewCohortIdAndCdrVersionId() throws Exception {
long cohortReviewId = 1;
long cdrVersionId = 1;
CohortReview cohortReview = new CohortReview();
when(cohortReviewDao.findCohortReviewByCohortIdAndCdrVersionId(cohortReviewId, cdrVersionId)).thenReturn(cohortReview);
CohortReview actualCohortReview = cohortReviewService.findCohortReview(cohortReviewId, cdrVersionId);
assertEquals(cohortReview, actualCohortReview);
verify(cohortReviewDao).findCohortReviewByCohortIdAndCdrVersionId(cohortReviewId, cdrVersionId);
verifyNoMoreMockInteractions();
}
use of org.pmiops.workbench.db.model.CohortReview in project workbench by all-of-us.
the class CohortReviewController method getParticipantCohortAnnotations.
@Override
public ResponseEntity<ParticipantCohortAnnotationListResponse> getParticipantCohortAnnotations(String workspaceNamespace, String workspaceId, Long cohortId, Long cdrVersionId, Long participantId) {
CohortReview review = validateRequestAndSetCdrVersion(workspaceNamespace, workspaceId, cohortId, cdrVersionId, WorkspaceAccessLevel.READER);
List<org.pmiops.workbench.db.model.ParticipantCohortAnnotation> annotations = cohortReviewService.findParticipantCohortAnnotations(review.getCohortReviewId(), participantId);
ParticipantCohortAnnotationListResponse response = new ParticipantCohortAnnotationListResponse();
response.setItems(annotations.stream().map(TO_CLIENT_PARTICIPANT_COHORT_ANNOTATION).collect(Collectors.toList()));
return ResponseEntity.ok(response);
}
Aggregations