db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r430917 - /db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataTest.java
Date Fri, 11 Aug 2006 23:31:50 GMT
Author: arminw
Date: Fri Aug 11 16:31:49 2006
New Revision: 430917

URL: http://svn.apache.org/viewvc?rev=430917&view=rev
Log:
improve test

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataTest.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataTest.java?rev=430917&r1=430916&r2=430917&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataTest.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataTest.java
Fri Aug 11 16:31:49 2006
@@ -95,11 +95,11 @@
 
         DescriptorRepository dr_1 = mm.readDescriptorRepository(TEST_JAR);
         assertNotNull(dr_1);
-        System.out.println("" + dr_1.toXML());
+        //System.out.println("" + dr_1.toXML());
 
         ConnectionRepository cr_1 = mm.readConnectionRepository(TEST_JAR);
         assertNotNull(cr_1);
-        System.out.println("" + cr_1.toXML());
+        //System.out.println("" + cr_1.toXML());
     }
 
     public void testFindFirstConcreteClassDescriptor()
@@ -422,8 +422,15 @@
 
     public void testReadConnectionDescriptor()
     {
-        JdbcConnectionDescriptor jcd = MetadataManager.getInstance().connectionRepository().
-                getDescriptor(new PBKey("testConnection", "a user", "a password"));
+        MetadataManager mm = MetadataManager.getInstance();
+        PBKey key = new PBKey("testConnection", "a user", "a password");
+        JdbcConnectionDescriptor jcd = mm.connectionRepository().getDescriptor(key);
+        if(jcd == null)
+        {
+            ConnectionRepository cr = mm.readConnectionRepository(TEST_CONNECTION_DESCRIPTOR);
+            mm.mergeConnectionRepository(cr);
+            jcd = mm.connectionRepository().getDescriptor(key);
+        }
         /* descriptor snip
 
         <jdbc-connection-descriptor
@@ -443,6 +450,9 @@
         ignoreAutoCommitExceptions="true"
     >
 
+        <attribute attribute-name="con1" attribute-value="conValue1"/>
+        <attribute attribute-name="con2" attribute-value="conValue2"/>
+
         <object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl">
             <attribute attribute-name="cacheKey1" attribute-value="cacheValue1"/>
             <attribute attribute-name="cacheKey2" attribute-value="cacheValue2"/>
@@ -471,6 +481,11 @@
         </sequence-manager>
     </jdbc-connection-descriptor>
         */
+
+        assertNotNull("Seems the jdbc-connection-descriptor lookup failed", jcd);
+
+        //System.out.println("" + jcd.toXML());
+
         // don't set it to true!!! This may break everything (2 default connections)
         assertEquals(false, jcd.isDefaultConnection());
 
@@ -496,12 +511,15 @@
         assertNotNull(jcd.getPassWord());
         assertEquals("a password", jcd.getPassWord());
 
-        assertEquals(true, jcd.getEagerRelease());
+        //assertEquals(true, jcd.getEagerRelease());
 
         assertEquals(true, jcd.getBatchMode());
 
         assertEquals(0, jcd.getUseAutoCommit());
         assertEquals(true, jcd.isIgnoreAutoCommitExceptions());
+
+        assertEquals("conValue1", jcd.getAttribute("conKey1"));
+        assertEquals("conValue2", jcd.getAttribute("conKey2"));
 
         ObjectCacheDescriptor ocd = jcd.getObjectCacheDescriptor();
         assertNotNull(ocd);



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