db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb repository_junit.xml
Date Tue, 27 Jan 2004 20:45:24 GMT
arminw      2004/01/27 12:45:24

  Modified:    src/test/org/apache/ojb/broker BlobTest.java
               src/test/org/apache/ojb repository_junit.xml
  Removed:     src/test/org/apache/ojb/broker ObjectWithBlob.java
  Log:
  - update BlobTest
  - made test class an inner class of BlobTest
  - remove unused class
  
  Revision  Changes    Path
  1.7       +82 -10    db-ojb/src/test/org/apache/ojb/broker/BlobTest.java
  
  Index: BlobTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/BlobTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BlobTest.java	31 Jan 2003 17:50:05 -0000	1.6
  +++ BlobTest.java	27 Jan 2004 20:45:24 -0000	1.7
  @@ -1,5 +1,7 @@
   package org.apache.ojb.broker;
   
  +import java.io.Serializable;
  +
   import junit.framework.TestCase;
   
   /**
  @@ -42,16 +44,17 @@
       {
           try
           {
  -            broker.clearCache();
  -            broker.close();
  +            if (broker != null)
  +            {
  +                broker.clearCache();
  +                broker.close();
  +            }
           }
           catch (PersistenceBrokerException e)
           {
           }
       }
   
  -
  -    /** Test optimistic Lock by timestamp.*/
       public void testBlobInsertion() throws Exception
       {
           int size = 5000;
  @@ -66,9 +69,9 @@
               carr[i] = 'y';
           }
   
  -        obj.setId(1);
  +        // obj.setId(1); we use autoincrement
           obj.setBlob(barr);
  -        obj.setClob(carr);
  +        obj.setClob(new String(carr));
   
           broker.store(obj);
   
  @@ -78,7 +81,7 @@
           ObjectWithBlob obj1 = (ObjectWithBlob) broker.getObjectByIdentity(oid);
   
           assertEquals(obj.getBlob().length, obj1.getBlob().length);
  -        assertEquals(obj.getClob().length, obj1.getClob().length);
  +        assertEquals(obj.getClob().length(), obj1.getClob().length());
   
       }
   
  @@ -86,7 +89,7 @@
       {
           ObjectWithBlob obj = new ObjectWithBlob();
   
  -        obj.setId(1);
  +        // obj.setId(1); we use autoincrement
           obj.setBlob(null);
           obj.setClob(null);
   
  @@ -97,7 +100,76 @@
           Identity oid = new Identity(obj, broker);
           ObjectWithBlob obj1 = (ObjectWithBlob) broker.getObjectByIdentity(oid);
   
  -        assertEquals(null, obj.getBlob());
  -        assertEquals(null, obj.getClob());
  +        assertEquals(null, obj1.getBlob());
  +        assertEquals(null, obj1.getClob());
  +    }
  +
  +
  +    //*******************************************************
  +    // inner class - test class
  +    //*******************************************************
  +    public static class ObjectWithBlob implements Serializable
  +    {
  +        private int id;
  +
  +        private byte[] blob;
  +
  +        private String clob;
  +
  +
  +        /**
  +         * Gets the blob.
  +         * @return Returns a byte[]
  +         */
  +        public byte[] getBlob()
  +        {
  +            return blob;
  +        }
  +
  +        /**
  +         * Sets the blob.
  +         * @param blob The blob to set
  +         */
  +        public void setBlob(byte[] blob)
  +        {
  +            this.blob = blob;
  +        }
  +
  +        /**
  +         * Gets the clob.
  +         * @return Returns a char[]
  +         */
  +        public String getClob()
  +        {
  +            return clob;
  +        }
  +
  +        /**
  +         * Sets the clob.
  +         * @param clob The clob to set
  +         */
  +        public void setClob(String clob)
  +        {
  +            this.clob = clob;
  +        }
  +
  +        /**
  +         * Gets the id.
  +         * @return Returns a int
  +         */
  +        public int getId()
  +        {
  +            return id;
  +        }
  +
  +        /**
  +         * Sets the id.
  +         * @param id The id to set
  +         */
  +        public void setId(int id)
  +        {
  +            this.id = id;
  +        }
       }
  +
   }
  
  
  
  1.104     +2 -2      db-ojb/src/test/org/apache/ojb/repository_junit.xml
  
  Index: repository_junit.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit.xml,v
  retrieving revision 1.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- repository_junit.xml	20 Dec 2003 20:55:36 -0000	1.103
  +++ repository_junit.xml	27 Jan 2004 20:45:24 -0000	1.104
  @@ -1262,7 +1262,7 @@
   
   <!-- Definitions for org.apache.ojb.broker.ObjectWithBlob -->
      <class-descriptor
  -   	  class="org.apache.ojb.broker.ObjectWithBlob"
  +   	  class="org.apache.ojb.broker.BlobTest$ObjectWithBlob"
      	  table="BLOB_TEST"
      >
         <field-descriptor
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message