### Question:
AnalysisService extends DatasourceService { public List<String> getAnalysisDatasourceIds() { List<String> analysisIds = new ArrayList<String>(); List<MondrianCatalog> mockMondrianCatalogList = mondrianCatalogService.listCatalogs( getSession(), false ); Set<String> ids = metadataDomainRepository.getDomainIds(); for ( MondrianCatalog mondrianCatalog : mockMondrianCatalogList ) { String domainId = mondrianCatalog.getName() + METADATA_EXT; if ( !ids.contains( domainId ) ) { analysisIds.add( mondrianCatalog.getName() ); } } return analysisIds; } 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 testGetAnalysisDatasourceIds() throws Exception { final MondrianCatalog foodmartCatalog = new MondrianCatalog( "foodmart", "info", "file: new MondrianSchema( "foodmart", Collections.emptyList() ) ); final MondrianCatalog foodmartCatalog2 = new MondrianCatalog( "foodmart2", "info", "file: new MondrianSchema( "foodmart2", Collections.emptyList() ) ); final List<MondrianCatalog> catalogs = Arrays.asList( foodmartCatalog, foodmartCatalog2 ); doReturn( catalogs ).when( catalogService ).listCatalogs( any( IPentahoSession.class ), eq( false ) ); final HashSet<String> domainIds = Sets.newHashSet( "foodmart.xmi", "sample.xmi" ); doReturn( domainIds ).when( metadataRepository ).getDomainIds(); final List<String> response = analysisService.getAnalysisDatasourceIds(); assertEquals( Collections.singletonList( "foodmart2" ), response ); }