You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/04/25 02:05:56 UTC

svn commit: r532148 - in /incubator/tuscany/java/das/rdb/src/test: java/org/apache/tuscany/das/rdb/test/RelationshipTests.java resources/companyMappingWithResultDescriptor.xml

Author: lresende
Date: Tue Apr 24 17:05:55 2007
New Revision: 532148

URL: http://svn.apache.org/viewvc?view=rev&rev=532148
Log:
Updating testcase to add a scenario uses union to simulate full outer join and add employees without department to a department without employees. Now with the right lookup key.

Modified:
    incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java
    incubator/tuscany/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml

Modified: incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java?view=diff&rev=532148&r1=532147&r2=532148
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java (original)
+++ incubator/tuscany/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java Tue Apr 24 17:05:55 2007
@@ -133,28 +133,30 @@
      */
     public void testSimulateFullOuterJoinRelationshipModification() throws Exception {
 
-//        DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithResultDescriptor.xml"), getConnection());
-//        // Read some customers and related orders
-//         
-//        Command select = das.getCommand("testFullOuterJoinRelationship");
-//        DataObject root = select.executeQuery();
-//
-//        DataObject department = root.getDataObject("DEPARTMENT[ID='6']"); //department with no employees
-//        
-//        DataObject emp1 = root.getDataObject("EMPLOYEE[ID='12']"); //employee not assgned to department
-//        DataObject emp2 = root.getDataObject("EMPLOYEE[ID='15']"); //employee not assgned to department
-//        
-//        department.getList("employees").add(emp1);
-//        department.getList("employees").add(emp2);
-//
-//        das.applyChanges(root);
-//        
-//        //verify cust1 relationship updates
-//        select = das.getCommand("testEmployeesFromDepartment");
-//        select.setParameter(1, 6);
-//        
-//        root = select.executeQuery();
-//        assertEquals(2, root.getDataObject("DEPARTMENT[ID='6']").getList("employees").size());
+        DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithResultDescriptor.xml"), getConnection());
+        // Read some customers and related orders
+        
+        Command select = das.getCommand("testFullOuterJoinRelationship");
+        DataObject root = select.executeQuery();
+
+        DataObject department = root.getDataObject("DEPARTMENT[NAME='New Technologies']"); //department with no employees
+                
+        DataObject emp1 = root.getDataObject("EMPLOYEE[NAME='Mary Smith']"); //employee not assgned to department
+        DataObject emp2 = root.getDataObject("EMPLOYEE[NAME='John Smith']"); //employee not assgned to department
+        
+        department.getList("employees").add(emp1);
+        department.getList("employees").add(emp2);
+
+        das.applyChanges(root);
+
+        //verify cust1 relationship updates
+        select = das.getCommand("testEmployeesFromDepartment");
+        select.setParameter(1, "New Technologies" );
+
+        root = select.executeQuery();
+        assertEquals(2, root.getDataObject("DEPARTMENT[NAME='New Technologies']").getList("employees").size());
+
+        
 
     }
     

Modified: incubator/tuscany/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml?view=diff&rev=532148&r1=532147&r2=532148
==============================================================================
--- incubator/tuscany/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml (original)
+++ incubator/tuscany/java/das/rdb/src/test/resources/companyMappingWithResultDescriptor.xml Tue Apr 24 17:05:55 2007
@@ -32,7 +32,7 @@
  		<ResultDescriptor columnName="DEPARTMENTID" tableName="EMPLOYEE" columnType="commonj.sdo.IntObject"/>
   </Command>
 
-  <Command name="testEmployeesFromDepartment" SQL="select * from DEPARTMENT left join EMPLOYEE on DEPARTMENT.ID = EMPLOYEE.DEPARTMENTID where DEPARTMENT.ID = ?" kind="Select"/>
+  <Command name="testEmployeesFromDepartment" SQL="select * from DEPARTMENT left join EMPLOYEE on DEPARTMENT.ID = EMPLOYEE.DEPARTMENTID where DEPARTMENT.NAME = ?" kind="Select"/>
       
   <Table tableName="COMPANY">
     <Column columnName="ID" primaryKey="true"/>



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