/** Test loading a FASTA data source. */ @Test public void testLoadFastaSource() { SourceInfoLoader loader = SourceInfoLoader.getInstance(); SourceInfo fastaInfo = loader.getSourceInfo("fasta"); assertNotNull("No source info for 'fasta'", fastaInfo); assertEquals("Type wrong", "fasta", fastaInfo.getType()); SourceDescriptor source = fastaInfo.getSource(); assertEquals("SourceDescriptor type wrong", "fasta", source.getType()); assertEquals("Incorrect number of properties in source", 9, source.getProperty().size()); Map<String, PropertyDescriptor> propMap = new HashMap<String, PropertyDescriptor>(); for (PropertyDescriptor p : source.getProperty()) { propMap.put(p.getName(), p); } PropertyDescriptor srcDataDir = propMap.get("src.data.dir"); assertNotNull("No property 'src.data.dir'", srcDataDir); assertEquals( "'src.data.dir' not required when it should be", Boolean.TRUE, srcDataDir.isRequired()); assertEquals("'src.data.dir' type wrong", PropertyType.DIRECTORY, srcDataDir.getType()); assertNull("'src.data.dir' has validation", srcDataDir.getValidation()); PropertyDescriptor taxonId = propMap.get("fasta.taxonId"); assertNotNull("No property 'fasta.taxonId'", taxonId); assertEquals( "'fasta.taxonId' required when it should not be", Boolean.TRUE, taxonId.isRequired()); assertEquals("'fasta.taxonId' type wrong", PropertyType.STRING, taxonId.getType()); assertEquals("'fasta.taxonId' validation wrong", "^\\d+(\\s\\d+)*$", taxonId.getValidation()); }
/** * Prints all results stored in this object to the given writer * * @param wr The writer to which to print the results * @throws IOException Thrown when data writing fails */ public void printResults(Writer wr) throws IOException { for (SinkInfo sink : this.results.keySet()) { wr.write("Found a flow to sink " + sink + ", from the following sources:\n"); for (SourceInfo source : this.results.get(sink)) { wr.write("\t- " + source.getSource() + "\n"); if (source.getPath() != null && !source.getPath().isEmpty()) wr.write("\t\ton Path " + source.getPath() + "\n"); } } }
/** Prints all results stored in this object to the standard output */ public void printResults() { for (SinkInfo sink : this.results.keySet()) { logger.info("Found a flow to sink {}, from the following sources:", sink); for (SourceInfo source : this.results.get(sink)) { logger.info("\t- {}", source.getSource()); if (source.getPath() != null && !source.getPath().isEmpty()) logger.info("\t\ton Path {}", source.getPath()); } } }