use of edu.harvard.iq.dataverse.RoleAssignment in project dataverse by IQSS.
the class PrivateUrlUtilTest method testGetUserFromRoleAssignmentNonDataset.
@Test
public void testGetUserFromRoleAssignmentNonDataset() {
DataverseRole aRole = null;
PrivateUrlUser privateUrlUserIn = new PrivateUrlUser(42);
RoleAssignee anAssignee = privateUrlUserIn;
DvObject nonDataset = new Dataverse();
nonDataset.setId(123l);
String privateUrlToken = null;
RoleAssignment ra = new RoleAssignment(aRole, anAssignee, nonDataset, privateUrlToken);
PrivateUrlUser privateUrlUserOut = PrivateUrlUtil.getPrivateUrlUserFromRoleAssignment(ra);
assertNull(privateUrlUserOut);
}
use of edu.harvard.iq.dataverse.RoleAssignment in project dataverse by IQSS.
the class PrivateUrlUtilTest method testGetPrivateUrlRedirectDataFail.
@Test
public void testGetPrivateUrlRedirectDataFail() {
DataverseRole aRole = null;
long datasetId = 42;
PrivateUrlUser privateUrlUser = new PrivateUrlUser(datasetId);
RoleAssignee anAssignee = privateUrlUser;
Dataset dataset = new Dataset();
String privateUrlToken = null;
RoleAssignment ra = new RoleAssignment(aRole, anAssignee, dataset, privateUrlToken);
ra.setDefinitionPoint(null);
PrivateUrlRedirectData privateUrlRedirectData = null;
privateUrlRedirectData = PrivateUrlUtil.getPrivateUrlRedirectData(ra);
assertNull(privateUrlRedirectData);
}
use of edu.harvard.iq.dataverse.RoleAssignment in project dataverse by IQSS.
the class PrivateUrlUtilTest method testGetDatasetFromRoleAssignmentNonDataset.
@Test
public void testGetDatasetFromRoleAssignmentNonDataset() {
DataverseRole aRole = null;
PrivateUrlUser privateUrlUser = new PrivateUrlUser(42);
RoleAssignee anAssignee = privateUrlUser;
DvObject nonDataset = new Dataverse();
String privateUrlToken = null;
RoleAssignment ra = new RoleAssignment(aRole, anAssignee, nonDataset, privateUrlToken);
assertNull(PrivateUrlUtil.getDatasetFromRoleAssignment(ra));
}
use of edu.harvard.iq.dataverse.RoleAssignment in project dataverse by IQSS.
the class PrivateUrlUtilTest method testGetUserFromRoleAssignmentSucess.
@Test
public void testGetUserFromRoleAssignmentSucess() {
DataverseRole aRole = null;
PrivateUrlUser privateUrlUserIn = new PrivateUrlUser(42);
RoleAssignee anAssignee = privateUrlUserIn;
DvObject dataset = new Dataset();
dataset.setId(123l);
String privateUrlToken = null;
RoleAssignment ra = new RoleAssignment(aRole, anAssignee, dataset, privateUrlToken);
PrivateUrlUser privateUrlUserOut = PrivateUrlUtil.getPrivateUrlUserFromRoleAssignment(ra);
assertNotNull(privateUrlUserOut);
}
use of edu.harvard.iq.dataverse.RoleAssignment 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);
}
Aggregations