use of edu.harvard.iq.dataverse.Dataset in project dataverse by IQSS.
the class RepositoryStorageAbstractionLayerUtilTest method testGetRsalSites_3args.
@Test
public void testGetRsalSites_3args() {
System.out.println("getRsalSites");
Dataset dataset = new Dataset();
dataset.setIdentifier("identifierPartOfPersistentID");
dataset.setAuthority("10.5072/FK2");
String replicationSitesInDB = "dv.sbgrid.org:Harvard Medical School:USA,sbgrid.icm.uu.se:Uppsala University:Sweden,sbgrid.ncpss.org:Institut Pasteur de Montevideo:Uruguay,sbgrid.ncpss.org:Shanghai Institutes for Biological Sciences:China";
JsonArray myList = RepositoryStorageAbstractionLayerUtil.getSitesFromDb(replicationSitesInDB);
List<RsyncSite> result = RepositoryStorageAbstractionLayerUtil.getRsyncSites(dataset, myList);
System.out.println(result.get(0).getName());
assertEquals("Harvard Medical School", result.get(0).getName());
assertEquals("USA", result.get(0).getCountry());
assertEquals("dv.sbgrid.org", result.get(0).getFqdn());
assertEquals("10.5072/FK2/identifierPartOfPersistentID", result.get(0).getFullRemotePathToDirectory());
assertEquals("rsync -av rsync://dv.sbgrid.org/10.5072/FK2/identifierPartOfPersistentID", result.get(0).getRsyncDownloadcommand());
}
use of edu.harvard.iq.dataverse.Dataset in project dataverse by IQSS.
the class SubmitDatasetForReviewCommandTest method testDatasetNull.
@Test
public void testDatasetNull() {
dataset = null;
String expected = "Can't submit for review. Dataset is null.";
String actual = null;
Dataset updatedDataset = null;
try {
updatedDataset = testEngine.submit(new SubmitDatasetForReviewCommand(dataverseRequest, dataset));
} catch (CommandException ex) {
actual = ex.getMessage();
}
assertEquals(expected, actual);
assertNull(updatedDataset);
}
use of edu.harvard.iq.dataverse.Dataset in project dataverse by IQSS.
the class SubmitDatasetForReviewCommandTest method testDraftDataset.
@Test
public void testDraftDataset() {
dataset.getLatestVersion().setVersionState(DatasetVersion.VersionState.DRAFT);
Dataset updatedDataset = null;
try {
updatedDataset = testEngine.submit(new SubmitDatasetForReviewCommand(dataverseRequest, dataset));
} catch (CommandException ex) {
System.out.println("Error updating dataset: " + ex.getMessage());
}
assertNotNull(updatedDataset);
}
use of edu.harvard.iq.dataverse.Dataset in project dataverse by IQSS.
the class PrivateUrlUtilTest method testGetPrivateUrlUserFromRoleAssignmentAndAssigneeSuccess.
@Test
public void testGetPrivateUrlUserFromRoleAssignmentAndAssigneeSuccess() {
DataverseRole aRole = null;
PrivateUrlUser privateUrlUser = new PrivateUrlUser(42);
RoleAssignee assignee = privateUrlUser;
DvObject dataset = new Dataset();
dataset.setId(42l);
String privateUrlToken = "cd71e9d7-73a7-4ec8-b890-3d00499e8693";
RoleAssignment assignment = new RoleAssignment(aRole, assignee, dataset, privateUrlToken);
PrivateUrlUser privateUrl = PrivateUrlUtil.getPrivateUrlUserFromRoleAssignment(assignment, assignee);
assertNotNull(privateUrl);
}
use of edu.harvard.iq.dataverse.Dataset in project dataverse by IQSS.
the class FileUtilTest method testIsDownloadPopupRequiredHasGuestBook.
@Test
public void testIsDownloadPopupRequiredHasGuestBook() {
DatasetVersion datasetVersion = new DatasetVersion();
datasetVersion.setVersionState(DatasetVersion.VersionState.RELEASED);
Dataset dataset = new Dataset();
datasetVersion.setDataset(dataset);
Guestbook guestbook = new Guestbook();
guestbook.setEnabled(true);
dataset.setGuestbook(guestbook);
Dataverse dataverse = new Dataverse();
guestbook.setDataverse(dataverse);
assertEquals(true, FileUtil.isDownloadPopupRequired(datasetVersion));
}
Aggregations