[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Sat Mar 10 00:33:16 UTC 2007


gordonp
Fri Mar  9 19:33:16 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test
In directory dev.open-bio.org:/tmp/cvs-serv28310/src/main/ca/ucalgary/services/util/test

Modified Files:
	ACDFileTestCase.java 
Added Files:
	dan.acd 
Log Message:
Added handling for ACD file subsections (ignore by MOBY, as all secondary params are at the same level)
moby-live/Java/src/main/ca/ucalgary/services/util/test dan.acd,NONE,1.1 ACDFileTestCase.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/ACDFileTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/ACDFileTestCase.java	2007/03/09 17:16:55	1.1
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/ACDFileTestCase.java	2007/03/10 00:33:16	1.2
@@ -8,12 +8,13 @@
 
 public class ACDFileTestCase extends TestCase{
     private final static String ACDFILE_RESOURCE = "ca/ucalgary/services/util/test/transeq.acd";
+    private final static String ACDFILE_SUBSECTION_RESOURCE = "ca/ucalgary/services/util/test/dan.acd";
 
     public ACDFileTestCase(String name){
 	super(name);
     }
 
-    public void testParsing(){
+    public void testParsingBasic(){
 	URL u = getClass().getClassLoader().getResource(ACDFILE_RESOURCE);
 	assertNotNull("Could not find the test ACD file resource ("+ACDFILE_RESOURCE+")", u);
 
@@ -35,6 +36,11 @@
 	assertTrue("The number of blocks (" + section.size() +") in the input section of " +
 		   u + " was not as expected (expected 1)", section.size() == 1);
 
+	section = file.getRequiredParamsSection();
+	assertNotNull("The required parameters section for the test data file was unexpectedly null", section);
+	assertTrue("The number of blocks (" + section.size() +") in the required parameter section of " +
+		   u + " was not as expected (expected 0)", section.size() == 0);
+
 	section = file.getAdditionalParamsSection();
 	assertNotNull("The additional parameters section for the test data file was unexpectedly null", section);
 	assertTrue("The number of blocks (" + section.size() +") in the additional parameter section of " +
@@ -51,13 +57,57 @@
 		   u + " was not as expected (expected 1)", section.size() == 1);
     }
 
+    public void testParsingSubsections(){
+	URL u = getClass().getClassLoader().getResource(ACDFILE_SUBSECTION_RESOURCE);
+	assertNotNull("Could not find the test ACD file resource ("+ACDFILE_SUBSECTION_RESOURCE+")", u);
+
+	ACDFile file = null;
+	try{
+	    file = new ACDFile(u);
+	} catch(Exception e){
+	    e.printStackTrace();
+	    fail("Could not load and parse the test input resource ("+u+"): " + e);
+	}
+	
+	List<Map<String,String>> section = file.getApplicationSection();
+	assertNotNull("The application section for the test data file was unexpectedly null", section);
+	assertTrue("The number of blocks (" + section.size() +") in the application section of " +
+		   u + " was not as expected (expected 1)", section.size() == 1);
+
+	section = file.getInputSection();
+	assertNotNull("The input section for the test data file was unexpectedly null", section);
+	assertTrue("The number of blocks (" + section.size() +") in the input section of " +
+		   u + " was not as expected (expected 1)", section.size() == 1);
+
+	section = file.getRequiredParamsSection();
+	assertNotNull("The required parameters section for the test data file was unexpectedly null", section);
+	assertTrue("The number of blocks (" + section.size() +") in the required parameter section of " +
+		   u + " was not as expected (expected 0)", section.size() == 4);
+
+	section = file.getAdditionalParamsSection();
+	assertNotNull("The additional parameters section for the test data file was unexpectedly null", section);
+	assertTrue("The number of blocks (" + section.size() +") in the additional parameter section of " +
+		   u + " was not as expected (expected 5)", section.size() == 6);
+
+	section = file.getAdvancedParamsSection();
+	assertNotNull("The advanced parameters section for the test data file was unexpectedly null", section);
+	assertTrue("The number of blocks (" + section.size() +") in the advanced parameter section of " +
+		   u + " was not as expected (expected 1)", section.size() == 1);
+
+	section = file.getOutputSection();
+	assertNotNull("The output section for the test data file was unexpectedly null", section);
+	assertTrue("The number of blocks (" + section.size() +") in the output section of " +
+		   u + " was not as expected (expected 1)", section.size() == 4);
+    }
+
     /**
      * @return a test suite for all the test methods of this test case.
      */
     public static Test suite() {
 
 	TestSuite suite = new TestSuite();
- 	suite.addTest(new ACDFileTestCase("testParsing"));
+ 	suite.addTest(new ACDFileTestCase("testParsingBasic"));
+ 	suite.addTest(new ACDFileTestCase("testParsingSubsections"));
         return suite;
     }
 




More information about the MOBY-guts mailing list