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/29 19:20:05 UTC

cvs commit: db-ojb/src/test/org/apache/ojb repository_database.xml Test_ConnectionDescriptor.xml

arminw      2004/06/29 10:20:04

  Modified:    src/test/org/apache/ojb/broker MultipleDBTest.java
                        TestHelper.java
               src/test/org/apache/ojb/odmg MultiDBUsageTest.java
               src/test/org/apache/ojb repository_database.xml
                        Test_ConnectionDescriptor.xml
  Log:
  move test configuration from
  repository_database.xml to Test_ConnectionDescriptor
  
  Revision  Changes    Path
  1.16      +14 -1     db-ojb/src/test/org/apache/ojb/broker/MultipleDBTest.java
  
  Index: MultipleDBTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/MultipleDBTest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- MultipleDBTest.java	19 Feb 2004 01:39:40 -0000	1.15
  +++ MultipleDBTest.java	29 Jun 2004 17:20:04 -0000	1.16
  @@ -4,6 +4,9 @@
   import junit.framework.TestCase;
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.QueryByCriteria;
  +import org.apache.ojb.broker.metadata.MetadataManager;
  +import org.apache.ojb.broker.metadata.ConnectionRepository;
  +import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.lang.builder.ToStringStyle;
   
  @@ -26,11 +29,21 @@
   
       protected void setUp() throws Exception
       {
  -
  +        super.setUp();
  +        MetadataManager mm = MetadataManager.getInstance();
  +        JdbcConnectionDescriptor jcd = mm.connectionRepository().getDescriptor(TestHelper.FAR_AWAY_KEY);
  +        if(jcd == null)
  +        {
  +            ConnectionRepository cr = mm.readConnectionRepository(TestHelper.FAR_AWAY_CONNECTION_REPOSITORY);
  +            mm.connectionRepository().addDescriptor(cr.getDescriptor(TestHelper.FAR_AWAY_KEY));
  +        }
       }
   
       protected void tearDown() throws Exception
       {
  +        MetadataManager mm = MetadataManager.getInstance();
  +        JdbcConnectionDescriptor jcd = mm.connectionRepository().getDescriptor(TestHelper.FAR_AWAY_KEY);
  +        mm.connectionRepository().removeDescriptor(jcd);
           super.tearDown();
       }
   
  
  
  
  1.4       +2 -1      db-ojb/src/test/org/apache/ojb/broker/TestHelper.java
  
  Index: TestHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/TestHelper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestHelper.java	12 Jan 2003 14:33:03 -0000	1.3
  +++ TestHelper.java	29 Jun 2004 17:20:04 -0000	1.4
  @@ -22,6 +22,7 @@
       public static final PBKey DEF_KEY = new PBKey(DEF_JCD_ALIAS, DEF_USER, DEF_PASSWORD);
   
   
  +    public static final String FAR_AWAY_CONNECTION_REPOSITORY = "Test_ConnectionDescriptor.xml";
       public static final String FAR_AWAY_JCD_ALIAS = "farAway";
       public static final String FAR_AWAY_DATABASE_NAME = "farAway#sa#";
       public static final PBKey FAR_AWAY_KEY = new PBKey(FAR_AWAY_JCD_ALIAS, "sa", "");
  
  
  
  1.9       +16 -2     db-ojb/src/test/org/apache/ojb/odmg/MultiDBUsageTest.java
  
  Index: MultiDBUsageTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/MultiDBUsageTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MultiDBUsageTest.java	22 Jun 2004 18:16:22 -0000	1.8
  +++ MultiDBUsageTest.java	29 Jun 2004 17:20:04 -0000	1.9
  @@ -6,6 +6,9 @@
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.TestHelper;
  +import org.apache.ojb.broker.metadata.MetadataManager;
  +import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
  +import org.apache.ojb.broker.metadata.ConnectionRepository;
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByCriteria;
  @@ -47,6 +50,14 @@
       {
           super.setUp();
   
  +        MetadataManager mm = MetadataManager.getInstance();
  +        JdbcConnectionDescriptor jcd = mm.connectionRepository().getDescriptor(TestHelper.FAR_AWAY_KEY);
  +        if(jcd == null)
  +        {
  +            ConnectionRepository cr = mm.readConnectionRepository(TestHelper.FAR_AWAY_CONNECTION_REPOSITORY);
  +            mm.connectionRepository().addDescriptor(cr.getDescriptor(TestHelper.FAR_AWAY_KEY));
  +        }
  +
           odmg_1 = OJB.getInstance();
           db_1 = odmg_1.newDatabase();
           db_1.open(TestHelper.DEF_DATABASE_NAME, Database.OPEN_READ_WRITE);
  @@ -58,7 +69,9 @@
   
       protected void tearDown() throws Exception
       {
  -        super.tearDown();
  +        MetadataManager mm = MetadataManager.getInstance();
  +        JdbcConnectionDescriptor jcd = mm.connectionRepository().getDescriptor(TestHelper.FAR_AWAY_KEY);
  +        mm.connectionRepository().removeDescriptor(jcd);
           try
           {
               if(odmg_1.currentTransaction() != null)
  @@ -86,12 +99,13 @@
           {
               // ignore
           }
  +        super.tearDown();
       }
   
       /**
        * Test store / delete objects to different db
        */
  -    public void testStore() throws Exception
  +    public void XXXtestStore() throws Exception
       {
           // little hack for the test. use PB and ODMG api to verify results
           int odmgZoosBefore = getDBObjectCountWithNewPB(((DatabaseImpl) db_1).getPBKey(), ODMGZoo.class);
  
  
  
  1.23      +1 -90     db-ojb/src/test/org/apache/ojb/repository_database.xml
  
  Index: repository_database.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_database.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- repository_database.xml	24 Jun 2004 10:02:46 -0000	1.22
  +++ repository_database.xml	29 Jun 2004 17:20:04 -0000	1.23
  @@ -86,92 +86,3 @@
   
      </jdbc-connection-descriptor -->
   
  -
  -
  -    <!--
  -        NOTE: This is a test descriptor used within
  -        the junit test suite, do not change any value.
  -        A test db connections used for junit tests.
  -        This connection match a hsql database called 'OJB_FarAway'
  -        If you do not use the test suite, you could delete
  -        this descriptor.
  -        This descriptor was used to check multiple database
  -        use.
  -    -->
  -    <jdbc-connection-descriptor
  -        jcd-alias="farAway"
  -        platform="Hsqldb"
  -        jdbc-level="2.0"
  -        driver="org.hsqldb.jdbcDriver"
  -        protocol="jdbc"
  -        subprotocol="hsqldb"
  -        dbalias="../OJB_FarAway"
  -        username="sa"
  -        password=""
  -        batch-mode="false"
  -    >
  -
  -        <connection-pool
  -            maxActive="6"
  -            whenExhaustedAction="0"
  -            validationQuery="select count(*) from OJB_HL_SEQ"
  -        />
  -
  -        <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
  -            <attribute attribute-name="grabSize" attribute-value="5"/>
  -        </sequence-manager>
  -    </jdbc-connection-descriptor>
  -
  -    <!--
  -        NOTE: This is a test descriptor used within
  -        the junit test suite, do not change any value.
  -        If you do not use the test suite, you could
  -        delete this descriptor.
  -        In the the test directory under
  -        org.apache.ojb.broker.metadata.MetadataTest#testReadConnectionDescriptor
  -        this descriptor will be evaluated.
  -    -->
  -    <jdbc-connection-descriptor
  -        jcd-alias="testConnection"
  -        default-connection="false"
  -        platform="Oracle"
  -        jdbc-level="1.0"
  -        driver="a driver"
  -        protocol="a protocol"
  -        subprotocol="a subprotocol"
  -        dbalias="myDbalias"
  -        username="a user"
  -        password="a password"
  -        eager-release="true"
  -        batch-mode="true"
  -        useAutoCommit="0"
  -        ignoreAutoCommitExceptions="true"
  -    >
  -
  -        <object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl">
  -            <attribute attribute-name="cacheKey1" attribute-value="cacheValue1"/>
  -            <attribute attribute-name="cacheKey2" attribute-value="cacheValue2"/>
  -        </object-cache>
  -
  -        <connection-pool
  -            maxActive="1"
  -            maxIdle="2"
  -            maxWait="3"
  -            minEvictableIdleTimeMillis="4"
  -            numTestsPerEvictionRun="5"
  -            testOnBorrow="true"
  -            testOnReturn="true"
  -            testWhileIdle="true"
  -            timeBetweenEvictionRunsMillis="6"
  -            whenExhaustedAction="2"
  -            validationQuery="a query"
  -            logAbandoned="true"
  -            removeAbandoned="true"
  -            removeAbandonedTimeout="8"
  -        />
  -
  -        <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
  -            <attribute attribute-name="key1" attribute-value="value1"/>
  -            <attribute attribute-name="key2" attribute-value="value2"/>
  -        </sequence-manager>
  -    </jdbc-connection-descriptor>
  
  
  
  1.6       +88 -0     db-ojb/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml
  
  Index: Test_ConnectionDescriptor.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Test_ConnectionDescriptor.xml	5 Apr 2004 13:58:59 -0000	1.5
  +++ Test_ConnectionDescriptor.xml	29 Jun 2004 17:20:04 -0000	1.6
  @@ -64,4 +64,92 @@
           </attribute>
       </jdbc-connection-descriptor>
   
  +    <!--
  +        NOTE: This is a test descriptor used within
  +        the junit test suite, do not change any value.
  +        A test db connections used for junit tests.
  +        This connection match a hsql database called 'OJB_FarAway'
  +        If you do not use the test suite, you could delete
  +        this descriptor.
  +        This descriptor was used to check multiple database
  +        use.
  +    -->
  +    <jdbc-connection-descriptor
  +        jcd-alias="farAway"
  +        platform="Hsqldb"
  +        jdbc-level="2.0"
  +        driver="org.hsqldb.jdbcDriver"
  +        protocol="jdbc"
  +        subprotocol="hsqldb"
  +        dbalias="../OJB_FarAway"
  +        username="sa"
  +        password=""
  +        batch-mode="false"
  +    >
  +
  +        <connection-pool
  +            maxActive="6"
  +            whenExhaustedAction="0"
  +            validationQuery="select count(*) from OJB_HL_SEQ"
  +        />
  +
  +        <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
  +            <attribute attribute-name="grabSize" attribute-value="5"/>
  +        </sequence-manager>
  +    </jdbc-connection-descriptor>
  +
  +    <!--
  +        NOTE: This is a test descriptor used within
  +        the junit test suite, do not change any value.
  +        If you do not use the test suite, you could
  +        delete this descriptor.
  +        In the the test directory under
  +        org.apache.ojb.broker.metadata.MetadataTest#testReadConnectionDescriptor
  +        this descriptor will be evaluated.
  +    -->
  +    <jdbc-connection-descriptor
  +        jcd-alias="testConnection"
  +        default-connection="false"
  +        platform="Oracle"
  +        jdbc-level="1.0"
  +        driver="a driver"
  +        protocol="a protocol"
  +        subprotocol="a subprotocol"
  +        dbalias="myDbalias"
  +        username="a user"
  +        password="a password"
  +        eager-release="true"
  +        batch-mode="true"
  +        useAutoCommit="0"
  +        ignoreAutoCommitExceptions="true"
  +    >
  +
  +        <object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl">
  +            <attribute attribute-name="cacheKey1" attribute-value="cacheValue1"/>
  +            <attribute attribute-name="cacheKey2" attribute-value="cacheValue2"/>
  +        </object-cache>
  +
  +        <connection-pool
  +            maxActive="1"
  +            maxIdle="2"
  +            maxWait="3"
  +            minEvictableIdleTimeMillis="4"
  +            numTestsPerEvictionRun="5"
  +            testOnBorrow="true"
  +            testOnReturn="true"
  +            testWhileIdle="true"
  +            timeBetweenEvictionRunsMillis="6"
  +            whenExhaustedAction="2"
  +            validationQuery="a query"
  +            logAbandoned="true"
  +            removeAbandoned="true"
  +            removeAbandonedTimeout="8"
  +        />
  +
  +        <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
  +            <attribute attribute-name="key1" attribute-value="value1"/>
  +            <attribute attribute-name="key2" attribute-value="value2"/>
  +        </sequence-manager>
  +    </jdbc-connection-descriptor>
  +
   </descriptor-repository>
  
  
  

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