Search in sources :

Example 96 with Consent

use of org.broadinstitute.consent.http.models.Consent in project consent by DataBiosphere.

the class ConsentDAOTest method testGetAssociationConsentIdsFromDatasetIds.

@Test
public void testGetAssociationConsentIdsFromDatasetIds() {
    Consent consent = createConsent(null);
    DataSet dataset = createDataset();
    createAssociation(consent.getConsentId(), dataset.getDataSetId());
    List<Integer> dataSetIds = Stream.of(dataset.getDataSetId()).collect(Collectors.toList());
    List<String> consentIds = consentDAO.getAssociationConsentIdsFromDatasetIds(dataSetIds);
    assertFalse(consentIds.isEmpty());
    assertTrue(consentIds.contains(consent.getConsentId()));
}
Also used : Consent(org.broadinstitute.consent.http.models.Consent) DataSet(org.broadinstitute.consent.http.models.DataSet) Test(org.junit.Test)

Example 97 with Consent

use of org.broadinstitute.consent.http.models.Consent in project consent by DataBiosphere.

the class ConsentDAOTest method testFindConsentFromDatasetID.

@Test
public void testFindConsentFromDatasetID() {
    DataSet dataset = createDataset();
    Consent consent = createConsent(null);
    createAssociation(consent.getConsentId(), dataset.getDataSetId());
    Consent foundConsent = consentDAO.findConsentFromDatasetID(dataset.getDataSetId());
    assertNotNull(foundConsent);
}
Also used : DataSet(org.broadinstitute.consent.http.models.DataSet) Consent(org.broadinstitute.consent.http.models.Consent) Test(org.junit.Test)

Example 98 with Consent

use of org.broadinstitute.consent.http.models.Consent in project consent by DataBiosphere.

the class ConsentDAOTest method testUpdateConsentUpdateStatus.

@Test
public void testUpdateConsentUpdateStatus() {
    Consent consent1 = createConsent(null);
    consentDAO.updateConsent(consent1.getConsentId(), consent1.getRequiresManualReview(), consent1.getUseRestriction().toString(), consent1.getDataUse().toString(), consent1.getDataUseLetter(), consent1.getName(), consent1.getDulName(), new Date(), consent1.getSortDate(), consent1.getTranslatedUseRestriction(), consent1.getGroupName(), true, consent1.getDacId());
    Consent consent2 = createConsent(null);
    consentDAO.updateConsent(consent2.getConsentId(), consent2.getRequiresManualReview(), consent2.getUseRestriction().toString(), consent2.getDataUse().toString(), consent2.getDataUseLetter(), consent2.getName(), consent2.getDulName(), new Date(), consent2.getSortDate(), consent2.getTranslatedUseRestriction(), consent2.getGroupName(), false, consent2.getDacId());
    Consent consent1Found = consentDAO.findConsentById(consent1.getConsentId());
    assertTrue(consent1Found.getUpdated());
    Consent consent2Found = consentDAO.findConsentById(consent2.getConsentId());
    assertFalse(consent2Found.getUpdated());
}
Also used : Consent(org.broadinstitute.consent.http.models.Consent) Date(java.util.Date) Test(org.junit.Test)

Example 99 with Consent

use of org.broadinstitute.consent.http.models.Consent in project consent by DataBiosphere.

the class ConsentDAOTest method testFindAssociationByTypeAndId.

@Test
public void testFindAssociationByTypeAndId() {
    DataSet dataset = createDataset();
    Consent consent = createConsent(null);
    createAssociation(consent.getConsentId(), dataset.getDataSetId());
    List<String> associations = consentDAO.findAssociationsByType(consent.getConsentId(), ASSOCIATION_TYPE_TEST);
    assertNotNull(associations);
    assertFalse(associations.isEmpty());
    String objectId = associations.get(0);
    String association = consentDAO.findAssociationByTypeAndId(consent.getConsentId(), ASSOCIATION_TYPE_TEST, objectId);
    assertNotNull(association);
    assertEquals(objectId, association);
}
Also used : DataSet(org.broadinstitute.consent.http.models.DataSet) Consent(org.broadinstitute.consent.http.models.Consent) Test(org.junit.Test)

Example 100 with Consent

use of org.broadinstitute.consent.http.models.Consent in project consent by DataBiosphere.

the class ConsentDAOTest method testCheckManualReview.

@Test
public void testCheckManualReview() {
    Consent consent = createConsent(null);
    Consent consent2 = createConsent(null);
    consentDAO.updateConsent(consent2.getConsentId(), true, consent2.getUseRestriction().toString(), consent2.getDataUse().toString(), consent2.getDataUseLetter(), consent2.getName(), consent2.getDulName(), new Date(), consent2.getSortDate(), consent2.getTranslatedUseRestriction(), consent2.getGroupName(), consent2.getUpdated(), consent2.getDacId());
    assertFalse(consentDAO.checkManualReview(consent.getConsentId()));
    assertTrue(consentDAO.checkManualReview(consent2.getConsentId()));
}
Also used : Consent(org.broadinstitute.consent.http.models.Consent) Date(java.util.Date) Test(org.junit.Test)

Aggregations

Consent (org.broadinstitute.consent.http.models.Consent)163 Test (org.junit.Test)127 DataSet (org.broadinstitute.consent.http.models.DataSet)86 Election (org.broadinstitute.consent.http.models.Election)72 Dac (org.broadinstitute.consent.http.models.Dac)61 User (org.broadinstitute.consent.http.models.User)56 Vote (org.broadinstitute.consent.http.models.Vote)48 ElectionReviewVote (org.broadinstitute.consent.http.models.ElectionReviewVote)32 Response (javax.ws.rs.core.Response)31 Date (java.util.Date)25 DataAccessRequest (org.broadinstitute.consent.http.models.DataAccessRequest)23 UnknownIdentifierException (org.broadinstitute.consent.http.exceptions.UnknownIdentifierException)13 NotFoundException (javax.ws.rs.NotFoundException)12 AuthUser (org.broadinstitute.consent.http.models.AuthUser)12 IOException (java.io.IOException)8 DatasetDTO (org.broadinstitute.consent.http.models.dto.DatasetDTO)8 ArrayList (java.util.ArrayList)7 File (java.io.File)6 Timestamp (java.sql.Timestamp)6 List (java.util.List)6