### Question:
AnalysisService extends DatasourceService { public void setAnalysisDatasourceAcl( String analysisId, RepositoryFileAclDto aclDto ) throws PentahoAccessControlException, FileNotFoundException { checkAnalysisExists( analysisId ); final RepositoryFileAcl acl = aclDto == null ? null : repositoryFileAclAdapter.unmarshal( aclDto ); if ( aclAwareMondrianCatalogService != null ) { aclAwareMondrianCatalogService.setAclFor( analysisId, acl ); } flushDataSources(); } 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 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 ) ) ); }
@Test public void testSetAnalysisDatasourceAclNoAcl() throws Exception { allAccess(); String catalogName = "catalogName"; final MondrianCatalog mondrianCatalog = mock( MondrianCatalog.class ); when( catalogService.getCatalog( eq( catalogName ), any( IPentahoSession.class ) ) ).thenReturn( mondrianCatalog ); analysisService.setAnalysisDatasourceAcl( catalogName, null ); verify( catalogService ).setAclFor( eq( catalogName ), (RepositoryFileAcl) isNull() ); }