use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclDto in project pentaho-platform by pentaho.
the class FileResourceTest method usersOrRolesExist_RecipientIsBlank.
@Test
public void usersOrRolesExist_RecipientIsBlank() {
RepositoryFileAclDto acl = new RepositoryFileAclDto();
acl.setOwner(ACL_OWNER);
RepositoryFileAclAceDto recipient = mock(RepositoryFileAclAceDto.class);
doReturn("").when(recipient).getRecipient();
acl.setAces(Arrays.asList(new RepositoryFileAclAceDto[] { recipient }), false);
assertFalse(fileResource.validateUsersAndRoles(acl));
}
use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclDto in project pentaho-platform by pentaho.
the class FileResourceTest method usersOrRolesExist_RecipientRoleExists.
@Test
public void usersOrRolesExist_RecipientRoleExists() {
RepositoryFileAclDto acl = new RepositoryFileAclDto();
acl.setOwner(ACL_OWNER);
RepositoryFileAclAceDto recipient = mock(RepositoryFileAclAceDto.class);
doReturn(ROLENAME).when(recipient).getRecipient();
acl.setAces(Arrays.asList(new RepositoryFileAclAceDto[] { recipient }), false);
assertTrue(fileResource.validateUsersAndRoles(acl));
}
use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclDto in project pentaho-platform by pentaho.
the class FileResourceTest method testDoGetFileAcl.
@Test
public void testDoGetFileAcl() {
RepositoryFileAclDto mockRepositoryFileAclDto = mock(RepositoryFileAclDto.class);
doReturn(mockRepositoryFileAclDto).when(fileResource.fileService).doGetFileAcl(PATH_ID);
RepositoryFileAclDto testResult = fileResource.doGetFileAcl(PATH_ID);
assertEquals(mockRepositoryFileAclDto, testResult);
}
use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclDto in project pentaho-platform by pentaho.
the class FileResourceTest method testSetFileAclsOK.
@Test
public void testSetFileAclsOK() {
RepositoryFileAclDto repository = mock(RepositoryFileAclDto.class);
doReturn(true).when(fileResource).validateUsersAndRoles(any());
assertEquals(OK.getStatusCode(), fileResource.setFileAcls(PATH_ID, repository).getStatus());
}
use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclDto in project data-access by pentaho.
the class AnalysisServiceTest method testGetAnalysisDatasourceAclNoAcl.
@Test
public void testGetAnalysisDatasourceAclNoAcl() throws Exception {
allAccess();
final String catalogName = "catalogName";
final MondrianCatalog mondrianCatalog = mock(MondrianCatalog.class);
when(catalogService.getCatalog(eq(catalogName), any(IPentahoSession.class))).thenReturn(mondrianCatalog);
when(catalogService.getAclFor(catalogName)).thenReturn(null);
final RepositoryFileAclDto aclDto = analysisService.getAnalysisDatasourceAcl(catalogName);
assertNull(aclDto);
}
Aggregations