You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2002/03/10 19:58:35 UTC

cvs commit: jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore TestPersistentClassType.java TestSample.java storage.xml

baliuka     02/03/10 10:58:35

  Modified:    simplestore/src/test/org/apache/commons/simplestore
                        TestPersistentClassType.java TestSample.java
                        storage.xml
  Log:
  Added validation
  
  Revision  Changes    Path
  1.3       +8 -1      jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestPersistentClassType.java
  
  Index: TestPersistentClassType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestPersistentClassType.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestPersistentClassType.java	10 Mar 2002 12:32:31 -0000	1.2
  +++ TestPersistentClassType.java	10 Mar 2002 18:58:35 -0000	1.3
  @@ -57,7 +57,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestPersistentClassType.java,v 1.2 2002/03/10 12:32:31 baliuka Exp $
  + *@version    $Id: TestPersistentClassType.java,v 1.3 2002/03/10 18:58:35 baliuka Exp $
    */
   public abstract class TestPersistentClassType implements TestPersistent,
    org.apache.commons.simplestore.tools.Constants{
  @@ -72,6 +72,13 @@
         System.out.println(getStrVal());
      }
      } 
  +  
  +  public void setNuls(){
  +    setDateVal( null ) ;
  +    setStrVal1( null ); 
  +    setStrVal ( null ); 
  +    setParent ( null ); 
  +  }
     
      public abstract TestPersistentClassType getParent(); 
     
  
  
  
  1.11      +10 -1     jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestSample.java
  
  Index: TestSample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestSample.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestSample.java	10 Mar 2002 12:32:31 -0000	1.10
  +++ TestSample.java	10 Mar 2002 18:58:35 -0000	1.11
  @@ -60,6 +60,7 @@
   import org.apache.commons.simplestore.persistence.impl.PersistenceManager;
   import org.apache.commons.simplestore.persistence.impl.ContextImpl;
   import org.apache.commons.simplestore.persistence.impl.MetaClassImpl;
  +import org.apache.commons.simplestore.persistence.ValidationException;
   import org.apache.commons.simplestore.cache.impl.SoftRefMemoryCache;
   
   import java.util.HashMap;
  @@ -72,7 +73,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestSample.java,v 1.10 2002/03/10 12:32:31 baliuka Exp $
  + *@version    $Id: TestSample.java,v 1.11 2002/03/10 18:58:35 baliuka Exp $
    */
   public class TestSample extends TestCase implements org.apache.commons.simplestore.tools.Constants{
       
  @@ -108,6 +109,14 @@
               
               transaction.begin();
               TestPersistentClassType object3 = (TestPersistentClassType) pm.createInstance(TestPersistentClassType.class);
  +             try{
  +                 
  +              object3.setNuls();
  +              fail("ValidationException expected");
  +              
  +             }catch(ValidationException ve){
  +             
  +             }
               object3.setDateVal(new java.util.Date());
               object3.setIntVal(i);
               object3.setFloatVal(i / 2);
  
  
  
  1.3       +6 -1      jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/storage.xml
  
  Index: storage.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/storage.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- storage.xml	9 Mar 2002 19:07:49 -0000	1.2
  +++ storage.xml	10 Mar 2002 18:58:35 -0000	1.3
  @@ -5,9 +5,14 @@
   <storage>
       <mclass id="org.apache.commons.simplestore.TestPersistentClassType" name="TEST_PERSISTENT" oid="ID">
           <field id="strVal1" name="s_1_str_val"/>
  -        <field id="parent" name="parent_object"/>
  +        <field id="parent" name="parent_object">
           <reference mclass="org.apache.commons.simplestore.TestPersistentClassType" 
                      field="parent"/>
  +        </field>           
  +        <field id="dateVal" name="date_Val">
  +         <validator id="org.apache.commons.simplestore.persistence.impl.NotNull"/>
  +        </field>
  +        
       </mclass>
   </storage>
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>