Author: kwilliams
Date: Tue Jul 18 15:17:12 2006
New Revision: 423268

URL: http://svn.apache.org/viewvc?rev=423268&view=rev
Log:
Darius' patch for TUSCANY-433.  Thanks Darius!

Modified:
    
incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java
    
incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java
    
incubator/tuscany/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml

Modified: 
incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java?rev=423268&r1=423267&r2=423268&view=diff
==============================================================================
--- 
incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java
 (original)
+++ 
incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java
 Tue Jul 18 15:17:12 2006
@@ -26,6 +26,7 @@
 import java.util.Random;
 
 import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.ConfigHelper;
 import org.apache.tuscany.das.rdb.DAS;
 import org.apache.tuscany.das.rdb.test.data.CompanyData;
 import org.apache.tuscany.das.rdb.test.data.CompanyDeptData;
@@ -249,5 +250,58 @@
 
     }
 
-    
+    /**
+     * Formely tests concerning Tuscany-433. The error causing these tests was 
cleared up when
+     * the method for handling parameters was changed.
+     */
+    public void testReadModifyApply()
+        throws Exception
+    {
+
+
+        // Provide updatecommand programmatically via config
+        ConfigHelper helper = new ConfigHelper();
+        helper.addUpdateStatement("update CUSTOMER set LASTNAME = ? where ID = 
?", "CUSTOMER", "LASTNAME ID");         
+        
+       DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
+       
+        //Read customer 1
+        Command select = das.createCommand( "Select * from CUSTOMER where ID = 
1" );        
+        DataObject root = select.executeQuery();
+
+        DataObject customer = (DataObject) root.get( "CUSTOMER[1]" );
+
+        //Modify customer
+        customer.set( "LASTNAME", "Pavick" );
+
+        das.applyChanges( root );
+
+        //Verify changes
+        root = select.executeQuery();
+        assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) );
+
+    }
+
+    public void testReadModifyApply1()
+        throws Exception
+    {
+       DAS das = 
DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD2.xml"), 
getConnection());
+        //Read customer 1
+        Command select = das.createCommand( "Select * from CUSTOMER where ID = 
1" );       
+        DataObject root = select.executeQuery();
+
+        DataObject customer = (DataObject) root.get( "CUSTOMER[1]" );
+
+        //Modify customer
+        customer.set( "LASTNAME", "Pavick" );
+
+        //Build apply changes command
+        das.applyChanges( root );
+
+        //Verify changes
+        root = select.executeQuery();
+        assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) );
+
+    }    
+
 }

Modified: 
incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java?rev=423268&r1=423267&r2=423268&view=diff
==============================================================================
--- 
incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java
 (original)
+++ 
incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java
 Tue Jul 18 15:17:12 2006
@@ -102,83 +102,5 @@
        das.applyChanges(root);
         
     }  
-         
-    
-    /**
-     * Tuscany-433
-     * 
-     * Read and modify a customer.  
-     * Provide needed Create/Update/Delete statements programatically
-     * 
-     * Fails if provided udpate statement does not include all parameters
-     */
-    public void testReadModifyApply()
-        throws Exception
-    {
-
-
-        // Provide updatecommand programmatically via config
-        ConfigHelper helper = new ConfigHelper();
-        helper.addUpdateStatement("update CUSTOMER set LASTNAME = ? where ID = 
?", "CUSTOMER", "LASTNAME ID");         
-        
-       DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
-       
-        //Read customer 1
-        Command select = das.createCommand( "Select * from CUSTOMER where ID = 
1" );        
-        DataObject root = select.executeQuery();
-
-        DataObject customer = (DataObject) root.get( "CUSTOMER[1]" );
-
-        //Modify customer
-        customer.set( "LASTNAME", "Pavick" );
-
-        das.applyChanges( root );
-
-        //Verify changes
-        root = select.executeQuery();
-        assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) );
-
-    }
-
-    /**
-     * 
-     * Tuscany-433
-     * 
-     * 
-     * Read and modify a customer.  
-     * Provide needed Create/Update/Delete statements via xml file
-     * 
-     * Same as in CrudWithChangeHistory but provided partial update statement.
-     * That is, it does not update all columns
-     * 
-     * Fails if provided udpate statement does not include all parameters
-     * 
-     */
-    public void testReadModifyApply1()
-        throws Exception
-    {
-       DAS das = 
DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD2.xml"), 
getConnection());
-        //Read customer 1
-        Command select = das.createCommand( "Select * from CUSTOMER where ID = 
1" );       
-        DataObject root = select.executeQuery();
-
-        DataObject customer = (DataObject) root.get( "CUSTOMER[1]" );
-
-        //Modify customer
-        customer.set( "LASTNAME", "Pavick" );
-
-        //Build apply changes command
-        das.applyChanges( root );
-
-        //Verify changes
-        root = select.executeQuery();
-        assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) );
-
-    }    
-
-    
-    
-    
-    
     
 }

Modified: 
incubator/tuscany/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml?rev=423268&r1=423267&r2=423268&view=diff
==============================================================================
--- 
incubator/tuscany/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml
 (original)
+++ 
incubator/tuscany/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD2.xml
 Tue Jul 18 15:17:12 2006
@@ -16,13 +16,13 @@
  -->
 <Config 
xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
 
-  <Table tableName="CUSTOMER"
-         create="insert into customer values (:ID, :LASTNAME, :ADDRESS)"
-         update="update customer set lastname = :LASTNAME where ID = :ID"
-      delete="delete from customer where ID = :ID">
-    <Column columnName="ID" primaryKey="true"/>
-    <Column columnName="LASTNAME"/>
-    <Column columnName="ADDRESS"/> 
+  <Table tableName="CUSTOMER">
+         <create sql="insert into customer values (?, ?, ?)" parameters="ID 
LASTNAME ADDRESS"/>
+         <update sql="update customer set lastname = ? where ID = ?" 
parameters="LASTNAME ID"/>
+      <delete sql="delete from customer where ID = ?" parameters="ID"/>
+      <Column columnName="ID" primaryKey="true"/>
+      <Column columnName="LASTNAME"/>
+      <Column columnName="ADDRESS"/> 
   </Table>
        
 </Config>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to