tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelvingood...@apache.org
Subject svn commit: r552779 - in /incubator/tuscany/java/sdo: impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java lib/pom.xml tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java
Date Tue, 03 Jul 2007 10:55:34 GMT
Author: kelvingoodson
Date: Tue Jul  3 03:55:33 2007
New Revision: 552779

URL: http://svn.apache.org/viewvc?view=rev&rev=552779
Log:
TUSCANY-1393 Ron's fix ensures the correct type of primitive is used to store primitive values
in the EMF NotificationImpl.  Without this fix, attempts to serialize a change summary fail
with a class cast exception because,e.g. the changed int primitive has been stored in a double,
and the attempt to cast it back into an int fails.

Modified:
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java
    incubator/tuscany/java/sdo/lib/pom.xml
    incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java?view=diff&rev=552779&r1=552778&r2=552779
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java
Tue Jul  3 03:55:33 2007
@@ -79,12 +79,32 @@
   {
     eNotify(new ENotificationImpl(this, Notification.SET, property, oldValue, newValue, isSetChange));
   }
+
+  protected void notify(int changeKind, int property, int oldIntValue, int newIntValue)
+  {
+    eNotify(new ENotificationImpl(this, Notification.SET, property, oldIntValue, newIntValue));
+  }
+  
+  protected void notify(int changeKind, int property, int oldIntValue, int newIntValue, boolean
isSetChange)
+  {
+    eNotify(new ENotificationImpl(this, Notification.SET, property, oldIntValue, newIntValue,
isSetChange));
+  }
+  
+  protected void notify(int changeKind, int property, double oldDoubleValue, double newDoubleValue)
+  {
+    eNotify(new ENotificationImpl(this, Notification.SET, property, oldDoubleValue, newDoubleValue));
+  }
   
   protected void notify(int changeKind, int property, double oldDoubleValue, double newDoubleValue,
boolean isSetChange)
   {
     eNotify(new ENotificationImpl(this, Notification.SET, property, oldDoubleValue, newDoubleValue,
isSetChange));
   }
   
+  protected void notify(int changeKind, int property, boolean oldBooleanValue, boolean newBooleanValue)
+  {
+    eNotify(new ENotificationImpl(this, Notification.SET, property, oldBooleanValue, newBooleanValue));
+  }
+  
   protected void notify(int changeKind, int property, boolean oldBooleanValue, boolean newBooleanValue,
boolean isSetChange)
   {
     eNotify(new ENotificationImpl(this, Notification.SET, property, oldBooleanValue, newBooleanValue,
isSetChange));
@@ -447,5 +467,6 @@
   }
   
 } //DataObjectBase
+
 
 

Modified: incubator/tuscany/java/sdo/lib/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/lib/pom.xml?view=diff&rev=552779&r1=552778&r2=552779
==============================================================================
--- incubator/tuscany/java/sdo/lib/pom.xml (original)
+++ incubator/tuscany/java/sdo/lib/pom.xml Tue Jul  3 03:55:33 2007
@@ -51,6 +51,12 @@
             <scope>provided</scope>
             <optional>true</optional>
         </dependency>
+        
+       <!-- dependencies for test cases -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

Modified: incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java?view=diff&rev=552779&r1=552778&r2=552779
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java
(original)
+++ incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java
Tue Jul  3 03:55:33 2007
@@ -111,4 +111,21 @@
         assertEquals("in fact 1 Object was changed in the code", 1, changedDataObjects.size());
    
     }
     
+    public void testChangeSummaryOnDataGraphWithInt() throws Exception {
+      
+      HelperContext hc = HelperProvider.getDefaultContext();
+      CustomerFactory factory = CustomerFactory.INSTANCE;
+      factory.register(hc);
+      Customer customer = factory.createCustomer();
+      Account account = factory.createAccount();
+      customer.setAccount(account);
+      DataObject customerDO = (DataObject) customer; 
+      DataGraph dg = SDOUtil.createDataGraph();
+      SDOUtil.setRootObject(dg, customerDO);
+      dg.getChangeSummary().beginLogging();
+      dg.getRootObject().getDataObject(0).delete();
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+      SDOUtil.saveDataGraph(dg, baos, null);
+    }
+    
 }



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


Mime
View raw message