use of org.pmiops.workbench.model.MaterializeCohortRequest in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortWithReviewAllFilter.
@Test
public void testMaterializeCohortWithReviewAllFilter() {
MaterializeCohortRequest request = makeRequest(2);
request.setStatusFilter(ImmutableList.of(CohortStatus.EXCLUDED, CohortStatus.NOT_REVIEWED, CohortStatus.INCLUDED, CohortStatus.NEEDS_FURTHER_REVIEW));
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(cohortReview, SearchRequests.allGenders(), request);
assertPersonIds(response, 1L, 2L);
assertThat(response.getNextPageToken()).isNotNull();
request.setPageToken(response.getNextPageToken());
MaterializeCohortResponse response2 = cohortMaterializationService.materializeCohort(cohortReview, SearchRequests.allGenders(), request);
assertPersonIds(response2, 102246L);
assertThat(response2.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.MaterializeCohortRequest 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.MaterializeCohortRequest 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.MaterializeCohortRequest 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.MaterializeCohortRequest 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);
}
Aggregations