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/cache ObjectCacheTest.java
Date Sun, 14 Nov 2004 09:41:56 GMT
tomdz       2004/11/14 01:41:56

  Modified:    src/test/org/apache/ojb/broker/core/configuration
                        PicoComponentContainerTest.java
                        ComponentContainerTestBase.java
                        SpringComponentContainerTest.java
               src/test/org/apache/ojb/broker/metadata
                        RepositoryPersistorTest.java
                        PersistentFieldTest.java
                        RuntimeConfigurationTest.java
               src/test/org/apache/ojb/broker/metadata/torque
                        TorqueTablePreprocessorTest.java
                        TorqueRepositoryGeneratorTest.java
                        TorqueTableGeneratorTest.java
                        TorqueForeignKeyGeneratorTest.java
               src/test/org/apache/ojb/broker/cache ObjectCacheTest.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.2       +5 -0      db-ojb/src/test/org/apache/ojb/broker/core/configuration/PicoComponentContainerTest.java
  
  Index: PicoComponentContainerTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/core/configuration/PicoComponentContainerTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PicoComponentContainerTest.java	27 Oct 2004 20:47:25 -0000	1.1
  +++ PicoComponentContainerTest.java	14 Nov 2004 09:41:56 -0000	1.2
  @@ -29,6 +29,11 @@
           junit.textui.TestRunner.main(arr);
       }
   
  +    public PicoComponentContainerTest()
  +    {
  +        super(true);
  +    }
  +
       protected void setUp() throws Exception
       {
           super.setUp();
  
  
  
  1.3       +119 -9    db-ojb/src/test/org/apache/ojb/broker/core/configuration/ComponentContainerTestBase.java
  
  Index: ComponentContainerTestBase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/core/configuration/ComponentContainerTestBase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ComponentContainerTestBase.java	5 Nov 2004 19:43:22 -0000	1.2
  +++ ComponentContainerTestBase.java	14 Nov 2004 09:41:56 -0000	1.3
  @@ -25,6 +25,12 @@
   public abstract class ComponentContainerTestBase extends TestCase
   {
       protected ComponentContainer _container;
  +    private   boolean            _testCyclicDependencies = true;
  +
  +    public ComponentContainerTestBase(boolean testCyclicDependencies)
  +    {
  +        _testCyclicDependencies = testCyclicDependencies;
  +    }
   
       protected void tearDown() throws Exception
       {
  @@ -151,16 +157,27 @@
   
       public void testCreation9()
       {
  +        if (!_testCyclicDependencies)
  +        {
  +            return;
  +        }
           ComponentContainer subContainer = _container.createChildContainer();
   
           _container.setImplementationClass(A.class, AImpl.class);
           _container.setImplementationClass(C.class, CImpl.class);
           subContainer.setImplementationClass(A.class, HImpl.class);
   
  -        Object obj = subContainer.getInstance(A.class);
  +        assertEquals(AImpl.class, _container.getImplementationClass(A.class));
  +        assertEquals(HImpl.class, subContainer.getImplementationClass(A.class));
   
  -        assertTrue(obj instanceof HImpl);
  -        assertTrue(((HImpl)obj).getSub() instanceof CImpl);
  +        // we have a cyclic dependency here
  +        try
  +        {
  +            subContainer.getInstance(A.class);
  +            fail();
  +        }
  +        catch (ObjectCreationException ex)
  +        {}
       }
   
       public void testCreation10()
  @@ -216,7 +233,8 @@
   
           A obj2 = (A)subContainer.getInstance(A.class);
   
  -        // singleton only registered at parent factory
  +        // a singleton is registered at parent factory but the sub container
  +        // has its own implementation class registered without a singleton
           assertFalse(obj1 == obj2);
       }
   
  @@ -285,16 +303,108 @@
       public void testCreation19()
       {
           _container.setImplementationClass(A.class, AImpl.class, true);
  -        _container.setImplementationClass(C.class, CImpl.class);
   
  -        C obj1 = (C)_container.getInstance(C.class);
  +        A obj1 = (A)_container.getInstance(A.class);
           A obj2 = (A)_container.getInstance(A.class);
   
  -        assertTrue(obj1 instanceof CImpl);
  +        assertTrue(obj1 instanceof AImpl);
           assertTrue(obj2 instanceof AImpl);
  +        assertTrue(obj1 == obj2);
  +        
  +        _container.setImplementationClass(E3.class, BImpl.class);
  +        _container.setImplementationClass(A.class, FImpl.class, false);
   
  -        // this time the same objects because we're creating singletons for A
  -        assertTrue(((CImpl)obj1).getSub() == obj2);
  +        A obj3 = (A)_container.getInstance(A.class);
  +        A obj4 = (A)_container.getInstance(A.class);
  +
  +        assertTrue(obj3 instanceof FImpl);
  +        assertTrue(obj4 instanceof FImpl);
  +        assertTrue(obj3 != obj4);
  +    }
  +
  +    public void testCreation20()
  +    {
  +        ComponentContainer subContainer = _container.createChildContainer();
  +
  +        _container.setImplementationClass(A.class, AImpl.class);
  +
  +        A obj1 = (A)_container.getInstance(A.class);
  +
  +        _container.setSingletonInstance(A.class, obj1);
  +
  +        A obj2 = (A)subContainer.getInstance(A.class);
  +
  +        // a singleton is registered at parent factory and the sub container
  +        // does not override it
  +        assertTrue(obj1 == obj2);
  +    }
  +
  +    public void testCreation21()
  +    {
  +        BImpl obj1 = new BImpl();
  +        
  +        _container.setSingletonInstance(E3.class, obj1);
  +
  +        ComponentContainer subContainer = _container.createChildContainer();
  +
  +        subContainer.setImplementationClass(A.class, FImpl.class);
  +
  +        ComponentContainer subSubContainer = subContainer.createChildContainer();
  +
  +        A obj2 = (A)subSubContainer.getInstance(A.class);
  +
  +        assertTrue(obj2 instanceof FImpl);
  +        assertTrue(((FImpl)obj2).getSub() == obj1);
  +    }
  +
  +    public void testCreation22()
  +    {
  +        _container.setImplementationClass(A.class, FImpl.class);
  +
  +        ComponentContainer subContainer = _container.createChildContainer();
  +
  +        subContainer.setImplementationClass(E3.class, BImpl.class);
  +
  +        ComponentContainer subSubContainer = subContainer.createChildContainer();
  +
  +        try
  +        {
  +            _container.getInstance(A.class);
  +            fail();
  +        }
  +        catch (ObjectCreationException ex)
  +        {}
  +
  +        A obj2 = (A)subSubContainer.getInstance(A.class);
  +
  +        assertTrue(obj2 instanceof FImpl);
  +        assertTrue(((FImpl)obj2).getSub() instanceof BImpl);
  +    }
  +
  +    public void testCreation23()
  +    {
  +        BImpl obj1 = new BImpl();
  +        
  +        _container.setImplementationClass(A.class, FImpl.class);
  +
  +        ComponentContainer subContainer = _container.createChildContainer();
  +
  +        subContainer.setSingletonInstance(E3.class, obj1);
  +
  +        ComponentContainer subSubContainer = subContainer.createChildContainer();
  +
  +        try
  +        {
  +            _container.getInstance(A.class);
  +            fail();
  +        }
  +        catch (ObjectCreationException ex)
  +        {}
  +
  +        A obj2 = (A)subSubContainer.getInstance(A.class);
  +
  +        assertTrue(obj2 instanceof FImpl);
  +        assertTrue(((FImpl)obj2).getSub() == obj1);
       }
   
       public void testConfiguration1()
  
  
  
  1.2       +6 -0      db-ojb/src/test/org/apache/ojb/broker/core/configuration/SpringComponentContainerTest.java
  
  Index: SpringComponentContainerTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/core/configuration/SpringComponentContainerTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SpringComponentContainerTest.java	27 Oct 2004 20:47:25 -0000	1.1
  +++ SpringComponentContainerTest.java	14 Nov 2004 09:41:56 -0000	1.2
  @@ -29,6 +29,12 @@
           junit.textui.TestRunner.main(arr);
       }
   
  +    public SpringComponentContainerTest()
  +    {
  +        // Spring is (currently) unable to resolve cyclic dependencies in autowire mode
  +        super(false);
  +    }
  +    
       protected void setUp() throws Exception
       {
           super.setUp();
  
  
  
  1.15      +2 -2      db-ojb/src/test/org/apache/ojb/broker/metadata/RepositoryPersistorTest.java
  
  Index: RepositoryPersistorTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/RepositoryPersistorTest.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RepositoryPersistorTest.java	14 Sep 2004 16:43:48 -0000	1.14
  +++ RepositoryPersistorTest.java	14 Nov 2004 09:41:56 -0000	1.15
  @@ -38,7 +38,7 @@
               numClasses++;
           }
   
  -        RepositoryPersistor persistor = new RepositoryPersistor();
  +        RepositoryPersistor persistor = ojb.getMetadataManager().getRepositoryPersistor();
           FileOutputStream fos = new FileOutputStream(filename);
           persistor.writeToFile(repository, conRepository, fos);
   
  @@ -64,7 +64,7 @@
           int connectionCount = conRepository.getAllDescriptor().size();
   
           FileOutputStream fos = new FileOutputStream(filename);
  -        RepositoryPersistor persistor = new RepositoryPersistor();
  +        RepositoryPersistor persistor = ojb.getMetadataManager().getRepositoryPersistor();
           persistor.writeToFile(repository, conRepository, fos);
   
           ConnectionRepository second = persistor.readConnectionRepository(filename);
  
  
  
  1.9       +17 -35    db-ojb/src/test/org/apache/ojb/broker/metadata/PersistentFieldTest.java
  
  Index: PersistentFieldTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/PersistentFieldTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PersistentFieldTest.java	27 Jun 2004 23:49:35 -0000	1.8
  +++ PersistentFieldTest.java	14 Nov 2004 09:41:56 -0000	1.9
  @@ -1,5 +1,20 @@
   package org.apache.ojb.broker.metadata;
   
  +/* 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 org.apache.commons.beanutils.BasicDynaClass;
  @@ -21,25 +36,8 @@
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPrivilegedImpl;
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPrivilegedImplNew;
   import org.apache.ojb.broker.util.ClassHelper;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfiguration;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
   import org.apache.ojb.junit.OJBTestCase;
   
  -/* 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.
  - */
  -
   /**
    * Test to check the capability of the {@link org.apache.ojb.broker.metadata.fieldaccess.PersistentField}
    * implementations.
  @@ -49,8 +47,6 @@
    */
   public class PersistentFieldTest extends OJBTestCase
   {
  -    private Class oldPFClass;
  -
       Class[] persistentFieldClasses = new Class[]{
           PersistentFieldDirectAccessImpl.class
           , PersistentFieldDirectAccessImplNew.class
  @@ -69,23 +65,9 @@
           junit.textui.TestRunner.main(arr);
       }
   
  -    protected void setUp() throws Exception
  -    {
  -        super.setUp();
  -        oldPFClass = ((OjbConfiguration) OjbConfigurator.getInstance()
  -                .getConfigurationFor(null)).getPersistentFieldClass();
  -    }
  -
  -    protected void tearDown() throws Exception
  -    {
  -        super.tearDown();
  -        ((OjbConfiguration) OjbConfigurator.getInstance()
  -                .getConfigurationFor(null)).setPersistentFieldClass(oldPFClass);
  -    }
  -
       private void runFieldTestsFor(Class targetClass, boolean supportJavaBeanNames) throws
Exception
       {
  -        ((OjbConfiguration) OjbConfigurator.getInstance().getConfigurationFor(null)).setPersistentFieldClass(targetClass);
  +        ojb.setProperty(PersistentField.class.getName()+".class", targetClass.getName(),
true);
   
           PersistentField pfNM_Name = newInstance(targetClass, NestedMain.class, NESTED_MAIN_NAME);
           PersistentField pfNDD_RD = newInstance(targetClass, NestedMain.class, NESTED_DETAIL_DETAIL_REAL_DETAIL);
  
  
  
  1.7       +2 -3      db-ojb/src/test/org/apache/ojb/broker/metadata/RuntimeConfigurationTest.java
  
  Index: RuntimeConfigurationTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/RuntimeConfigurationTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RuntimeConfigurationTest.java	14 Sep 2004 16:43:48 -0000	1.6
  +++ RuntimeConfigurationTest.java	14 Nov 2004 09:41:56 -0000	1.7
  @@ -4,7 +4,6 @@
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.ObjectRepository;
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
  -import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory;
   import org.apache.ojb.junit.OJBTestCase;
   
   /**
  @@ -50,7 +49,7 @@
           ClassDescriptor cld = new ClassDescriptor(dr);
           cld.setClassOfObject(ObjectRepository.A.class);
           FieldDescriptor fd = new FieldDescriptor(cld, 1);
  -        PersistentField pf = PersistentFieldFactory.createPersistentField(ObjectRepository.A.class,
"someAField");
  +        PersistentField pf = ojb.getMetadataManager().getFieldFactory().createPersistentField(ObjectRepository.A.class,
"someAField");
           fd.setPersistentField(pf);
           cld.addFieldDescriptor(fd);
   
  
  
  
  1.5       +1 -1      db-ojb/src/test/org/apache/ojb/broker/metadata/torque/TorqueTablePreprocessorTest.java
  
  Index: TorqueTablePreprocessorTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/torque/TorqueTablePreprocessorTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TorqueTablePreprocessorTest.java	11 Aug 2004 00:39:43 -0000	1.4
  +++ TorqueTablePreprocessorTest.java	14 Nov 2004 09:41:56 -0000	1.5
  @@ -23,7 +23,7 @@
   
       public void setUp() throws Exception {
           super.setUp();
  -        RepositoryPersistor repositoryPersistor = new RepositoryPersistor();
  +        RepositoryPersistor repositoryPersistor = ojb.getMetadataManager().getRepositoryPersistor();
           DescriptorRepository descriptorRepository = repositoryPersistor.readDescriptorRepository(EXAMPLE_FILE);
           this.torqueTablePreprocessor = new TorqueTablePreprocessor(descriptorRepository);
       }
  
  
  
  1.5       +1 -1      db-ojb/src/test/org/apache/ojb/broker/metadata/torque/TorqueRepositoryGeneratorTest.java
  
  Index: TorqueRepositoryGeneratorTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/torque/TorqueRepositoryGeneratorTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TorqueRepositoryGeneratorTest.java	14 Sep 2004 16:43:48 -0000	1.4
  +++ TorqueRepositoryGeneratorTest.java	14 Nov 2004 09:41:56 -0000	1.5
  @@ -25,7 +25,7 @@
   
       public void setUp() throws Exception {
           super.setUp();
  -        RepositoryPersistor repositoryPersistor = new RepositoryPersistor();
  +        RepositoryPersistor repositoryPersistor = ojb.getMetadataManager().getRepositoryPersistor();
           this.repository = repositoryPersistor.readDescriptorRepository(INPUT_FILE);
           this.torqueRepositoryGenerator = new TorqueRepositoryGenerator(INPUT_FILE, false);
       }
  
  
  
  1.6       +1 -1      db-ojb/src/test/org/apache/ojb/broker/metadata/torque/TorqueTableGeneratorTest.java
  
  Index: TorqueTableGeneratorTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/torque/TorqueTableGeneratorTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TorqueTableGeneratorTest.java	14 Sep 2004 16:43:48 -0000	1.5
  +++ TorqueTableGeneratorTest.java	14 Nov 2004 09:41:56 -0000	1.6
  @@ -49,7 +49,7 @@
   
       public void setUp() throws Exception {
           super.setUp();
  -        RepositoryPersistor repositoryPersistor = new RepositoryPersistor();
  +        RepositoryPersistor repositoryPersistor = ojb.getMetadataManager().getRepositoryPersistor();
           this.repository = repositoryPersistor.readDescriptorRepository(EXAMPLE_FILE);
           this.torqueTableGenerator = new TorqueTableGenerator(this.repository, false);
       }
  
  
  
  1.4       +1 -1      db-ojb/src/test/org/apache/ojb/broker/metadata/torque/TorqueForeignKeyGeneratorTest.java
  
  Index: TorqueForeignKeyGeneratorTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/torque/TorqueForeignKeyGeneratorTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TorqueForeignKeyGeneratorTest.java	11 Aug 2004 00:39:43 -0000	1.3
  +++ TorqueForeignKeyGeneratorTest.java	14 Nov 2004 09:41:56 -0000	1.4
  @@ -49,7 +49,7 @@
       public void setUp() throws Exception
       {
           super.setUp();
  -        RepositoryPersistor repositoryPersistor = new RepositoryPersistor();
  +        RepositoryPersistor repositoryPersistor = ojb.getMetadataManager().getRepositoryPersistor();
           DescriptorRepository descriptorRepository = repositoryPersistor.readDescriptorRepository(EXAMPLE_FILE);
           this.foreignKeyGenerator = new TorqueForeignKeyGenerator(descriptorRepository);
       }
  
  
  
  1.4       +49 -55    db-ojb/src/test/org/apache/ojb/broker/cache/ObjectCacheTest.java
  
  Index: ObjectCacheTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/cache/ObjectCacheTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ObjectCacheTest.java	14 Sep 2004 16:43:48 -0000	1.3
  +++ ObjectCacheTest.java	14 Nov 2004 09:41:56 -0000	1.4
  @@ -16,8 +16,6 @@
   import org.apache.ojb.broker.metadata.ObjectCacheDescriptor;
   import org.apache.ojb.broker.query.QueryByIdentity;
   import org.apache.ojb.broker.sequence.Repository;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfiguration;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
   import org.apache.ojb.junit.PBTestCase;
   
   /**
  @@ -66,11 +64,6 @@
           super.tearDown();
       }
   
  -    private OjbConfiguration getConfig()
  -    {
  -        return (OjbConfiguration) OjbConfigurator.getInstance().getConfigurationFor(null);
  -    }
  -
       private PersistenceBrokerImpl getRealBroker()
       {
           return getRealBroker(broker);
  @@ -346,54 +339,55 @@
       }
   
       /**
  -         * This test check the CacheFilter feature and the two standard implementations
  -         * enable per class and per package out-filtering of objects.
  -         * @throws Exception
  -         */
  -        public void testCacheFilterFunctions() throws Exception
  -        {
  -            if(ojbSkipKnownIssueProblem("TODO: needs implementation or remove feature"))
return;
  -            
  -            getConfig().setCacheFilters(cacheFilter);
  -            ojb.getMetadataManager().getRepository().
  -                    addAttribute(CacheFilterPackageImpl.EXCLUDE_PACKAGES, EXCLUDE_PACKAGE);
  -            ojb.getMetadataManager().connectionRepository().getDescriptor(TestHelper.DEF_KEY).
  -                    addAttribute(CacheFilterPackageImpl.EXCLUDE_PACKAGES, EXCLUDE_PACKAGE_NOT_EXIST);
  -
  -            ObjectCache cache = broker.serviceObjectCache();
  -            CacheObject obj = new CacheObject(null, "CacheObject persistent obj");
  -            Identity oid = new Identity(obj, broker);
  -
  -            CacheObject filterOutObject = new CacheFilterObject(null, "CacheFilterObject
persistent obj");
  -            Identity filterOutOid = new Identity(filterOutObject, broker);
  +     * This test check the CacheFilter feature and the two standard implementations
  +     * enable per class and per package out-filtering of objects.
  +     * @throws Exception
  +     */
  +    public void testCacheFilterFunctions() throws Exception
  +    {
  +        if(ojbSkipKnownIssueProblem("TODO: needs implementation or remove feature")) return;
  +        
  +        // TODO: The cache filter is currently not used within ojb
  +        // getConfig().setCacheFilters(cacheFilter);
  +        ojb.getMetadataManager().getRepository().
  +                addAttribute(CacheFilterPackageImpl.EXCLUDE_PACKAGES, EXCLUDE_PACKAGE);
  +        ojb.getMetadataManager().connectionRepository().getDescriptor(TestHelper.DEF_KEY).
  +                addAttribute(CacheFilterPackageImpl.EXCLUDE_PACKAGES, EXCLUDE_PACKAGE_NOT_EXIST);
  +
  +        ObjectCache cache = broker.serviceObjectCache();
  +        CacheObject obj = new CacheObject(null, "CacheObject persistent obj");
  +        Identity oid = new Identity(obj, broker);
  +
  +        CacheObject filterOutObject = new CacheFilterObject(null, "CacheFilterObject persistent
obj");
  +        Identity filterOutOid = new Identity(filterOutObject, broker);
  +
  +        Repository.SMKey filterOutPackageObject = new Repository.SMKey();
  +        filterOutPackageObject.setName("ObjectCacheTest: package filter");
  +        Identity filterOutPackageOid = new Identity(filterOutPackageObject, broker);
   
  -            Repository.SMKey filterOutPackageObject = new Repository.SMKey();
  -            filterOutPackageObject.setName("ObjectCacheTest: package filter");
  -            Identity filterOutPackageOid = new Identity(filterOutPackageObject, broker);
  -
  -            Object result = null;
  -            cache.clear();
  -            result = cache.lookup(oid);
  -            assertNull(result);
  -            result = cache.lookup(filterOutOid);
  -            assertNull(result);
  -            result = cache.lookup(filterOutPackageOid);
  -            assertNull(result);
  -
  -            // cache it
  -            cache.cache(oid, obj);
  -            cache.cache(filterOutPackageOid, filterOutPackageObject);
  -            cache.cache(filterOutOid, filterOutObject);
  -
  -            // lookup things
  -            result = cache.lookup(oid);
  -            assertNotNull(result);
  -            assertEquals(obj, result);
  -            result = cache.lookup(filterOutOid);
  -            assertNull(result);
  -            result = cache.lookup(filterOutPackageOid);
  -            assertNull(result);
  -        }
  +        Object result = null;
  +        cache.clear();
  +        result = cache.lookup(oid);
  +        assertNull(result);
  +        result = cache.lookup(filterOutOid);
  +        assertNull(result);
  +        result = cache.lookup(filterOutPackageOid);
  +        assertNull(result);
  +
  +        // cache it
  +        cache.cache(oid, obj);
  +        cache.cache(filterOutPackageOid, filterOutPackageObject);
  +        cache.cache(filterOutOid, filterOutObject);
  +
  +        // lookup things
  +        result = cache.lookup(oid);
  +        assertNotNull(result);
  +        assertEquals(obj, result);
  +        result = cache.lookup(filterOutOid);
  +        assertNull(result);
  +        result = cache.lookup(filterOutPackageOid);
  +        assertNull(result);
  +    }
       
   
       /**
  
  
  

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