You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2004/06/04 18:02:44 UTC

cvs commit: db-ojb/src/test/org/apache/ojb repository_junit_cache.xml cache.ccf repository.xml repository_junit_meta_seq.xml

arminw      2004/06/04 09:02:44

  Modified:    src/schema ojbtest-schema.xml
               src/test/org/apache/ojb/broker AllTests.java
               src/test/org/apache/ojb cache.ccf repository.xml
                        repository_junit_meta_seq.xml
  Added:       src/java/org/apache/ojb/broker/cache CacheEntry.java
               src/java/org/apache/ojb/broker
                        PersistenceBrokerInternal.java
               src/test/org/apache/ojb repository_junit_cache.xml
  Removed:     src/test/org/apache/ojb/broker ObjectCacheTest.java
  Log:
  - separate cache tests in own package
  - add first version of a circular relationship cache test
  
  Revision  Changes    Path
  1.1                  db-ojb/src/java/org/apache/ojb/broker/cache/CacheEntry.java
  
  Index: CacheEntry.java
  ===================================================================
  package org.apache.ojb.broker.cache;
  
  import java.io.Serializable;
  
  /* 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.
   */
  
  /**
   * Encapsulates buffered objects.
   *
   * @author <a href="mailto:arminw@apache.org">Armin Waibel</a>
   * @version $Id: CacheEntry.java,v 1.1 2004/06/04 16:02:44 arminw Exp $
   */
  public interface CacheEntry extends Serializable
  {
      /**
       * Returns the class object of the cached object. This is independend from
       * the {@link org.apache.ojb.broker.Identity#getObjectsRealClass()} and
       * {@link org.apache.ojb.broker.Identity#getObjectsTopLevelClass()} setting in
       * {@link org.apache.ojb.broker.Identity}, because real class setting in class Identity
       * could be <em>null</em> or an interface or abstract class if no more information was
       * available when Identity was created.
       */
      Class getObjectInstanceClass();
  
      /**
       * Returns the lifetime of the cached object.
       */
      long getLifetime();
  
      /**
       * Returns the cached object or <em>null</em> if no longer available.
       */
      Object getObject();
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/broker/PersistenceBrokerInternal.java
  
  Index: PersistenceBrokerInternal.java
  ===================================================================
  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.
   */
  
  /**
   * Internal used extended version of {@link PersistenceBroker}
   *
   * @author <a href="mailto:arminw@apache.org">Armin Waibel</a>
   * @version $Id: PersistenceBrokerInternal.java,v 1.1 2004/06/04 16:02:44 arminw Exp $
   */
  public interface PersistenceBrokerInternal extends PersistenceBroker
  {
      
  }
  
  
  
  1.77      +13 -1     db-ojb/src/schema/ojbtest-schema.xml
  
  Index: ojbtest-schema.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/schema/ojbtest-schema.xml,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- ojbtest-schema.xml	3 May 2004 16:13:39 -0000	1.76
  +++ ojbtest-schema.xml	4 Jun 2004 16:02:44 -0000	1.77
  @@ -731,11 +731,23 @@
   
   
       <!-- =================================================== -->
  -    <!-- ObjectCache tests                                   -->
  +    <!-- ObjectCacheTest                                     -->
       <!-- =================================================== -->
       <table name="CACHE_TEST">
           <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
           <column name="NAME" type="VARCHAR" size="100"/>
  +    </table>
  +
  +    <!-- =================================================== -->
  +    <!-- LocalCacheTest                                      -->
  +    <!-- =================================================== -->
  +    <table name="LOCAL_CACHE_TEST">
  +        <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="NAME" type="VARCHAR" size="100"/>
  +        <column name="FK_FATHER" type="INTEGER"/>
  +        <column name="FK_GRANDFATHER" type="INTEGER"/>
  +        <column name="FK_CHILD" type="INTEGER"/>
  +        <column name="FK_GRANDCHILD" type="INTEGER"/>
       </table>
   
   
  
  
  
  1.46      +9 -6      db-ojb/src/test/org/apache/ojb/broker/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/AllTests.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- AllTests.java	24 Apr 2004 08:25:38 -0000	1.45
  +++ AllTests.java	4 Jun 2004 16:02:44 -0000	1.46
  @@ -2,17 +2,19 @@
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  +import org.apache.ojb.broker.cache.LocalCacheTest;
  +import org.apache.ojb.broker.cache.ObjectCacheTest;
   import org.apache.ojb.broker.metadata.CustomAttributesTest;
  -import org.apache.ojb.broker.metadata.MetadataTest;
  -import org.apache.ojb.broker.metadata.RepositoryPersistorTest;
  -import org.apache.ojb.broker.metadata.RepositoryElementsTest;
   import org.apache.ojb.broker.metadata.MetadataMultithreadedTest;
  +import org.apache.ojb.broker.metadata.MetadataTest;
   import org.apache.ojb.broker.metadata.ReadonlyTest;
   import org.apache.ojb.broker.metadata.ReferenceMapTest;
  -import org.apache.ojb.broker.sequence.SequenceManagerTest;
  +import org.apache.ojb.broker.metadata.RepositoryElementsTest;
  +import org.apache.ojb.broker.metadata.RepositoryPersistorTest;
  +import org.apache.ojb.broker.sequence.AutoIncrementTest;
   import org.apache.ojb.broker.sequence.NativeIdentifierTest;
   import org.apache.ojb.broker.sequence.SMMultiThreadedTest;
  -import org.apache.ojb.broker.sequence.AutoIncrementTest;
  +import org.apache.ojb.broker.sequence.SequenceManagerTest;
   
   /**
    * the facade to all TestCases in this package.
  @@ -62,7 +64,7 @@
           suite.addTestSuite(SMMultiThreadedTest.class);
           suite.addTestSuite(KeyConstraintViolationTest.class);
           suite.addTestSuite(RsIteratorTest.class);
  -        suite.addTestSuite(BlobTest.class); /* doesn't work for hsqldb */
  +        suite.addTestSuite(BlobTest.class);
           suite.addTestSuite(LogServiceTest.class);
           suite.addTestSuite(MetaDataSerializationTest.class);
           suite.addTestSuite(MetadataTest.class);
  @@ -72,6 +74,7 @@
           suite.addTestSuite(FieldConversionTest_3.class);
           suite.addTestSuite(BatchModeTest.class);
           suite.addTestSuite(ObjectCacheTest.class);
  +        suite.addTestSuite(LocalCacheTest.class);
           suite.addTestSuite(ReferenceTest.class);
           suite.addTestSuite(ComplexReferenceTest.class);
           suite.addTestSuite(ExtentAwarePathExpressionsTest.class);
  
  
  
  1.3       +5 -5      db-ojb/src/test/org/apache/ojb/cache.ccf
  
  Index: cache.ccf
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/cache.ccf,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- cache.ccf	20 Sep 2003 14:20:06 -0000	1.2
  +++ cache.ccf	4 Jun 2004 16:02:44 -0000	1.3
  @@ -17,8 +17,8 @@
   jcs.region.ojbDefault.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
   
   # region used by test case
  -jcs.region.org.apache.ojb.broker.ObjectCacheTest$CacheObject=
  -jcs.region.org.apache.ojb.broker.ObjectCacheTest$CacheObject.cacheattributes.MaxObjects=3
  -jcs.region.org.apache.ojb.broker.ObjectCacheTest$CacheObject.cacheattributes.MaxMemoryIdleTimeSeconds=2
  -jcs.region.org.apache.ojb.broker.ObjectCacheTest$CacheObject.cacheattributes.UseMemoryShrinker=true
  -jcs.region.org.apache.ojb.broker.ObjectCacheTest$CacheObject.cacheattributes.ShrinkerIntervalSeconds=1
  +jcs.region.org.apache.ojb.broker.cache.ObjectCacheTest$CacheObject=
  +jcs.region.org.apache.ojb.broker.cache.ObjectCacheTest$CacheObject.cacheattributes.MaxObjects=3
  +jcs.region.org.apache.ojb.broker.cache.ObjectCacheTest$CacheObject.cacheattributes.MaxMemoryIdleTimeSeconds=2
  +jcs.region.org.apache.ojb.broker.cache.ObjectCacheTest$CacheObject.cacheattributes.UseMemoryShrinker=true
  +jcs.region.org.apache.ojb.broker.cache.ObjectCacheTest$CacheObject.cacheattributes.ShrinkerIntervalSeconds=1
  
  
  
  1.24      +2 -0      db-ojb/src/test/org/apache/ojb/repository.xml
  
  Index: repository.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository.xml,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- repository.xml	24 Apr 2004 08:25:38 -0000	1.23
  +++ repository.xml	4 Jun 2004 16:02:44 -0000	1.24
  @@ -45,6 +45,7 @@
   <!ENTITY junit_otm SYSTEM "repository_junit_otm.xml">
   <!ENTITY junit_ref SYSTEM "repository_junit_reference.xml">
   <!ENTITY junit_meta_seq SYSTEM "repository_junit_meta_seq.xml">
  +<!ENTITY junit_cache SYSTEM "repository_junit_cache.xml">
   <!ENTITY junit_model SYSTEM "repository_junit_model.xml">
   <!ENTITY junit_cloneable SYSTEM "repository_junit_cloneable.xml">
   <!ENTITY junit_pathClass SYSTEM "repository_junit_pathClass.xml">
  @@ -76,6 +77,7 @@
       &junit_otm;
       &junit_ref;
       &junit_meta_seq;
  +    &junit_cache;
       &junit_model;
       &junit_cloneable;
       &junit_pathClass;
  
  
  
  1.7       +1 -92     db-ojb/src/test/org/apache/ojb/repository_junit_meta_seq.xml
  
  Index: repository_junit_meta_seq.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit_meta_seq.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- repository_junit_meta_seq.xml	11 May 2004 11:55:57 -0000	1.6
  +++ repository_junit_meta_seq.xml	4 Jun 2004 16:02:44 -0000	1.7
  @@ -737,97 +737,6 @@
   
   
   <!-- ************************************************* -->
  -<!--      ObjectCache test descriptors                 -->
  -<!-- ************************************************* -->
  -    <class-descriptor
  -        class="org.apache.ojb.broker.ObjectCacheTest$CacheObject"
  -        table="CACHE_TEST">
  -
  -        <field-descriptor
  -         name="objId"
  -         column="OBJ_ID"
  -         jdbc-type="INTEGER"
  -         primarykey="true"
  -         autoincrement="true"
  -        />
  -        <field-descriptor
  -         name="name"
  -         column="NAME"
  -         jdbc-type="VARCHAR"
  -        />
  -    </class-descriptor>
  -
  -    <class-descriptor
  -        class="org.apache.ojb.broker.ObjectCacheTest$CacheFilterObject"
  -        table="CACHE_TEST">
  -
  -        <field-descriptor
  -         name="objId"
  -         column="OBJ_ID"
  -         jdbc-type="INTEGER"
  -         primarykey="true"
  -         autoincrement="true"
  -        />
  -        <field-descriptor
  -         name="name"
  -         column="NAME"
  -         jdbc-type="VARCHAR"
  -        />
  -
  -        <!-- when cache filtering is enabled this class was not cached -->
  -        <attribute
  -            attribute-name="cacheable"
  -            attribute-value="false"/>
  -
  -    </class-descriptor>
  -
  -
  -    <class-descriptor
  -        class="org.apache.ojb.broker.ObjectCacheTest$TestObjectEmptyCache"
  -        table="CACHE_TEST">
  -        <!-- declare a per class cache -->
  -        <object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl">
  -            <attribute attribute-name="test-attribute" attribute-value="test-value"/>
  -        </object-cache>
  -
  -        <field-descriptor
  -         name="id"
  -         column="OBJ_ID"
  -         jdbc-type="INTEGER"
  -         primarykey="true"
  -         autoincrement="true"
  -        />
  -        <field-descriptor
  -         name="name"
  -         column="NAME"
  -         jdbc-type="VARCHAR"
  -        />
  -    </class-descriptor>
  -
  -    <class-descriptor
  -        class="org.apache.ojb.broker.ObjectCacheTest$TestObjectDefaultCache"
  -        table="CACHE_TEST">
  -        <!-- declare a per class cache -->
  -        <object-cache class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
  -            <attribute attribute-name="timeout" attribute-value="1"/>
  -        </object-cache>
  -
  -        <field-descriptor
  -         name="id"
  -         column="OBJ_ID"
  -         jdbc-type="INTEGER"
  -         primarykey="true"
  -         autoincrement="true"
  -        />
  -        <field-descriptor
  -         name="name"
  -         column="NAME"
  -         jdbc-type="VARCHAR"
  -        />
  -    </class-descriptor>
  -
  -
  -<!-- ************************************************* -->
   <!--      autoincrement test                           -->
   <!-- ************************************************* -->
   <class-descriptor
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/repository_junit_cache.xml
  
  Index: repository_junit_cache.xml
  ===================================================================
  <!-- Mapping of classes used in junit tests -->
  <!-- @version $Id: repository_junit_cache.xml,v 1.1 2004/06/04 16:02:44 arminw Exp $ -->
  <!--
  #/* Copyright 2003-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.
   */
  -->
  
  <!-- ************************************************* -->
  <!--      LocalCacheTest descriptors                  -->
  <!-- ************************************************* -->
  
  <class-descriptor
      class="org.apache.ojb.broker.cache.LocalCacheTest$Person"
      table="LOCAL_CACHE_TEST"
  >
      <!-- declare a per class cache -->
      <object-cache class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
          <attribute attribute-name="timeout" attribute-value="10"/>
      </object-cache>
  
      <field-descriptor
          name="id"
          column="OBJ_ID"
          jdbc-type="INTEGER"
          primarykey="true"
          autoincrement="true"
      />
      <field-descriptor
          name="name"
          column="NAME"
          jdbc-type="VARCHAR"
      />
      <field-descriptor
          name="fkChild"
          column="FK_CHILD"
          jdbc-type="INTEGER"
      />
      <field-descriptor
          name="fkGrandchild"
          column="FK_GRANDCHILD"
          jdbc-type="INTEGER"
      />
      <field-descriptor
          name="fkFather"
          column="FK_FATHER"
          jdbc-type="INTEGER"
          access="anonymous"
      />
      <field-descriptor
          name="fkGrandfather"
          column="FK_GRANDFATHER"
          jdbc-type="INTEGER"
          access="anonymous"
      />
      <reference-descriptor
          name="father"
          class-ref="org.apache.ojb.broker.cache.LocalCacheTest$Person"
          proxy="false"
          auto-retrieve="true"
          auto-update="false"
          auto-delete="false">
              <foreignkey field-ref="fkFather"/>
      </reference-descriptor>
      <reference-descriptor
          name="grandfather"
          class-ref="org.apache.ojb.broker.cache.LocalCacheTest$Person"
          proxy="false"
          auto-retrieve="true"
          auto-update="false"
          auto-delete="false">
              <foreignkey field-ref="fkGrandfather"/>
      </reference-descriptor>
      <collection-descriptor
          name="childs"
          element-class-ref="org.apache.ojb.broker.cache.LocalCacheTest$Person"
          proxy="false"
          auto-retrieve="true"
          auto-update="false"
          auto-delete="false"
      >
          <inverse-foreignkey field-ref="fkChild"/>
      </collection-descriptor>
      <collection-descriptor
          name="grandchilds"
          element-class-ref="org.apache.ojb.broker.cache.LocalCacheTest$Person"
          proxy="false"
          auto-retrieve="true"
          auto-update="false"
          auto-delete="false"
      >
          <inverse-foreignkey field-ref="fkGrandchild"/>
      </collection-descriptor>
  </class-descriptor>
  
  <!-- ************************************************* -->
  <!--      ObjectCacheTest descriptors                  -->
  <!-- ************************************************* -->
      <class-descriptor
          class="org.apache.ojb.broker.cache.ObjectCacheTest$CacheObject"
          table="CACHE_TEST">
  
          <field-descriptor
           name="objId"
           column="OBJ_ID"
           jdbc-type="INTEGER"
           primarykey="true"
           autoincrement="true"
          />
          <field-descriptor
           name="name"
           column="NAME"
           jdbc-type="VARCHAR"
          />
      </class-descriptor>
  
      <class-descriptor
          class="org.apache.ojb.broker.cache.ObjectCacheTest$CacheFilterObject"
          table="CACHE_TEST">
  
          <field-descriptor
           name="objId"
           column="OBJ_ID"
           jdbc-type="INTEGER"
           primarykey="true"
           autoincrement="true"
          />
          <field-descriptor
           name="name"
           column="NAME"
           jdbc-type="VARCHAR"
          />
  
          <!-- when cache filtering is enabled this class was not cached -->
          <attribute
              attribute-name="cacheable"
              attribute-value="false"/>
  
      </class-descriptor>
  
  
      <class-descriptor
          class="org.apache.ojb.broker.cache.ObjectCacheTest$TestObjectEmptyCache"
          table="CACHE_TEST">
          <!-- declare a per class cache -->
          <object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl">
              <attribute attribute-name="test-attribute" attribute-value="test-value"/>
          </object-cache>
  
          <field-descriptor
           name="id"
           column="OBJ_ID"
           jdbc-type="INTEGER"
           primarykey="true"
           autoincrement="true"
          />
          <field-descriptor
           name="name"
           column="NAME"
           jdbc-type="VARCHAR"
          />
      </class-descriptor>
  
      <class-descriptor
          class="org.apache.ojb.broker.cache.ObjectCacheTest$TestObjectDefaultCache"
          table="CACHE_TEST">
          <!-- declare a per class cache -->
          <object-cache class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
              <attribute attribute-name="timeout" attribute-value="1"/>
          </object-cache>
  
          <field-descriptor
           name="id"
           column="OBJ_ID"
           jdbc-type="INTEGER"
           primarykey="true"
           autoincrement="true"
          />
          <field-descriptor
           name="name"
           column="NAME"
           jdbc-type="VARCHAR"
          />
      </class-descriptor>
  
  
  <!-- Mapping of classes used in junit tests and tutorials ends here -->
  
  
  

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