Search in sources :

Example 1 with ElectionReview

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);
}
Also used : ElectionReview(org.broadinstitute.consent.http.models.ElectionReview) Test(org.junit.Test)

Example 2 with ElectionReview

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);
}
Also used : ElectionReview(org.broadinstitute.consent.http.models.ElectionReview) Test(org.junit.Test)

Example 3 with ElectionReview

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);
}
Also used : ElectionReview(org.broadinstitute.consent.http.models.ElectionReview) Test(org.junit.Test)

Example 4 with ElectionReview

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;
}
Also used : ElectionReview(org.broadinstitute.consent.http.models.ElectionReview) ElectionReviewVote(org.broadinstitute.consent.http.models.ElectionReviewVote) Consent(org.broadinstitute.consent.http.models.Consent) Election(org.broadinstitute.consent.http.models.Election)

Example 5 with ElectionReview

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;
}
Also used : ElectionReview(org.broadinstitute.consent.http.models.ElectionReview) ElectionReviewVote(org.broadinstitute.consent.http.models.ElectionReviewVote) Consent(org.broadinstitute.consent.http.models.Consent)

Aggregations

ElectionReview (org.broadinstitute.consent.http.models.ElectionReview)7 Consent (org.broadinstitute.consent.http.models.Consent)4 Test (org.junit.Test)4 Election (org.broadinstitute.consent.http.models.Election)3 DataAccessRequest (org.broadinstitute.consent.http.models.DataAccessRequest)2 ElectionReviewVote (org.broadinstitute.consent.http.models.ElectionReviewVote)2 Vote (org.broadinstitute.consent.http.models.Vote)2 ArrayList (java.util.ArrayList)1 RolesAllowed (javax.annotation.security.RolesAllowed)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 DataAccessRequestData (org.broadinstitute.consent.http.models.DataAccessRequestData)1