db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r431732 - in /db/ojb/trunk/src/test/org/apache/ojb: Test_ConnectionDescriptor.xml broker/metadata/MetadataTest.java
Date Tue, 15 Aug 2006 23:20:00 GMT
Author: arminw
Date: Tue Aug 15 16:19:59 2006
New Revision: 431732

URL: http://svn.apache.org/viewvc?rev=431732&view=rev
Log:
improve test: custom attributes in class-descriptor

Modified:
    db/ojb/trunk/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml
    db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/MetadataTest.java

Modified: db/ojb/trunk/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml?rev=431732&r1=431731&r2=431732&view=diff
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml Tue Aug 15 16:19:59
2006
@@ -158,6 +158,9 @@
             <attribute attribute-name="key1" attribute-value="value1"/>
             <attribute attribute-name="key2" attribute-value="value2"/>
         </sequence-manager>
+
+        <attribute attribute-name="conKey1" attribute-value="conValue1"/>
+        <attribute attribute-name="conKey2" attribute-value="conValue2"/>
     </jdbc-connection-descriptor>
 
 </descriptor-repository>

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/MetadataTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/MetadataTest.java?rev=431732&r1=431731&r2=431732&view=diff
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/MetadataTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/metadata/MetadataTest.java Tue Aug 15 16:19:59
2006
@@ -425,9 +425,16 @@
     }
 
     public void testReadConnectionDescriptor()
-    {
-        JdbcConnectionDescriptor jcd = ojb.getMetadataManager().connectionRepository().
-                getDescriptor(new PBKey("testConnection", "a user", "a password"));
+    {           
+        MetadataManager mm = ojb.getMetadataManager();
+        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
@@ -476,9 +483,16 @@
             <attribute attribute-name="key1" attribute-value="value1"/>
             <attribute attribute-name="key2" attribute-value="value2"/>
         </sequence-manager>
-    </jdbc-connection-descriptor>
 
+        <attribute attribute-name="con1" attribute-value="conValue1"/>
+        <attribute attribute-name="con2" attribute-value="conValue2"/>
+    </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());
 
@@ -508,6 +522,9 @@
 
         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