Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new tests for the configurations and for testing the publicati…
…on searcher.
- Loading branch information
Showing
5 changed files
with
162 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
#!/bin/sh | |||
|
|||
rm -rf Configurations | |||
|
|||
echo "Retreiving configuration from GitHub repo" | |||
mkdir Configurations | |||
cd Configurations | |||
wget https://github.com/downloads/ISA-tools/Configuration-Files/isaconfig-default_v2011-02-18.zip --no-check-certificate | |||
wget https://github.com/downloads/ISA-tools/Configuration-Files/isaconfig-default_v2011-02-18-MIMARKS-soil_v2011-02-18.zip --no-check-certificate | |||
wget https://github.com/downloads/ISA-tools/Configuration-Files/isaconfig-default_v2011-02-18-MIMARKS-water_v2011-02-18.zip --no-check-certificate | |||
wget https://github.com/downloads/ISA-tools/Configuration-Files/isaconfig-MISFISHIE-rodent-january-2011.zip --no-check-certificate | |||
|
|||
echo "Unzipping files" | |||
|
|||
unzip isaconfig-default_v2011-02-18.zip | |||
unzip isaconfig-default_v2011-02-18-MIMARKS-soil_v2011-02-18.zip | |||
unzip isaconfig-default_v2011-02-18-MIMARKS-water_v2011-02-18.zip | |||
unzip isaconfig-MISFISHIE-rodent-january-2011.zip | |||
|
|||
echo "Cleaning up directory" | |||
rm -rf __* | |||
rm *.zip | |||
|
|||
cd ../ | |||
|
|||
echo "Running tests" | |||
|
|||
# now run tests | |||
mvn $MVNOPTS clean test | |||
|
|||
echo "Testing completed successfully!" | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/test/java/org/isatools/isacreator/configuration/io/ConfigurationLoadTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,38 @@ | |||
package org.isatools.isacreator.configuration.io; | |||
|
|||
import org.junit.Test; | |||
|
|||
import java.io.File; | |||
|
|||
import static org.junit.Assert.assertTrue; | |||
|
|||
public class ConfigurationLoadTest { | |||
|
|||
@Test | |||
public void configurationTestLoad() { | |||
System.out.println("_____TESTING configurationTestLoad()"); | |||
|
|||
File configurationDirectory = new File("Configurations"); | |||
if(configurationDirectory.exists() && configurationDirectory.isDirectory()) { | |||
|
|||
File[] configurationFiles = configurationDirectory.listFiles(); | |||
|
|||
for(File file : configurationFiles) { | |||
|
|||
if(!file.isHidden() && !file.getName().startsWith(".")) { | |||
|
|||
ConfigXMLParser parser = new ConfigXMLParser(ConfigurationLoadingSource.ISACREATOR, file.getAbsolutePath()); | |||
|
|||
System.out.println("___loading configuration " + file.getName().toLowerCase()); | |||
|
|||
parser.loadConfiguration(); | |||
|
|||
assertTrue("Oh, the configuration size is 0!", parser.getTables().size() > 0); | |||
|
|||
System.out.println("Configuration " + file.getName().toLowerCase() + " loaded successfully"); | |||
} | |||
} | |||
} | |||
} | |||
|
|||
} |
53 changes: 53 additions & 0 deletions
53
src/test/java/org/isatools/isacreator/publicationlocator/CiteXploreTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,53 @@ | |||
package org.isatools.isacreator.publicationlocator; | |||
|
|||
import org.junit.Test; | |||
import uk.ac.ebi.cdb.client.Citation; | |||
import uk.ac.ebi.cdb.client.QueryException_Exception; | |||
import uk.ac.ebi.cdb.client.ResultBean; | |||
|
|||
import java.util.Collection; | |||
import java.util.List; | |||
|
|||
/** | |||
* Created by the ISA team | |||
* | |||
* @author Eamonn Maguire (eamonnmag@gmail.com) | |||
* <p/> | |||
* Date: 14/07/2011 | |||
* Time: 13:45 | |||
*/ | |||
public class CiteXploreTest { | |||
|
|||
@Test | |||
public void testCiteXplorePubMed() { | |||
runTest(SearchOption.PUBMED, "19815759"); | |||
} | |||
|
|||
@Test | |||
public void testCiteXploreDOI() { | |||
runTest(SearchOption.DOI, "10.1093/bioinformatics/btq415"); | |||
} | |||
|
|||
private void runTest(SearchOption searchOption, String query) { | |||
CiteExploreClient publicationSearcher = new CiteExploreClient(); | |||
|
|||
try { | |||
List<ResultBean> result = publicationSearcher.searchForPublication(searchOption, query); | |||
printResultBeans(result); | |||
} catch (QueryException_Exception qex) { | |||
System.out.printf("Caught QueryException_Exception: %s\n", qex.getFaultInfo().getMessage()); | |||
} catch (NoPublicationFoundException e) { | |||
System.out.println("No publication found"); | |||
} | |||
} | |||
|
|||
private void printResultBeans(Collection<ResultBean> resultBeans) { | |||
for(ResultBean resultBean : resultBeans) { | |||
Citation citation = resultBean.getCitation(); | |||
|
|||
System.out.println("citation.getTitle() = " + citation.getTitle()); | |||
System.out.println("citation.getAbstractText() = " + citation.getAbstractText()); | |||
System.out.println("citation.getAffiliation() = " + citation.getAffiliation()); | |||
} | |||
} | |||
} |