use of org.pmiops.workbench.model.MaterializeCohortRequest in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortWithReviewIncludedAndExcludedFilter.
@Test
public void testMaterializeCohortWithReviewIncludedAndExcludedFilter() {
MaterializeCohortRequest request = makeRequest(2);
request.setStatusFilter(ImmutableList.of(CohortStatus.EXCLUDED, CohortStatus.INCLUDED));
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(cohortReview, SearchRequests.allGenders(), request);
assertPersonIds(response, 1L, 2L);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.MaterializeCohortRequest in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortWithReviewNotReviewedAndExcludedFilter.
@Test
public void testMaterializeCohortWithReviewNotReviewedAndExcludedFilter() {
MaterializeCohortRequest request = makeRequest(2);
request.setStatusFilter(ImmutableList.of(CohortStatus.EXCLUDED, CohortStatus.NOT_REVIEWED));
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(cohortReview, SearchRequests.allGenders(), request);
assertPersonIds(response, 2L, 102246L);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.MaterializeCohortRequest in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortWithReviewNullStatusFilter.
@Test
public void testMaterializeCohortWithReviewNullStatusFilter() {
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(cohortReview, SearchRequests.allGenders(), makeRequest(2));
// With a null status filter, everyone is returned.
assertPersonIds(response, 1L, 2L);
assertThat(response.getNextPageToken()).isNotNull();
MaterializeCohortRequest request = makeRequest(2);
request.setPageToken(response.getNextPageToken());
MaterializeCohortResponse response2 = cohortMaterializationService.materializeCohort(null, 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 CohortMaterializationServiceTest method testMaterializeCohortPaging.
@Test
public void testMaterializeCohortPaging() {
MaterializeCohortRequest request = makeRequest(2);
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(null, SearchRequests.allGenders(), request);
assertPersonIds(response, 1L, 2L);
assertThat(response.getNextPageToken()).isNotNull();
request.setPageToken(response.getNextPageToken());
MaterializeCohortResponse response2 = cohortMaterializationService.materializeCohort(null, SearchRequests.allGenders(), request);
assertPersonIds(response2, 102246L);
assertThat(response2.getNextPageToken()).isNull();
try {
// Pagination token doesn't match, this should fail.
cohortMaterializationService.materializeCohort(null, SearchRequests.males(), request);
fail("Exception expected");
} catch (BadRequestException e) {
// expected
}
PaginationToken token = PaginationToken.fromBase64(response.getNextPageToken());
PaginationToken invalidToken = new PaginationToken(-1L, token.getParameterHash());
request.setPageToken(invalidToken.toBase64());
try {
// Pagination token doesn't match, this should fail.
cohortMaterializationService.materializeCohort(null, SearchRequests.males(), request);
fail("Exception expected");
} catch (BadRequestException e) {
// expected
}
}
use of org.pmiops.workbench.model.MaterializeCohortRequest in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortWithReviewJustIncludedFilter.
@Test
public void testMaterializeCohortWithReviewJustIncludedFilter() {
MaterializeCohortRequest request = makeRequest(2);
request.setStatusFilter(ImmutableList.of(CohortStatus.INCLUDED));
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(cohortReview, SearchRequests.allGenders(), request);
assertPersonIds(response, 1L);
assertThat(response.getNextPageToken()).isNull();
}
Aggregations