use of org.pmiops.workbench.model.Cohort in project workbench by all-of-us.
the class CohortsControllerTest method testMaterializeCohortCdrVersionNotFound.
@Test(expected = NotFoundException.class)
public void testMaterializeCohortCdrVersionNotFound() throws Exception {
Cohort cohort = createDefaultCohort();
cohort = cohortsController.createCohort(workspace.getNamespace(), workspace.getId(), cohort).getBody();
MaterializeCohortRequest request = new MaterializeCohortRequest();
request.setCohortName(cohort.getName());
request.setCdrVersionName("badCdrVersion");
cohortsController.materializeCohort(WORKSPACE_NAMESPACE, WORKSPACE_NAME, request);
}
use of org.pmiops.workbench.model.Cohort in project workbench by all-of-us.
the class CohortsControllerTest method testMaterializeCohortPageSizeZero.
public void testMaterializeCohortPageSizeZero() throws Exception {
Cohort cohort = createDefaultCohort();
cohort = cohortsController.createCohort(workspace.getNamespace(), workspace.getId(), cohort).getBody();
MaterializeCohortRequest request = new MaterializeCohortRequest();
request.setCohortName(cohort.getName());
request.setPageSize(0);
MaterializeCohortRequest adjustedRequest = new MaterializeCohortRequest();
request.setCohortName(cohort.getName());
request.setPageSize(CohortsController.DEFAULT_PAGE_SIZE);
MaterializeCohortResponse response = new MaterializeCohortResponse();
when(cohortMaterializationService.materializeCohort(null, searchRequest, adjustedRequest)).thenReturn(response);
assertThat(cohortsController.materializeCohort(WORKSPACE_NAMESPACE, WORKSPACE_NAME, request).getBody()).isEqualTo(response);
}
use of org.pmiops.workbench.model.Cohort in project workbench by all-of-us.
the class CohortsControllerTest method testMaterializeCohortBadCohortSpec.
@Test(expected = BadRequestException.class)
public void testMaterializeCohortBadCohortSpec() throws Exception {
Cohort cohort = createDefaultCohort();
cohort = cohortsController.createCohort(workspace.getNamespace(), workspace.getId(), cohort).getBody();
MaterializeCohortRequest request = new MaterializeCohortRequest();
request.setCohortSpec("badSpec");
cohortsController.materializeCohort(WORKSPACE_NAMESPACE, WORKSPACE_NAME, request);
}
use of org.pmiops.workbench.model.Cohort in project workbench by all-of-us.
the class CohortsControllerTest method testMaterializeCohortNoSpecOrCohortName.
@Test(expected = BadRequestException.class)
public void testMaterializeCohortNoSpecOrCohortName() throws Exception {
Cohort cohort = createDefaultCohort();
cohort = cohortsController.createCohort(workspace.getNamespace(), workspace.getId(), cohort).getBody();
MaterializeCohortRequest request = new MaterializeCohortRequest();
cohortsController.materializeCohort(WORKSPACE_NAMESPACE, WORKSPACE_NAME, request);
}
use of org.pmiops.workbench.model.Cohort in project workbench by all-of-us.
the class CohortsControllerTest method testGetCohortsInWorkspace.
@Test
public void testGetCohortsInWorkspace() throws Exception {
Cohort c1 = createDefaultCohort();
c1.setName("c1");
c1 = cohortsController.createCohort(workspace.getNamespace(), workspace.getId(), c1).getBody();
Cohort c2 = createDefaultCohort();
c2.setName("c2");
c2 = cohortsController.createCohort(workspace.getNamespace(), workspace.getId(), c2).getBody();
List<Cohort> cohorts = cohortsController.getCohortsInWorkspace(workspace.getNamespace(), workspace.getId()).getBody().getItems();
assertThat(cohorts).containsExactlyElementsIn(ImmutableSet.of(c1, c2));
}
Aggregations