use of org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclAdapter in project data-access by pentaho.
the class DataSourceWizardServiceTest method testSetMetadataDatasourceAcl.
@Test
public void testSetMetadataDatasourceAcl() throws Exception {
String domainId = DOMAIN_ID;
String domainIdWithoutExt = "domainId";
final RepositoryFileAclDto aclDto = new RepositoryFileAclDto();
aclDto.setOwner("owner");
aclDto.setOwnerType(RepositoryFileSid.Type.USER.ordinal());
doReturn(true).when(dataSourceWizardService).canManageACL();
doReturn(new HashMap<String, InputStream>()).when(dataSourceWizardService).doGetDSWFilesAsDownload(domainId);
dataSourceWizardService.setDSWAcl(domainId, aclDto);
final RepositoryFileAcl acl = new RepositoryFileAclAdapter().unmarshal(aclDto);
verify(dataSourceWizardService.aclAwarePentahoMetadataDomainRepositoryImporter).setAclFor(eq(domainId), eq(acl));
verify(dataSourceWizardService.aclAwareMondrianCatalogService).setAclFor(eq(domainIdWithoutExt), eq(acl));
}
use of org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclAdapter in project data-access by pentaho.
the class MetadataServiceTest method testSetMetadataDatasourceAcl.
@Test
public void testSetMetadataDatasourceAcl() throws Exception {
String domainId = DOMAIN_ID;
final RepositoryFileAclDto aclDto = new RepositoryFileAclDto();
aclDto.setOwner("owner");
aclDto.setOwnerType(RepositoryFileSid.Type.USER.ordinal());
doReturn(true).when(metadataService).canManageACL();
final Map<String, InputStream> domainFilesData = mock(Map.class);
when(domainFilesData.isEmpty()).thenReturn(false);
when(((PentahoMetadataDomainRepository) metadataService.metadataDomainRepository).getDomainFilesData(domainId)).thenReturn(domainFilesData);
metadataService.setMetadataAcl(domainId, aclDto);
verify(metadataService.aclAwarePentahoMetadataDomainRepositoryImporter).setAclFor(eq(domainId), eq(new RepositoryFileAclAdapter().unmarshal(aclDto)));
}
use of org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclAdapter in project data-access by pentaho.
the class AnalysisServiceTest method testSetAnalysisDatasourceAcl.
@Test
public void testSetAnalysisDatasourceAcl() throws Exception {
allAccess();
final String catalogName = "catalogName";
final RepositoryFileAclDto aclDto = new RepositoryFileAclDto();
aclDto.setOwner("owner");
aclDto.setOwnerType(RepositoryFileSid.Type.USER.ordinal());
final MondrianCatalog mondrianCatalog = mock(MondrianCatalog.class);
when(catalogService.getCatalog(eq(catalogName), any(IPentahoSession.class))).thenReturn(mondrianCatalog);
analysisService.setAnalysisDatasourceAcl(catalogName, aclDto);
verify(catalogService).setAclFor(eq(catalogName), eq(new RepositoryFileAclAdapter().unmarshal(aclDto)));
}
use of org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclAdapter in project data-access by pentaho.
the class AnalysisServiceTest method testGetAnalysisDatasourceAcl.
@Test
public void testGetAnalysisDatasourceAcl() throws Exception {
allAccess();
final String catalogName = "SampleData";
final RepositoryFileAcl expectedAcl = new RepositoryFileAcl.Builder("owner").build();
when(catalogService.getAclFor(catalogName)).thenReturn(expectedAcl);
final MondrianCatalog mondrianCatalog = mock(MondrianCatalog.class);
when(catalogService.getCatalog(eq(catalogName), any(IPentahoSession.class))).thenReturn(mondrianCatalog);
final RepositoryFileAclDto actualAcl = analysisService.getAnalysisDatasourceAcl(catalogName);
assertEquals(expectedAcl, new RepositoryFileAclAdapter().unmarshal(actualAcl));
}
use of org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclAdapter in project data-access by pentaho.
the class DataSourceWizardServiceTest method testGetDSWAcl.
@Test
public void testGetDSWAcl() throws Exception {
String domainId = "domainId";
final RepositoryFileAcl acl = new RepositoryFileAcl.Builder("owner").build();
doReturn(true).when(dataSourceWizardService).canManageACL();
when(dataSourceWizardService.aclAwarePentahoMetadataDomainRepositoryImporter.getAclFor(domainId)).thenReturn(acl);
final IUnifiedRepository repository = mock(IUnifiedRepository.class);
final RepositoryFile repositoryFile = mock(RepositoryFile.class);
when(repository.getFileById(anyString())).thenReturn(repositoryFile);
doReturn(new HashMap<String, InputStream>()).when(dataSourceWizardService).doGetDSWFilesAsDownload(domainId);
final RepositoryFileAclDto aclDto = dataSourceWizardService.getDSWAcl(domainId);
verify(dataSourceWizardService.aclAwarePentahoMetadataDomainRepositoryImporter).getAclFor(eq(domainId));
assertEquals(acl, new RepositoryFileAclAdapter().unmarshal(aclDto));
}
Aggregations