use of org.broadinstitute.consent.http.models.ElectionReview in project consent by DataBiosphere.
the class ElectionReviewResourceTest method testGetCollectElectionReview.
@Test
public void testGetCollectElectionReview() {
when(reviewResultsService.describeLastElectionReviewByReferenceIdAndType(any(), any())).thenReturn(new ElectionReview());
initResource();
ElectionReview response = resource.getCollectElectionReview(RandomStringUtils.random(10), RandomStringUtils.random(10));
assertNotNull(response);
}
use of org.broadinstitute.consent.http.models.ElectionReview in project consent by DataBiosphere.
the class ElectionReviewResourceTest method testGetRPElectionReviewByReferenceId.
@Test
public void testGetRPElectionReviewByReferenceId() {
when(electionService.findRPElectionByElectionAccessId(any())).thenReturn(1);
when(reviewResultsService.describeElectionReviewByElectionId(any())).thenReturn(new ElectionReview());
initResource();
ElectionReview response = resource.getRPElectionReviewByReferenceId(RandomUtils.nextInt(100, 1000), true);
assertNotNull(response);
}
use of org.broadinstitute.consent.http.models.ElectionReview in project consent by DataBiosphere.
the class ElectionReviewResourceTest method testGetElectionReviewByElectionId.
@Test
public void testGetElectionReviewByElectionId() {
when(reviewResultsService.describeElectionReviewByElectionId(any())).thenReturn(new ElectionReview());
initResource();
ElectionReview response = resource.getElectionReviewByElectionId(RandomUtils.nextInt(100, 1000));
assertNotNull(response);
}
use of org.broadinstitute.consent.http.models.ElectionReview in project consent by DataBiosphere.
the class ReviewResultsService method describeElectionReviewByElectionId.
public ElectionReview describeElectionReviewByElectionId(Integer electionId) {
ElectionReview review = null;
Election election = electionDAO.findElectionWithFinalVoteById(electionId);
if (election != null) {
review = new ElectionReview();
review.setElection(election);
Consent consent = consentDAO.findConsentById(review.getElection().getReferenceId());
List<ElectionReviewVote> rVotes = voteDAO.findAllElectionReviewVotesByElectionId(electionId);
review.setReviewVote(rVotes);
review.setConsent(consent);
}
return review;
}
use of org.broadinstitute.consent.http.models.ElectionReview in project consent by DataBiosphere.
the class ReviewResultsService method getElectionReview.
private ElectionReview getElectionReview(String referenceId, Election election) {
ElectionReview review = null;
if (election != null) {
review = new ElectionReview();
List<ElectionReviewVote> rVotes = voteDAO.findElectionReviewVotesByElectionId(election.getElectionId());
Consent consent = consentDAO.findConsentById(referenceId);
review.setConsent(consent);
review.setElection(election);
review.setReviewVote(rVotes);
}
return review;
}
Aggregations