[OFBiz] SVN: r6132 - trunk/framework/entity/src/org/ofbiz/entity/test

sichen at svn.ofbiz.org sichen at svn.ofbiz.org
Wed Nov 16 17:36:57 EST 2005


Author: sichen
Date: 2005-11-16 16:36:54 -0600 (Wed, 16 Nov 2005)
New Revision: 6132

Modified:
   trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
Log:
New test for setting byte values into blobs, thanks to Manuel Meyer

Modified: trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
===================================================================
--- trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java	2005-11-16 20:41:58 UTC (rev 6131)
+++ trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java	2005-11-16 22:36:54 UTC (rev 6132)
@@ -80,7 +80,7 @@
     protected void setUp() throws Exception {
         this.delegator = GenericDelegator.getGenericDelegator(DELEGATOR_NAME);
     }
-
+    
     /*
      * Tests storing values with the delegator's .create, .makeValue, and .storeAll methods
      */
@@ -539,6 +539,27 @@
   }
 
   /*
+   * Tests setting a byte value into a blob data type using the GenericValue .setBytes method 
+   */
+  public void testBlobCreate() throws Exception {
+      try {
+          byte[] b = new byte[1];
+          b[0] = (byte)0x01;
+          GenericValue testingBlob = delegator.makeValue("TestBlob", UtilMisc.toMap("testBlobId", "byte-blob"));
+          testingBlob.setBytes("testBlobField", b);
+          testingBlob.create();
+          
+          TestCase.assertTrue("Blob with byte value successfully created...", true);
+      } catch(Exception ex) {
+        TestCase.fail(ex.getMessage());
+      } finally {
+          // Remove all our newly inserted values.
+        List values = delegator.findAll("TestBlob");
+        delegator.removeAll(values);
+      }
+  }
+
+  /*
    * This creates an string id from a number 
    */
   private String getTestId(String strTestBase, int iNum) {



More information about the Svn mailing list