You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by kw...@apache.org on 2006/05/30 19:58:07 UTC

svn commit: r410331 - in /incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test: CrudWithChangeHistory.java DefectTests.java

Author: kwilliams
Date: Tue May 30 10:58:07 2006
New Revision: 410331

URL: http://svn.apache.org/viewvc?rev=410331&view=rev
Log:
Test changes to match new capability in ConfigHelper

Modified:
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java?rev=410331&r1=410330&r2=410331&view=diff
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java Tue May 30 10:58:07 2006
@@ -30,6 +30,7 @@
 
 import org.apache.tuscany.das.rdb.ApplyChangesCommand;
 import org.apache.tuscany.das.rdb.Command;
+import org.apache.tuscany.das.rdb.ConfigHelper;
 import org.apache.tuscany.das.rdb.SDODataTypes;
 import org.apache.tuscany.das.rdb.test.data.CustomerData;
 import org.apache.tuscany.das.rdb.test.data.OrderDetailsData;
@@ -73,16 +74,14 @@
         //Modify customer
         customer.set( "LASTNAME", "Pavick" );
 
+        // Provide updatecommand programmatically via config
+        ConfigHelper helper = new ConfigHelper();
+        helper.addUpdateStatement("update CUSTOMER set LASTNAME = :LASTNAME, ADDRESS = :ADDRESS where ID = :ID", "CUSTOMER");        
+               
         //Build apply changes command
-        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
+        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig());
         apply.setConnection( getConnection() );
-
-        //Manually create and add update command
-        Command update = Command.FACTORY.createCommand( "update CUSTOMER set LASTNAME = :LASTNAME where ID = :ID" );
-        update.addParameter( "LASTNAME", SDODataTypes.STRING );
-        update.addParameter( "ID", SDODataTypes.INTEGER );
-        apply.addUpdateCommand( customer.getType(), update );
-
+        
         //Flush changes
         apply.execute( root );
 

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=410331&r1=410330&r2=410331&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 May 30 10:58:07 2006
@@ -28,6 +28,7 @@
 import org.apache.tuscany.das.rdb.ApplyChangesCommand;
 import org.apache.tuscany.das.rdb.Command;
 import org.apache.tuscany.das.rdb.CommandGroup;
+import org.apache.tuscany.das.rdb.ConfigHelper;
 import org.apache.tuscany.das.rdb.SDODataTypes;
 import org.apache.tuscany.das.rdb.test.data.CompanyData;
 import org.apache.tuscany.das.rdb.test.data.CompanyDeptData;
@@ -285,8 +286,7 @@
      * Read and modify a customer.  
      * Provide needed Create/Update/Delete statements programatically
      * 
-     * From CrudWithChangeHistory tests but not setting parameters.
-     * Should not be necessary
+     * Fails if provided udpate statement does not include all parameters
      */
     public void testReadModifyApply()
         throws Exception
@@ -302,16 +302,15 @@
         //Modify customer
         customer.set( "LASTNAME", "Pavick" );
 
+
+        // Provide updatecommand programmatically via config
+        ConfigHelper helper = new ConfigHelper();
+        helper.addUpdateStatement("update CUSTOMER set LASTNAME = :LASTNAME where ID = :ID", "CUSTOMER");         
+        
         //Build apply changes command
-        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
+        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig());
         apply.setConnection( getConnection() );
 
-        //Manually create and add update command
-        Command update = Command.FACTORY.createCommand( "update CUSTOMER set LASTNAME = :LASTNAME where ID = :ID" );
-//        update.addParameter( "LASTNAME", SDODataTypes.STRING );
-//        update.addParameter( "ID", SDODataTypes.INTEGER );
-        apply.addUpdateCommand( customer.getType(), update );
-
         //Flush changes
         apply.execute( root );
 
@@ -330,6 +329,9 @@
      * Provide needed Create/Update/Delete statements via xml file
      * 
      * Same as in CrudWithChangeHistory but provided partial update statement
+     * 
+     * Fails if provided udpate statement does not include all parameters
+     * 
      */
     public void testReadModifyApply1()
         throws Exception



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org