Search in sources :

Example 11 with PentahoMetadataDomainRepository

use of org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository in project data-access by pentaho.

the class MetadataServiceTest method testGetMetadataDatasourceAclNoAcl.

@Test
public void testGetMetadataDatasourceAclNoAcl() throws Exception {
    String domainId = DOMAIN_ID;
    doReturn(true).when(metadataService).canManageACL();
    when(metadataService.aclAwarePentahoMetadataDomainRepositoryImporter.getAclFor(domainId)).thenReturn(null);
    final Map<String, InputStream> domainFilesData = mock(Map.class);
    when(domainFilesData.isEmpty()).thenReturn(false);
    when(((PentahoMetadataDomainRepository) metadataService.metadataDomainRepository).getDomainFilesData(domainId)).thenReturn(domainFilesData);
    final RepositoryFileAclDto aclDto = metadataService.getMetadataAcl(domainId);
    verify(metadataService.aclAwarePentahoMetadataDomainRepositoryImporter).getAclFor(eq(domainId));
    assertNull(aclDto);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) StringInputStream(org.apache.tools.ant.filters.StringInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RepositoryFileAclDto(org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto) PentahoMetadataDomainRepository(org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

PentahoMetadataDomainRepository (org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository)11 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)7 FileInputStream (java.io.FileInputStream)5 InputStream (java.io.InputStream)5 Test (org.junit.Test)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 StringInputStream (org.apache.tools.ant.filters.StringInputStream)4 Matchers.anyString (org.mockito.Matchers.anyString)4 FileSystemBackedUnifiedRepository (org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)4 Facet (org.codehaus.enunciate.Facet)3 PentahoAccessControlException (org.pentaho.platform.api.engine.PentahoAccessControlException)3 RepositoryUtils (org.pentaho.platform.repository2.unified.RepositoryUtils)3 RepositoryFileAclDto (org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto)3 RepositoryFileAclAdapter (org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclAdapter)2 File (java.io.File)1 IOException (java.io.IOException)1 StringTokenizer (java.util.StringTokenizer)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 DomainStorageException (org.pentaho.metadata.repository.DomainStorageException)1