use of org.pmiops.workbench.db.model.ParticipantCohortAnnotation in project workbench by all-of-us.
the class ParticipantCohortAnnotationDaoTest method findByAnnotationIdAndCohortReviewIdAndParticipantId.
@Test
public void findByAnnotationIdAndCohortReviewIdAndParticipantId() throws Exception {
ParticipantCohortAnnotation expectedPCA = new ParticipantCohortAnnotation().annotationId(annotationId).cohortAnnotationDefinitionId(cohortAnnotationDefinitionId).cohortReviewId(cohortReviewId).participantId(participantId).annotationValueBoolean(Boolean.TRUE);
ParticipantCohortAnnotation actualPCA = participantCohortAnnotationDao.findByAnnotationIdAndCohortReviewIdAndParticipantId(annotationId, cohortReviewId, participantId);
assertEquals(expectedPCA, actualPCA);
}
use of org.pmiops.workbench.db.model.ParticipantCohortAnnotation in project workbench by all-of-us.
the class ParticipantCohortAnnotationDaoTest method findByCohortReviewIdAndParticipantIdEnum.
@Test
public void findByCohortReviewIdAndParticipantIdEnum() throws Exception {
ParticipantCohortAnnotation expectedPCA = new ParticipantCohortAnnotation().annotationId(annotationId).cohortAnnotationDefinitionId(cohortAnnotationDefinitionId1).cohortReviewId(cohortReviewId).participantId(participantId).annotationValueEnum("test");
List<ParticipantCohortAnnotation> annotations = participantCohortAnnotationDao.findByCohortReviewIdAndParticipantId(cohortReviewId, participantId);
assertEquals(2, annotations.size());
assertEquals(expectedPCA, annotations.get(1));
assertEquals(new CohortAnnotationEnumValue().name("z").order(0), annotations.get(1).getCohortAnnotationEnumValue());
}
use of org.pmiops.workbench.db.model.ParticipantCohortAnnotation in project workbench by all-of-us.
the class ParticipantCohortAnnotationDaoTest method findByCohortReviewIdAndParticipantId.
@Test
public void findByCohortReviewIdAndParticipantId() throws Exception {
ParticipantCohortAnnotation expectedPCA = new ParticipantCohortAnnotation().annotationId(annotationId).cohortAnnotationDefinitionId(cohortAnnotationDefinitionId).cohortReviewId(cohortReviewId).participantId(participantId).annotationValueBoolean(Boolean.TRUE);
List<ParticipantCohortAnnotation> annotations = participantCohortAnnotationDao.findByCohortReviewIdAndParticipantId(cohortReviewId, participantId);
assertEquals(2, annotations.size());
assertEquals(expectedPCA, annotations.get(0));
}
use of org.pmiops.workbench.db.model.ParticipantCohortAnnotation in project workbench by all-of-us.
the class ParticipantCohortAnnotationDaoTest method setUp.
@Before
public void setUp() throws Exception {
CohortAnnotationDefinition cohortAnnotationDefinition = new CohortAnnotationDefinition().cohortId(COHORT_ID).columnName("enum").annotationType(AnnotationType.ENUM);
CohortAnnotationEnumValue enumValue1 = new CohortAnnotationEnumValue().name("z").order(0).cohortAnnotationDefinition(cohortAnnotationDefinition);
CohortAnnotationEnumValue enumValue2 = new CohortAnnotationEnumValue().name("r").order(1).cohortAnnotationDefinition(cohortAnnotationDefinition);
CohortAnnotationEnumValue enumValue3 = new CohortAnnotationEnumValue().name("a").order(2).cohortAnnotationDefinition(cohortAnnotationDefinition);
cohortAnnotationDefinition.getEnumValues().add(enumValue1);
cohortAnnotationDefinition.getEnumValues().add(enumValue2);
cohortAnnotationDefinition.getEnumValues().add(enumValue3);
cohortAnnotationDefinitionDao.save(cohortAnnotationDefinition);
ParticipantCohortAnnotation pca = new ParticipantCohortAnnotation().cohortAnnotationDefinitionId(cohortAnnotationDefinitionId).cohortReviewId(cohortReviewId).participantId(participantId).annotationValueBoolean(Boolean.TRUE);
ParticipantCohortAnnotation pca1 = new ParticipantCohortAnnotation().cohortAnnotationDefinitionId(cohortAnnotationDefinitionId1).cohortReviewId(cohortReviewId).participantId(participantId).annotationValueEnum("test");
pca1.setCohortAnnotationEnumValue(enumValue1);
annotationId = participantCohortAnnotationDao.save(pca).getAnnotationId();
participantCohortAnnotationDao.save(pca1);
}
use of org.pmiops.workbench.db.model.ParticipantCohortAnnotation in project workbench by all-of-us.
the class CohortReviewServiceImplTest method saveParticipantCohortAnnotationModifyBadRequest.
@Test
public void saveParticipantCohortAnnotationModifyBadRequest() throws Exception {
long annotationId = 1;
long cohortAnnotationDefinitionId = 1;
long cohortReviewId = 1;
long participantId = 1;
ParticipantCohortAnnotation participantCohortAnnotation = new ParticipantCohortAnnotation().cohortAnnotationDefinitionId(cohortAnnotationDefinitionId).cohortReviewId(cohortReviewId).participantId(participantId);
assertParticipantCohortAnnotationModifyBadRequest(annotationId, participantCohortAnnotation, AnnotationType.BOOLEAN);
assertParticipantCohortAnnotationModifyBadRequest(annotationId, participantCohortAnnotation, AnnotationType.INTEGER);
assertParticipantCohortAnnotationModifyBadRequest(annotationId, participantCohortAnnotation, AnnotationType.STRING);
assertParticipantCohortAnnotationModifyBadRequest(annotationId, participantCohortAnnotation, AnnotationType.ENUM);
assertParticipantCohortAnnotationModifyBadRequest(annotationId, participantCohortAnnotation, AnnotationType.DATE);
}
Aggregations