db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/broker ConnectionFactoryTest.java FactoryTest.java ProductGroupProxy.java InitializableObject.java OJBPerfTest.java RowReaderTestImpl.java PerformanceJdbcFailoverTest.java ProxyExamples.java BrokerExamples.java ArticleProxy.java TypedCollectionsTest.java PolymorphicExtents.java PerformanceJdbcReferenceTest.java
Date Sun, 14 Nov 2004 09:41:31 GMT
tomdz       2004/11/14 01:41:31

  Modified:    src/test/org/apache/ojb OJB.properties
                        repository_internal.xml
               src/test/org/apache/ojb/broker ConnectionFactoryTest.java
                        FactoryTest.java ProductGroupProxy.java
                        InitializableObject.java OJBPerfTest.java
                        RowReaderTestImpl.java
                        PerformanceJdbcFailoverTest.java ProxyExamples.java
                        BrokerExamples.java ArticleProxy.java
                        TypedCollectionsTest.java PolymorphicExtents.java
                        PerformanceJdbcReferenceTest.java
  Log:
  Reworked the OJB core:
  - replaced the factories/configuration concept with the ComponentContainer
  - removal of most static calls within OJB
  - removed the old "D" collection implementations and renamed the new ones
  - moved StatementForClassIF handling to the PersistenceConfiguration
  - moved RowReader caching from the ClassDescriptor to the PersistenceConfiguration
  and other changes (see mail on the dev list for more details)
  
  Revision  Changes    Path
  1.78      +4 -4      db-ojb/src/test/org/apache/ojb/OJB.properties
  
  Index: OJB.properties
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/OJB.properties,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- OJB.properties	20 Sep 2004 14:30:59 -0000	1.77
  +++ OJB.properties	14 Nov 2004 09:41:31 -0000	1.78
  @@ -273,7 +273,7 @@
   # Important note: the collections class to be used MUST implement the
   # interface org.apache.ojb.broker.ManageableCollection.
   #
  -OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2
  +OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl
   # OqlCollectionClass=org.apache.ojb.broker.util.collections.ManageableArrayList
   # OqlCollectionClass=org.apache.ojb.broker.util.ManageableVector
   #
  @@ -307,11 +307,11 @@
   # (e.g. when do a Implementation#newDlist() call)
   #
   # org.odmg.DList implementation class
  -DListClass=org.apache.ojb.odmg.collections.DListImpl_2
  +DListClass=org.apache.ojb.odmg.collections.DListImpl
   #DListClass=org.apache.ojb.odmg.collections.DListImpl
   #
   # org.odmg.DArray implementation class
  -DArrayClass=org.apache.ojb.odmg.collections.DListImpl_2
  +DArrayClass=org.apache.ojb.odmg.collections.DListImpl
   #DArrayClass=org.apache.ojb.odmg.collections.DListImpl
   #
   # org.odmg.DMap implementation class
  
  
  
  1.17      +10 -60    db-ojb/src/test/org/apache/ojb/repository_internal.xml
  
  Index: repository_internal.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_internal.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- repository_internal.xml	20 Sep 2004 14:32:26 -0000	1.16
  +++ repository_internal.xml	14 Nov 2004 09:41:31 -0000	1.17
  @@ -74,7 +74,7 @@
         />
      </class-descriptor>
   
  -<!-- THIS IS THE OJB DLIST IMPLEMENTATION, DO NOT EDIT-->
  +   <!-- THIS IS THE OJB DLIST IMPLEMENTATION, DO NOT EDIT-->
      <class-descriptor
      	  class="org.apache.ojb.odmg.collections.DListImpl"
      	  table="OJB_DLIST"
  @@ -94,62 +94,6 @@
         <collection-descriptor
            name="elements"
            element-class-ref="org.apache.ojb.odmg.collections.DListEntry"
  -      >
  -         <inverse-foreignkey field-ref="dlistId"/>
  -      </collection-descriptor>
  -   </class-descriptor>
  -
  -<!-- THIS IS THE OJB DLIST ENTRY IMPLEMENTATION, DO NOT EDIT-->
  -   <class-descriptor
  -      class="org.apache.ojb.odmg.collections.DListEntry"
  -      table="OJB_DLIST_ENTRIES"
  -   >
  -      <field-descriptor
  -         name="id"
  -         column="ID"
  -         jdbc-type="INTEGER"
  -         primarykey="true"
  -         autoincrement="true"
  -      />
  -      <field-descriptor
  -         name="dlistId"
  -         column="DLIST_ID"
  -         jdbc-type="INTEGER"
  -      />
  -      <field-descriptor
  -         name="position"
  -         column="POSITION_"
  -         jdbc-type="INTEGER"
  -      />
  -      <field-descriptor
  -         name="oid"
  -         column="OID_"
  -         jdbc-type="LONGVARBINARY"
  -         conversion="org.apache.ojb.broker.accesslayer.conversions.Object2ByteArrFieldConversion"
  -      />
  -   </class-descriptor>
  -
  -   <!-- THIS IS THE OJB DLIST IMPLEMENTATION, DO NOT EDIT-->
  -   <!-- alternative implementation of DList -->
  -   <class-descriptor
  -   	  class="org.apache.ojb.odmg.collections.DListImpl_2"
  -   	  table="OJB_DLIST"
  -   >
  -      <field-descriptor
  -         name="id"
  -         column="ID"
  -         jdbc-type="INTEGER"
  -         primarykey="true"
  -         autoincrement="true"
  -      />
  -      <field-descriptor
  -         name="size"
  -         column="SIZE_"
  -         jdbc-type="INTEGER"
  -      />
  -      <collection-descriptor
  -         name="elements"
  -         element-class-ref="org.apache.ojb.odmg.collections.DListEntry_2"
            auto-retrieve = "true"
         >
            <inverse-foreignkey field-ref="dlistId"/>
  @@ -158,7 +102,7 @@
   
   <!-- THIS IS THE OJB DLIST ENTRY IMPLEMENTATION, DO NOT EDIT-->
      <class-descriptor
  -      class="org.apache.ojb.odmg.collections.DListEntry_2"
  +      class="org.apache.ojb.odmg.collections.DListEntry"
         table="OJB_DLIST_ENTRIES"
      >
         <field-descriptor
  @@ -310,17 +254,23 @@
            jdbc-type="INTEGER"
         />
         <field-descriptor
  -         name="keyOID"
  +         name="keyOid"
            column="KEY_OID"
            jdbc-type="LONGVARBINARY"
            conversion="org.apache.ojb.broker.accesslayer.conversions.Object2ByteArrFieldConversion"
         />
         <field-descriptor
  -         name="valueOID"
  +         name="valueOid"
            column="VALUE_OID"
            jdbc-type="LONGVARBINARY"
            conversion="org.apache.ojb.broker.accesslayer.conversions.Object2ByteArrFieldConversion"
         />
  +      <reference-descriptor
  +         name="dmap"
  +         class-ref="org.apache.ojb.odmg.collections.DMapImpl"
  +      >
  +         <foreignkey field-ref="dmapId"/>
  +      </reference-descriptor>
      </class-descriptor>
   
   
  
  
  
  1.7       +11 -12    db-ojb/src/test/org/apache/ojb/broker/ConnectionFactoryTest.java
  
  Index: ConnectionFactoryTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/ConnectionFactoryTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ConnectionFactoryTest.java	14 Sep 2004 16:46:08 -0000	1.6
  +++ ConnectionFactoryTest.java	14 Nov 2004 09:41:31 -0000	1.7
  @@ -52,14 +52,15 @@
           try
           {
               // release connection factory of current broker
  -            broker.getConfiguration().getOjb().getFactories().getConnectionFactoryFactory().releaseConnectionFactoryFor(jcd);
  +            broker.serviceConnectionManager().releaseConnection();
               // change autoCommit state
               jcd.setUseAutoCommit(2);
               // set connection factory we want to test
               jcd.getConnectionPoolDescriptor().setConnectionFactory(factory);
  +
               // get the connetion factory for used JCD
  -            ConnectionFactory cf = broker.getConfiguration().getOjb().
  -                    getFactories().getConnectionFactoryFactory().getConnectionFactoryFor(jcd);
  +            ConnectionFactory cf = broker.serviceConnectionManager().getConnectionFactory();
  +
               Connection con = cf.lookupConnection();
               Connection con2 = cf.lookupConnection();
               Connection con3 = cf.lookupConnection();
  @@ -70,17 +71,16 @@
   
   
               // release connection factory of current broker
  -            broker.getConfiguration().getOjb().getFactories().getConnectionFactoryFactory().releaseConnectionFactoryFor(jcd);
  +            broker.serviceConnectionManager().releaseConnection();
               jcd.setUseAutoCommit(1);
  -            cf = broker.getConfiguration().getOjb()
  -                    .getFactories().getConnectionFactoryFactory().getConnectionFactoryFor(jcd);
  +            cf  = broker.serviceConnectionManager().getConnectionFactory();
               con = cf.lookupConnection();
               assertTrue("Expect autocommit state true", con.getAutoCommit());
           }
           finally
           {
               // release connection factory of current broker
  -            broker.getConfiguration().getOjb().getFactories().getConnectionFactoryFactory().releaseConnectionFactoryFor(jcd);
  +            broker.serviceConnectionManager().releaseConnection();
               // restore settings
               jcd.setUseAutoCommit(oldAutoCommit);
               jcd.getConnectionPoolDescriptor().setConnectionFactory(oldCF);
  @@ -106,7 +106,7 @@
           try
           {
               // release connection factory of current broker
  -            broker.getConfiguration().getOjb().getFactories().getConnectionFactoryFactory().releaseConnectionFactoryFor(jcd);
  +            broker.serviceConnectionManager().releaseConnection();
               // set connection factory we want to test
               jcd.getConnectionPoolDescriptor().setConnectionFactory(factory);
   
  @@ -120,8 +120,7 @@
               try
               {
                   // get the connetion factory for used JCD
  -                ConnectionFactory cf = broker.getConfiguration().getOjb()
  -                    .getFactories().getConnectionFactoryFactory().getConnectionFactoryFor(jcd);
  +                ConnectionFactory cf = broker.serviceConnectionManager().getConnectionFactory();
                   con = cf.lookupConnection();
                   con2 = cf.lookupConnection();
                   try
  @@ -157,7 +156,7 @@
           finally
           {
               // release connection factory of current broker
  -            broker.getConfiguration().getOjb().getFactories().getConnectionFactoryFactory().releaseConnectionFactoryFor(jcd);
  +            broker.serviceConnectionManager().releaseConnection();
               // restore settings
               jcd.setUseAutoCommit(oldAutoCommit);
               jcd.getConnectionPoolDescriptor().setConnectionFactory(oldCF);
  
  
  
  1.2       +31 -35    db-ojb/src/test/org/apache/ojb/broker/FactoryTest.java
  
  Index: FactoryTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/FactoryTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FactoryTest.java	26 Oct 2004 15:27:41 -0000	1.1
  +++ FactoryTest.java	14 Nov 2004 09:41:31 -0000	1.2
  @@ -1,27 +1,34 @@
   package org.apache.ojb.broker;
   
  +/* Copyright 2002-2004 The Apache Software Foundation
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import java.util.Collection;
  -import java.util.HashMap;
   import java.util.Iterator;
  -import java.util.Map;
   
  -import org.apache.ojb.broker.accesslayer.RowReader;
  -import org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl;
  -import org.apache.ojb.broker.core.factory.ObjectFactory;
  -import org.apache.ojb.broker.core.factory.ObjectFactoryException;
  +import org.apache.ojb.broker.core.factory.ObjectCreator;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByCriteria;
  -import org.apache.ojb.broker.query.QueryByCriteria;
   import org.apache.ojb.junit.PBTestCase;
  -import org.apache.xml.serialize.IndentPrinter;
   
   /**
    * @author leandro
    *
    */
  -public class FactoryTest 
  -	extends PBTestCase
  +public class FactoryTest extends PBTestCase
   {
   
   //	public void testObjectCreation()
  @@ -37,12 +44,13 @@
   //		assertTrue(obj.initCalled);
   //	}
   
  +    
  +
   	public void testDefaultObjectFactory()
   		throws Exception
   	{
  -		PersistenceBroker pb = PersistenceBrokerFactory.defaultPersistenceBroker();
   		Query query = new QueryByCriteria(InitializableObject.class);
  -		Collection coll = pb.getCollectionByQuery(query);
  +		Collection coll = broker.getCollectionByQuery(query);
   		for (Iterator iter = coll.iterator(); iter.hasNext();)
           {
               InitializableObject obj = (InitializableObject) iter.next();
  @@ -53,41 +61,29 @@
   	public void testHandledObjectFactory()
   		throws Exception
   	{
  -		ObjectFactory factory = new TestFactory();
  -		PersistenceBroker pb = PersistenceBrokerFactory.defaultPersistenceBroker(factory);
  +        persistenceConf.getObjectFactory().registerCreator(new TestFactory(), InitializableObject.class.getName());
   		Query query = new QueryByCriteria(InitializableObject.class);
  -		Collection coll = pb.getCollectionByQuery(query);
  +		Collection coll = broker.getCollectionByQuery(query);
   		for (Iterator iter = coll.iterator(); iter.hasNext();)
   		{
   			InitializableObject obj = (InitializableObject) iter.next();
  -			// ** OBS ** : this assertion fails because the ObjectFactory is not handled to the
RowReader instance
  +			// ** OBS ** : this assertion fails because the ObjectCreator is not handled to the
RowReader instance
   			assertFalse(obj.initCalled);
   		}
   	}
   
  +    public void tearDown() throws Exception
  +    {
  +        // to avoid cache hits (which would not create new objects)
  +        persistenceConf.getCacheManager().clearCaches();
  +        super.tearDown();
  +    }
   }
   
  -class TestFactory
  -	implements ObjectFactory
  +class TestFactory implements ObjectCreator
   {
  -
  -    public Object getInstanceOf(Class clazz) 
  -    	throws ObjectFactoryException
  +    public Object newInstance(ClassDescriptor classDesc)
       {
           return new InitializableObject();
       }
  -
  -    public Object getInstanceOf(String className) 
  -    	throws ObjectFactoryException
  -    {
  -		try
  -        {
  -            Class clazz = Class.forName(className);
  -            return getInstanceOf(clazz);
  -        }
  -        catch (ClassNotFoundException e)
  -        {
  -			throw new ObjectFactoryException("Error creating object",e);
  -        }
  -	}
   }	
  
  
  
  1.7       +2 -11     db-ojb/src/test/org/apache/ojb/broker/ProductGroupProxy.java
  
  Index: ProductGroupProxy.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/ProductGroupProxy.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProductGroupProxy.java	12 Jul 2004 16:26:26 -0000	1.6
  +++ ProductGroupProxy.java	14 Nov 2004 09:41:31 -0000	1.7
  @@ -1,9 +1,9 @@
   package org.apache.ojb.broker;
   
   import java.io.Serializable;
  -import java.lang.reflect.InvocationHandler;
   import java.util.List;
   
  +import org.apache.ojb.broker.core.proxy.IndirectionHandler;
   import org.apache.ojb.broker.core.proxy.VirtualProxy;
   
   
  @@ -16,16 +16,7 @@
       {
       }
   
  -    /**
  -     * ProductGroupProxy constructor comment.
  -     * @param uniqueId org.apache.ojb.broker.Identity
  -     */
  -    public ProductGroupProxy(PBKey key, Identity uniqueId)
  -    {
  -        super(key, uniqueId);
  -    }
  -
  -    public ProductGroupProxy(InvocationHandler handler)
  +    public ProductGroupProxy(IndirectionHandler handler)
       {
           super(handler);
       }
  
  
  
  1.2       +3 -8      db-ojb/src/test/org/apache/ojb/broker/InitializableObject.java
  
  Index: InitializableObject.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/InitializableObject.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InitializableObject.java	26 Oct 2004 15:27:41 -0000	1.1
  +++ InitializableObject.java	14 Nov 2004 09:41:31 -0000	1.2
  @@ -1,13 +1,12 @@
   package org.apache.ojb.broker;
   
  -import org.apache.ojb.broker.core.factory.lifecycle.Initializable;
  +import org.apache.ojb.broker.core.factory.Initializable;
   
   /**
    * @author leandro
    *
    */
  -public class InitializableObject
  -	implements Initializable
  +public class InitializableObject implements Initializable
   {
   	public boolean initCalled;
   	
  @@ -18,11 +17,7 @@
   		//System.out.println("ServiceableObject created");
   	}
   
  -    /* (non-Javadoc)
  -     * @see org.apache.ojb.broker.core.factory.lifecycle.Initializable#initialize()
  -     */
  -    public void initialize() 
  -    	throws Exception
  +    public void initialize()
       {
   		initCalled = true;
       }
  
  
  
  1.14      +2 -2      db-ojb/src/test/org/apache/ojb/broker/OJBPerfTest.java
  
  Index: OJBPerfTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/OJBPerfTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- OJBPerfTest.java	14 Sep 2004 16:46:08 -0000	1.13
  +++ OJBPerfTest.java	14 Nov 2004 09:41:31 -0000	1.14
  @@ -104,7 +104,7 @@
               {
                   PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
                   JdbcConnectionDescriptor jcd = broker.getConfiguration().getJdbcConnectionDescriptor();
  -                conFac = broker.getConfiguration().getOjb().getFactories().getConnectionFactoryFactory().getConnectionFactoryFor(jcd);
  +                conFac = broker.serviceConnectionManager().getConnectionFactory();
                   broker.close();
               }
               return conFac.lookupConnection();
  
  
  
  1.4       +3 -2      db-ojb/src/test/org/apache/ojb/broker/RowReaderTestImpl.java
  
  Index: RowReaderTestImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/RowReaderTestImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RowReaderTestImpl.java	24 Dec 2002 14:06:45 -0000	1.3
  +++ RowReaderTestImpl.java	14 Nov 2004 09:41:31 -0000	1.4
  @@ -11,13 +11,14 @@
   import java.util.Map;
   
   import org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl;
  +import org.apache.ojb.broker.core.factory.ObjectFactory;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   
   public class RowReaderTestImpl extends RowReaderDefaultImpl
   {
  -    public RowReaderTestImpl(ClassDescriptor cld)
  +    public RowReaderTestImpl(ObjectFactory factory, ClassDescriptor cld)
       {
  -        super(cld);
  +        super(factory, cld);
       }
   
       /**
  
  
  
  1.6       +1 -2      db-ojb/src/test/org/apache/ojb/broker/PerformanceJdbcFailoverTest.java
  
  Index: PerformanceJdbcFailoverTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PerformanceJdbcFailoverTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PerformanceJdbcFailoverTest.java	11 Aug 2004 00:39:45 -0000	1.5
  +++ PerformanceJdbcFailoverTest.java	14 Nov 2004 09:41:31 -0000	1.6
  @@ -155,8 +155,7 @@
               try
               {
                   // get the connetion factory for used JCD
  -                ConnectionFactory cf = broker.getConfiguration().getOjb()
  -                        .getFactories().getConnectionFactoryFactory().getConnectionFactoryFor(jcd);
  +                ConnectionFactory cf = broker.serviceConnectionManager().getConnectionFactory();
                   conn = cf.lookupConnection();
                   System.out.println("] Waited for connection " + (System.currentTimeMillis()
- startToWait) + "msecs");
                   break;
  
  
  
  1.19      +3 -6      db-ojb/src/test/org/apache/ojb/broker/ProxyExamples.java
  
  Index: ProxyExamples.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/ProxyExamples.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ProxyExamples.java	14 Sep 2004 16:46:08 -0000	1.18
  +++ ProxyExamples.java	14 Nov 2004 09:41:31 -0000	1.19
  @@ -6,7 +6,6 @@
   import java.util.Vector;
   
   import org.apache.ojb.broker.core.proxy.ProxyHelper;
  -import org.apache.ojb.broker.core.proxy.VirtualProxy;
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryFactory;
  @@ -74,7 +73,7 @@
               Object[] pkvals = new Object[1];
               pkvals[0] = new Integer(i);
               Identity id = new Identity(Article.class, InterfaceArticle.class, pkvals);
  -            InterfaceArticle A = (InterfaceArticle) VirtualProxy.createProxy(broker.getPBKey(),
ArticleProxy.class, id);
  +            InterfaceArticle A = (InterfaceArticle)broker.createProxy(ArticleProxy.class,
id);
               myArticles.add(A);
   //System.out.println(A);
           }
  @@ -105,7 +104,7 @@
           InterfaceProductGroup group2 = null;
           try
           {
  -            group2 = (InterfaceProductGroup) VirtualProxy.createProxy(broker.getPBKey(),
ProductGroupProxy.class, id);
  +            group2 = (InterfaceProductGroup)broker.createProxy(ProductGroupProxy.class,
id);
           }
           catch (Exception ignored)
           {
  @@ -162,9 +161,7 @@
               Object[] pkvals = new Object[1];
               pkvals[0] = new Integer(i);
               Identity id = new Identity(Article.class, InterfaceArticle.class, pkvals);
  -            InterfaceArticle A =
  -                    (InterfaceArticle) VirtualProxy.createProxy(broker.getPBKey(),
  -                            getDynamicProxyClass(Article.class), id);
  +            InterfaceArticle A = (InterfaceArticle)broker.createProxy(getDynamicProxyClass(Article.class),
id);
               myArticles.add(A);
   //System.out.println(A);
           }
  
  
  
  1.20      +26 -82    db-ojb/src/test/org/apache/ojb/broker/BrokerExamples.java
  
  Index: BrokerExamples.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/BrokerExamples.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- BrokerExamples.java	31 May 2004 22:57:21 -0000	1.19
  +++ BrokerExamples.java	14 Nov 2004 09:41:31 -0000	1.20
  @@ -1,11 +1,9 @@
   package org.apache.ojb.broker;
   
  -import org.apache.ojb.broker.core.PersistenceBrokerConfiguration;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
   import org.apache.ojb.broker.query.QueryByIdentity;
   import org.apache.ojb.broker.query.QueryFactory;
  -import org.apache.ojb.broker.util.configuration.ConfigurationException;
   import org.apache.ojb.junit.PBTestCase;
   
   /**
  @@ -43,7 +41,8 @@
           ProductGroup tmpPG = new ProductGroup();
           tmpPG.setId(1);
           Identity pgID = new Identity(tmpPG, broker);
  -        ProductGroupProxy pgProxy = new ProductGroupProxy(broker.getPBKey(), pgID);
  +        ProductGroupProxy pgProxy = new ProductGroupProxy(ojb.getProxyFactory().createIndirectionHandler(broker.getPBKey(),
pgID));
  +
           a.setProductGroup(pgProxy);
           return a;
       }
  @@ -146,57 +145,32 @@
        */
       public void testShallowAndDeepRetrieval() throws Exception
       {
  -        // this test only makes sense in singlevm mode !
  -        PersistenceBrokerConfiguration config = null;
  -        try
  -        {
  -            config =
  -                    (PersistenceBrokerConfiguration) PersistenceBrokerFactory
  -                    .getConfigurator()
  -                    .getConfigurationFor(
  -                            null);
  -        }
  -        catch (ConfigurationException e)
  -        {
  -            fail(e.getMessage());
  -        }
  +        // ensure there is an item to find
  +        Article tmpArticle = createArticle(testId);
  +        Identity tmpOID = new Identity(tmpArticle, broker);
  +        broker.beginTransaction();
  +        broker.store(tmpArticle);
  +        broker.commitTransaction();
  +        broker.clearCache();
   
  -            try
  -            {
  -                // ensure there is an item to find
  -                Article tmpArticle = createArticle(testId);
  -                Identity tmpOID = new Identity(tmpArticle, broker);
  -                broker.beginTransaction();
  -                broker.store(tmpArticle);
  -                broker.commitTransaction();
  -                broker.clearCache();
  -
  -                // switch to shallow retrieval
  -                ClassDescriptor cld = broker.getClassDescriptor(Article.class);
  -                ObjectReferenceDescriptor ord =
  -                        (ObjectReferenceDescriptor) cld.getObjectReferenceDescriptors().get(0);
  -                ord.setCascadeRetrieve(false);
  -                // should work without setting cld
  -                // broker.setClassDescriptor(cld);
  -
  -                Article article = (Article) broker.getObjectByIdentity(tmpOID);
  -                assertNull("now reference should be null", article.getProductGroup());
  -
  -                // now switch to deep retrieval
  -                ord.setCascadeRetrieve(true);
  -                // should work without setting cld
  -                // broker.setClassDescriptor(cld);
  -                broker.clearCache();
  -                article = (Article) broker.getObjectByIdentity(tmpOID);
  -                assertNotNull("now reference should NOT be null", article.getProductGroup());
  -
  -            }
  -            catch (Exception e)
  -            {
  -                e.printStackTrace();
  -                throw e;
  -            }
  +        // switch to shallow retrieval
  +        ClassDescriptor cld = broker.getClassDescriptor(Article.class);
  +        ObjectReferenceDescriptor ord =
  +                (ObjectReferenceDescriptor) cld.getObjectReferenceDescriptors().get(0);
  +        ord.setCascadeRetrieve(false);
  +        // should work without setting cld
  +        // broker.setClassDescriptor(cld);
   
  +        Article article = (Article) broker.getObjectByIdentity(tmpOID);
  +        assertNull("now reference should be null", article.getProductGroup());
  +
  +        // now switch to deep retrieval
  +        ord.setCascadeRetrieve(true);
  +        // should work without setting cld
  +        // broker.setClassDescriptor(cld);
  +        broker.clearCache();
  +        article = (Article) broker.getObjectByIdentity(tmpOID);
  +        assertNotNull("now reference should NOT be null", article.getProductGroup());
       }
   
   
  @@ -205,21 +179,6 @@
        */
       public void testRetrieveReference() throws Exception
       {
  -        // this test only makes sense in singlevm mode !
  -        PersistenceBrokerConfiguration config = null;
  -        try
  -        {
  -            config =
  -                    (PersistenceBrokerConfiguration) PersistenceBrokerFactory
  -                    .getConfigurator()
  -                    .getConfigurationFor(
  -                            null);
  -        }
  -        catch (ConfigurationException e)
  -        {
  -            fail(e.getMessage());
  -        }
  -
           // ensure there is an item to find
           Article tmpArticle = createArticle(testId);
           Identity tmpOID = new Identity(tmpArticle, broker);
  @@ -256,21 +215,6 @@
        */
       public void testRetrieveAllReferences()
       {
  -        // this test only makes sense in singlevm mode !
  -        PersistenceBrokerConfiguration config = null;
  -        try
  -        {
  -            config =
  -                    (PersistenceBrokerConfiguration) PersistenceBrokerFactory
  -                    .getConfigurator()
  -                    .getConfigurationFor(
  -                            null);
  -        }
  -        catch (ConfigurationException e)
  -        {
  -            fail(e.getMessage());
  -        }
  -
           // ensure there is an item to find
           Article tmpArticle = createArticle(testId);
           Identity tmpOID = new Identity(tmpArticle, broker);
  
  
  
  1.6       +3 -21     db-ojb/src/test/org/apache/ojb/broker/ArticleProxy.java
  
  Index: ArticleProxy.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/ArticleProxy.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ArticleProxy.java	9 Apr 2004 13:22:29 -0000	1.5
  +++ ArticleProxy.java	14 Nov 2004 09:41:31 -0000	1.6
  @@ -1,16 +1,7 @@
   package org.apache.ojb.broker;
   
  -
  -
  -//#ifdef JDK13
  -import java.lang.reflect.InvocationHandler;
  -
  -import org.apache.ojb.broker.core.proxy.*;
  -//#else
  -/*
  -import com.develop.java.lang.reflect.InvocationHandler;
  -*/
  -//#endif
  +import org.apache.ojb.broker.core.proxy.IndirectionHandler;
  +import org.apache.ojb.broker.core.proxy.VirtualProxy;
   
   /**
    * Proxy class to class Article. Implements interface InterfaceArticle.
  @@ -31,16 +22,7 @@
       {
       }
   
  -    /**
  -     * ArticleProxy constructor comment.
  -     * @param uniqueId org.apache.ojb.broker.Identity
  -     */
  -    public ArticleProxy(PBKey key, Identity uniqueId)
  -    {
  -        super(key, uniqueId);
  -    }
  -
  -    public ArticleProxy(InvocationHandler handler)
  +    public ArticleProxy(IndirectionHandler handler)
       {
           super(handler);
       }
  
  
  
  1.11      +1 -1      db-ojb/src/test/org/apache/ojb/broker/TypedCollectionsTest.java
  
  Index: TypedCollectionsTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/TypedCollectionsTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TypedCollectionsTest.java	14 Sep 2004 16:46:08 -0000	1.10
  +++ TypedCollectionsTest.java	14 Nov 2004 09:41:31 -0000	1.11
  @@ -34,7 +34,7 @@
   		ProductGroup tmpPG = new ProductGroup();
   		tmpPG.setId(1);
   		Identity pgID = new Identity(tmpPG, broker);
  -		ProductGroupProxy pgProxy = new ProductGroupProxy(broker.getPBKey(), pgID);
  +		ProductGroupProxy pgProxy = (ProductGroupProxy)broker.createProxy(ProductGroupProxy.class,
pgID);
   		a.setProductGroup(pgProxy);
   		return a;
   	}
  
  
  
  1.17      +1 -1      db-ojb/src/test/org/apache/ojb/broker/PolymorphicExtents.java
  
  Index: PolymorphicExtents.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PolymorphicExtents.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- PolymorphicExtents.java	14 Sep 2004 16:46:08 -0000	1.16
  +++ PolymorphicExtents.java	14 Nov 2004 09:41:31 -0000	1.17
  @@ -39,7 +39,7 @@
   		ProductGroup tmpPG = new ProductGroup();
   		tmpPG.setId(1);
   		Identity pgID = new Identity(tmpPG, broker);
  -		ProductGroupProxy pgProxy = new ProductGroupProxy(broker.getPBKey(),pgID);
  +		ProductGroupProxy pgProxy = new ProductGroupProxy(ojb.getProxyFactory().createIndirectionHandler(broker.getPBKey(),pgID));
   		a.setProductGroup(pgProxy);
   		return a;
   	}
  
  
  
  1.16      +2 -3      db-ojb/src/test/org/apache/ojb/broker/PerformanceJdbcReferenceTest.java
  
  Index: PerformanceJdbcReferenceTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PerformanceJdbcReferenceTest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PerformanceJdbcReferenceTest.java	14 Sep 2004 16:46:08 -0000	1.15
  +++ PerformanceJdbcReferenceTest.java	14 Nov 2004 09:41:31 -0000	1.16
  @@ -123,9 +123,8 @@
           if (cf == null)
           {
               JdbcConnectionDescriptor jcd = broker.getConfiguration().getJdbcConnectionDescriptor();
  -            // get the connetion factory for used JCD
  -            cf = broker.getConfiguration().getOjb()
  -                    .getFactories().getConnectionFactoryFactory().getConnectionFactoryFor(jcd);
  +            // get the connection factory for used JCD
  +            cf = broker.serviceConnectionManager().getConnectionFactory();
           }
           return cf.lookupConnection();
       }
  
  
  

---------------------------------------------------------------------
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