[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Wed Apr 18 16:06:34 UTC 2007


gordonp
Wed Apr 18 12:06:33 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/test
In directory dev.open-bio.org:/tmp/cvs-serv12581/src/main/ca/ucalgary/services/test

Modified Files:
	ACDServiceTestCase.java 
Log Message:
Added check of binary data holder to ensure no corruption of the data occurs
moby-live/Java/src/main/ca/ucalgary/services/test ACDServiceTestCase.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/test/ACDServiceTestCase.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/test/ACDServiceTestCase.java	2007/04/12 00:57:32	1.2
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/test/ACDServiceTestCase.java	2007/04/18 16:06:33	1.3
@@ -24,7 +24,7 @@
     private final static String ACDTEST_MOBY_XML = "ca/ucalgary/services/test/mobyDNASeq.xml";
     private final static String ACDTEST_BINARY_DATA1 = "ca/ucalgary/services/test/mobyTest1.png";
     private final static String ACDTEST_BINARY_DATA2 = "ca/ucalgary/services/test/mobyTest2.png";
-    private final static String MOBY_PNG_DATATYPE = "b64_Encoded_PNG";
+    private final static String MOBY_PNG_DATATYPE = "PNGFormatImage";
 
     public ACDServiceTestCase(String name){
 	super(name);
@@ -74,6 +74,7 @@
 	}
 	assertNotNull("The binary test data resource " + u1.toString() + " could not be loaded",
 		      binaryDataParts.get(u1.toString()));
+
 	try{
 	    binaryDataParts.put(u2.toString(), getURLData(u2));
 	} catch(Exception e){
@@ -82,6 +83,17 @@
 	}   
 	assertNotNull("The binary test data resource " + u2.toString() + " could not be loaded",
 		      binaryDataParts.get(u2.toString()));
+	// Check that the byte holder class works okay
+	MobyDataBytes byteObject = null;
+	try{
+	    byteObject = new MobyDataBytes("foo", binaryDataParts.get(u2.toString()));
+	} catch(Exception e){
+	    e.printStackTrace();
+	    fail("Could not build a MobyDataBytes object from a byte array: "+ e);
+	}
+	assertTrue("The MobyDataBytes object does not return the same byte array " +
+		   "as given in its constructor (data corruption occured)",
+		   Arrays.equals(byteObject.getBytes(), binaryDataParts.get(u2.toString())));
 
 	MobyDataObjectSet pngCollectionTemplate = new MobyDataObjectSet("test", 
 						      new MobyDataObject[]{new MobyDataComposite(MOBY_PNG_DATATYPE)});




More information about the MOBY-guts mailing list