### Question:
DSWDatasourceServiceImpl implements IDSWDatasourceService { public List<String> listDatasourceNames() throws IOException { synchronized ( CsvDatasourceServiceImpl.lock ) { IPentahoUrlFactory urlFactory = new SimpleUrlFactory( "" ); PMDUIComponent component = new PMDUIComponent( urlFactory, new ArrayList() ); component.validate( PentahoSessionHolder.getSession(), null ); component.setAction( PMDUIComponent.ACTION_LIST_MODELS ); Document document = component.getXmlContent(); ArrayList<String> datasourceNames = new ArrayList<>(); for ( Node node : document.selectNodes( " datasourceNames.add( node.getText() ); } return datasourceNames; } } DSWDatasourceServiceImpl();  DSWDatasourceServiceImpl( ConnectionServiceImpl connService ); boolean deleteLogicalModel( String domainId, String modelName ); SerializedResultSet doPreview( String connectionName, String query, String previewLimit ); boolean testDataSourceConnection( String connectionName ); BusinessData generateLogicalModel( String modelName, String connectionName, String dbType, String query,
                                            String previewLimit ); IMetadataDomainRepository getMetadataDomainRepository(); void setMetadataDomainRepository( IMetadataDomainRepository metadataDomainRepository ); boolean saveLogicalModel( Domain domain, boolean overwrite ); boolean hasPermission(); List<LogicalModelSummary> getLogicalModels( String context ); BusinessData loadBusinessData( String domainId, String modelId ); BogoPojo gwtWorkaround( BogoPojo pojo ); String serializeModelState( DatasourceDTO dto ); DatasourceDTO deSerializeModelState( String dtoStr ); List<String> listDatasourceNames(); @Override QueryDatasourceSummary generateQueryDomain( String name, String query, DatabaseConnection connection,
                                                     DatasourceDTO datasourceDTO ); void prepareForSerializaton( Domain domain ); String getDatasourceIllegalCharacters(); @Override GeoContext getGeoContext();  }### Answer:
@Test public void testListDatasourceNames() throws Exception { IPentahoSession session = mock( IPentahoSession.class ); when( session.getId() ).thenReturn( "SessionId" ); when( session.getActionName() ).thenReturn( "ActionNAme" ); when( session.getProcessId() ).thenReturn( "ProcessId" ); PentahoSessionHolder.setSession( session ); List<String> datasources = dswService.listDatasourceNames(); assertNotNull( datasources ); assertFalse( datasources.isEmpty() ); assertTrue( datasources.contains( LOGICAL_MODEL_ID_REPORTING ) ); }