baliuka     02/03/20 09:49:49

  Modified:    simplestore build.xml
               simplestore/src/test/org/apache/commons/simplestore
                        TestSample.java
  Log:
   fixed setup for persistence manager
  
  Revision  Changes    Path
  1.20      +41 -1     jakarta-commons-sandbox/simplestore/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/build.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- build.xml 11 Mar 2002 09:53:07 -0000      1.19
  +++ build.xml 20 Mar 2002 17:49:49 -0000      1.20
  @@ -2,7 +2,7 @@
   
   <!--
           "simplestore" component of the Jakarta Commons Subproject
  -        $Id: build.xml,v 1.19 2002/03/11 09:53:07 baliuka Exp $
  +        $Id: build.xml,v 1.20 2002/03/20 17:49:49 baliuka Exp $
   -->
   
   <!-- ========== Executable Targets ======================================== -->
  @@ -126,6 +126,46 @@
      <classpath refid="compile.classpath"/>
      </javac>
     </target>
  +
  +<target name="create-test-table">
  +<sql
  +    driver="org.hsqldb.jdbcDriver"
  +    url="jdbc:hsqldb:sample"
  +    userid="sa"
  +    password=""
  +    onerror="continue"
  +  
  +   >
  +      <classpath>
  +          <fileset dir="./lib">
  +             <include name="*.*"/>
  +          </fileset>
  +   </classpath>
  +  CREATE TABLE TEST_PERSISTENT ( ID bigint not null primary key, parent_object 
bigint,Bool_Val smallint,
  +          Int_Val integer, Float_Val float, Date_Val date, Str_Val longVarChar, 
s_1_str_val  longVarChar ) ;
  +        
  + </sql>
  +</target>
  +
  +<target name="drop-test-table">
  +<sql
  +    driver="org.hsqldb.jdbcDriver"
  +    url="jdbc:hsqldb:sample"
  +    userid="sa"
  +    password=""
  +    onerror="continue"
  +
  +   >
  +      <classpath>
  +          <fileset dir="./lib">
  +             <include name="*.*"/>
  +          </fileset>
  +   </classpath>
  +  DROP TABLE TEST_PERSISTENT;
  +        
  + </sql>
  +</target>
  +
     
     <target name="test" depends="build-test" description="runs (junit) unit tests">
       <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}" 
  
  
  
  1.17      +13 -6     
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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TestSample.java   17 Mar 2002 17:35:48 -0000      1.16
  +++ TestSample.java   20 Mar 2002 17:49:49 -0000      1.17
  @@ -56,9 +56,9 @@
   
   import org.apache.commons.simplestore.jdbc.DriverDataSource;
   import org.apache.commons.simplestore.persistence.Transaction;
  -import org.apache.commons.simplestore.persistence.impl.DBStorage;
  -import org.apache.commons.simplestore.persistence.impl.PersistenceManagerImpl;
   import org.apache.commons.simplestore.persistence.PersistenceManager;
  +import org.apache.commons.simplestore.persistence.impl.DBStorage;
  +import org.apache.commons.simplestore.persistence.impl.DBPersistenceManagerFactory;
   import org.apache.commons.simplestore.persistence.impl.ContextImpl;
   import org.apache.commons.simplestore.persistence.impl.MetaClassImpl;
   import org.apache.commons.simplestore.persistence.impl.ConnectionFactory;
  @@ -76,7 +76,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:[EMAIL PROTECTED]";>
    *      [EMAIL PROTECTED]</a>
  - *@version    $Id: TestSample.java,v 1.16 2002/03/17 17:35:48 baliuka Exp $
  + *@version    $Id: TestSample.java,v 1.17 2002/03/20 17:49:49 baliuka Exp $
    */
   public class TestSample extends TestCase implements 
org.apache.commons.simplestore.tools.Constants{
       
  @@ -225,9 +225,15 @@
       
       protected void setUp() throws java.lang.Exception {
           super.setUp();
  -        if( pm != null )
  -            return;
  -        
  +        DBPersistenceManagerFactory factory = new DBPersistenceManagerFactory();
  +        factory.setDriver("org.hsqldb.jdbcDriver");
  +        factory.setUrl("jdbc:hsqldb:sample");
  +        factory.setUser("sa");
  +        factory.setPassword("");
  +        factory.setMaxConnections(1);
  +        factory.setMetaResource("org/apache/commons/simplestore/storage.xml");
  +        pm = factory.getPersistenceManager();
  +        /*
           MetaClassImpl.parse("org/apache/commons/simplestore/storage.xml");
           
          final DriverDataSource ds = new DriverDataSource();
  @@ -263,6 +269,7 @@
                 SoftRefMemoryCache.getInstance(new java.util.HashMap(),0xFF),
                           storage );
           pm = PersistenceManagerImpl.getPersistenceManager(context);
  +         */
       }
       
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to