### Question:
AnalysisService extends DatasourceService { public Map<String, InputStream> doGetAnalysisFilesAsDownload( String analysisId ) throws PentahoAccessControlException { if ( !canManageACL() ) { throw new PentahoAccessControlException(); } MondrianCatalogRepositoryHelper helper = createNewMondrianCatalogRepositoryHelper(); Map<String, InputStream> fileData = helper.getModrianSchemaFiles( analysisId ); super.parseMondrianSchemaName( analysisId, fileData ); return fileData; } 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 testDoGetAnalysisFilesAsDownload() throws Exception { allAccess(); final Map<String, InputStream> sampleData = analysisService.doGetAnalysisFilesAsDownload( "SampleData" ); assertEquals( 1, sampleData.size() ); final FileInputStream inputStream = new FileInputStream( "target/test-classes/solution1/etc/mondrian/SampleData/schema.xml" ); assertEquals( IOUtils.toString( inputStream ), IOUtils.toString( sampleData.get( "SampleData.mondrian.xml" ) ) ); }
@Test( expected = PentahoAccessControlException.class ) public void testDoGetAnalysisFilesAsDownloadError() throws Exception { when( policy.isAllowed( any( String.class ) ) ).thenReturn( true ); when( permissionHandler.hasDataAccessPermission( any( IPentahoSession.class ) ) ).thenReturn( false ); analysisService.doGetAnalysisFilesAsDownload( "SampleData" ); }