### Question:
AnalysisService extends DatasourceService { public RepositoryFileAclDto getAnalysisDatasourceAcl( String analysisId ) throws PentahoAccessControlException, FileNotFoundException { checkAnalysisExists( analysisId ); if ( aclAwareMondrianCatalogService != null ) { final RepositoryFileAcl acl = aclAwareMondrianCatalogService.getAclFor( analysisId ); return acl == null ? null : repositoryFileAclAdapter.marshal( acl ); } return null; } AnalysisService(); Map<String, InputStream> doGetAnalysisFilesAsDownload( String analysisId ); void removeAnalysis( String analysisId ); List<String> getAnalysisDatasourceIds(); void putMondrianSchema( InputStream dataInputStream, FormDataContentDisposition schemaFileInfo,
                                 String catalogName, // Optional
                                 String origCatalogName, // Optional
                                 String datasourceName, // Optional
                                 boolean overwrite, boolean xmlaEnabledFlag, String parameters,
                                 RepositoryFileAclDto acl ); RepositoryFileAclDto getAnalysisDatasourceAcl( String analysisId ); void setAnalysisDatasourceAcl( String analysisId, RepositoryFileAclDto aclDto ); static final String METADATA_EXT; }### Answer:
@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 ) ); }
@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 ); }