[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Mon Mar 12 18:51:35 UTC 2007


gordonp
Mon Mar 12 14:51:35 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test
In directory dev.open-bio.org:/tmp/cvs-serv5161/src/main/ca/ucalgary/services/util/test

Modified Files:
	ACDFileTestCase.java 
Added Files:
	emma.acd 
Log Message:
Added fix to parse variable blocks in ACD files (e.g. emma)
moby-live/Java/src/main/ca/ucalgary/services/util/test emma.acd,NONE,1.1 ACDFileTestCase.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/ACDFileTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/ACDFileTestCase.java	2007/03/10 00:33:16	1.2
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/ACDFileTestCase.java	2007/03/12 18:51:35	1.3
@@ -9,6 +9,7 @@
 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";
+    private final static String ACDFILE_VARIABLE_RESOURCE = "ca/ucalgary/services/util/test/emma.acd";
 
     public ACDFileTestCase(String name){
 	super(name);
@@ -82,12 +83,12 @@
 	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);
+		   u + " was not as expected (expected 4)", 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);
+		   u + " was not as expected (expected 6)", section.size() == 6);
 
 	section = file.getAdvancedParamsSection();
 	assertNotNull("The advanced parameters section for the test data file was unexpectedly null", section);
@@ -97,7 +98,50 @@
 	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);
+		   u + " was not as expected (expected 4)", section.size() == 4);
+    }
+
+    public void testParsingVariable(){
+	URL u = getClass().getClassLoader().getResource(ACDFILE_VARIABLE_RESOURCE);
+	assertNotNull("Could not find the test ACD file resource ("+ACDFILE_VARIABLE_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 10)", section.size() == 10);
+
+	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 " +
+		   u + " was not as expected (expected 16)", section.size() == 16);
+
+	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 0)", section.size() == 0);
+
+	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 2)", section.size() == 2);
     }
 
     /**
@@ -108,6 +152,7 @@
 	TestSuite suite = new TestSuite();
  	suite.addTest(new ACDFileTestCase("testParsingBasic"));
  	suite.addTest(new ACDFileTestCase("testParsingSubsections"));
+ 	suite.addTest(new ACDFileTestCase("testParsingVariable"));
         return suite;
     }
 




More information about the MOBY-guts mailing list