Search in sources :

Example 6 with TermsOfUseAndAccess

use of edu.harvard.iq.dataverse.TermsOfUseAndAccess in project dataverse by IQSS.

the class FileUtilTest method testIsDownloadPopupRequiredHasTermsOfUseAndCc0License.

@Test
public void testIsDownloadPopupRequiredHasTermsOfUseAndCc0License() {
    DatasetVersion dsv1 = new DatasetVersion();
    dsv1.setVersionState(DatasetVersion.VersionState.RELEASED);
    TermsOfUseAndAccess termsOfUseAndAccess = new TermsOfUseAndAccess();
    /**
     * @todo Ask if setting the license to CC0 should be enough to not show
     * the popup when the are Terms of Use. This feels like a bug since the
     * Terms of Use should probably be shown.
     */
    termsOfUseAndAccess.setLicense(TermsOfUseAndAccess.License.CC0);
    termsOfUseAndAccess.setTermsOfUse("be excellent to each other");
    dsv1.setTermsOfUseAndAccess(termsOfUseAndAccess);
    assertEquals(false, FileUtil.isDownloadPopupRequired(dsv1));
}
Also used : DatasetVersion(edu.harvard.iq.dataverse.DatasetVersion) TermsOfUseAndAccess(edu.harvard.iq.dataverse.TermsOfUseAndAccess) Test(org.junit.Test)

Example 7 with TermsOfUseAndAccess

use of edu.harvard.iq.dataverse.TermsOfUseAndAccess in project dataverse by IQSS.

the class FileUtilTest method testIsPubliclyDownloadable2.

@Test
public void testIsPubliclyDownloadable2() {
    FileMetadata nonRestrictedFileMetadata = new FileMetadata();
    DatasetVersion dsv = new DatasetVersion();
    TermsOfUseAndAccess termsOfUseAndAccess = new TermsOfUseAndAccess();
    termsOfUseAndAccess.setTermsOfUse("be excellent to each other");
    dsv.setTermsOfUseAndAccess(termsOfUseAndAccess);
    dsv.setVersionState(DatasetVersion.VersionState.RELEASED);
    nonRestrictedFileMetadata.setDatasetVersion(dsv);
    Dataset dataset = new Dataset();
    dsv.setDataset(dataset);
    nonRestrictedFileMetadata.setRestricted(false);
    assertEquals(false, FileUtil.isPubliclyDownloadable(nonRestrictedFileMetadata));
}
Also used : Dataset(edu.harvard.iq.dataverse.Dataset) FileMetadata(edu.harvard.iq.dataverse.FileMetadata) DatasetVersion(edu.harvard.iq.dataverse.DatasetVersion) TermsOfUseAndAccess(edu.harvard.iq.dataverse.TermsOfUseAndAccess) Test(org.junit.Test)

Aggregations

TermsOfUseAndAccess (edu.harvard.iq.dataverse.TermsOfUseAndAccess)7 DatasetVersion (edu.harvard.iq.dataverse.DatasetVersion)5 Test (org.junit.Test)5 Dataset (edu.harvard.iq.dataverse.Dataset)1 FileMetadata (edu.harvard.iq.dataverse.FileMetadata)1 ParseException (java.text.ParseException)1 List (java.util.List)1 JsonArray (javax.json.JsonArray)1 JsonString (javax.json.JsonString)1 SwordError (org.swordapp.server.SwordError)1