tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fra...@apache.org
Subject svn commit: r498691 - in /incubator/tuscany/java/sdo/impl/src: main/java/org/apache/tuscany/sdo/impl/ main/java/org/apache/tuscany/sdo/util/resource/ test/java/org/apache/tuscany/sdo/test/ test/resources/
Date Mon, 22 Jan 2007 16:48:02 GMT
Author: frankb
Date: Mon Jan 22 08:48:00 2007
New Revision: 498691

URL: http://svn.apache.org/viewvc?view=rev&rev=498691
Log:
More TUSCANY-153 progress

Modified:
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/ChangeSummaryStreamSerializer.java
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/DataObjectXMLStreamReader.java
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOXMLResourceImpl.java
    incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java
    incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml
    incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java?view=diff&rev=498691&r1=498690&r2=498691
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java
Mon Jan 22 08:48:00 2007
@@ -38,21 +38,13 @@
 import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.UniqueEList;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.*;
 import org.eclipse.emf.ecore.change.ChangeDescription;
 import org.eclipse.emf.ecore.change.FeatureChange;
 import org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl;
 import org.eclipse.emf.ecore.change.util.ChangeRecorder;
 import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
-import org.eclipse.emf.ecore.util.DelegatingFeatureMap;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
-import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.emf.ecore.util.*;
 
 import commonj.sdo.ChangeSummary;
 import commonj.sdo.DataGraph;
@@ -750,6 +742,11 @@
     return null;
   }
 
+  static protected boolean isContainmentReference(Object feature)
+  {
+    return feature instanceof EReference && ((EReference) feature).isContainment();
+  }  
+  
   public DataObject getOldDataObject(DataObject dataObject)
   {
     EObject oldDataObject = EcoreUtil.copy((EObject)dataObject);
@@ -759,6 +756,26 @@
     {
       FeatureChange featureChange = (FeatureChange)fIter.next();
       featureChange.apply(oldDataObject);
+      EStructuralFeature feature = featureChange.getFeature();
+      if (FeatureMapUtil.isFeatureMap(feature))
+      {
+        FeatureMap featureMap = (FeatureMap) oldDataObject.eGet(feature);
+        for (int index = featureMap.size(); index != 0;)
+          if (isContainmentReference(featureMap.getEStructuralFeature(--index)))
+            featureMap.setValue(index, getOldDataObject((DataObject) featureMap.getValue(index)));
+      }
+      else if (isContainmentReference(feature))
+      {
+        Object value = oldDataObject.eGet(feature);
+        if (feature.isMany())
+        {
+          changes = (List) value;
+          for (int index = changes.size(); index != 0;)
+            changes.set(--index, getOldDataObject((DataObject) changes.get(index))); // Java
pushes stack from left to right
+        }
+        else
+          oldDataObject.eSet(feature, getOldDataObject((DataObject) value));
+      }
     }
 
     return (DataObject)oldDataObject;

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/ChangeSummaryStreamSerializer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/ChangeSummaryStreamSerializer.java?view=diff&rev=498691&r1=498690&r2=498691
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/ChangeSummaryStreamSerializer.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/ChangeSummaryStreamSerializer.java
Mon Jan 22 08:48:00 2007
@@ -146,22 +146,28 @@
 
     static protected final String CREATE_ATTRIBUTE = "create", DELETE_ATTRIBUTE = "delete",
LOGGING_ATTRIBUTE = "logging", REF_ATTRIBUTE = "ref", UNSET = "unset";
 
-    static private StringBuffer step(String nameSpace, String name, StringBuffer path) {
-        return nameSpace == null ? path.append(name) : path.append("*:").append(name).append("[namespace-uri()='").append(nameSpace).append("']");
// *:name[namespace-uri()='nameSpace']
+    private StringBuffer step(String nameSpace, String name, StringBuffer path) throws XMLStreamException
{
+        if (nameSpace != null) {
+            nameSpace = writer.getPrefix(nameSpace);
+            if (nameSpace != null && nameSpace.length() != 0)
+                return path.append(nameSpace).append(':').append(name); // *:name[namespace-uri()='nameSpace']
+        }
+        return path.append(name); 
     }
 
-    private StringBuffer step(Property containmentProperty, StringBuffer path) {
+    private StringBuffer step(Property containmentProperty, StringBuffer path) throws XMLStreamException
{
         return step(xsdHelper.getNamespaceURI(containmentProperty),// TODO "" for no-NameSpace
global element
                 xsdHelper.getLocalName(containmentProperty), path);
     }
 
-    private StringBuffer step(Property containmentProperty) {
+    private StringBuffer step(Property containmentProperty) throws XMLStreamException {
         return step(containmentProperty, new StringBuffer());
     }
 
     private DataObject dataObject;
 
-    private StringBuffer step(Property containmentProperty, Object container) {
+    private StringBuffer step(Object container) throws XMLStreamException {
+        Property containmentProperty = dataObject.getContainmentProperty();
         StringBuffer step = step(containmentProperty);
         if (containmentProperty.isMany())
             step.append('[').append(((DataObject) container).getList(containmentProperty).indexOf(dataObject)
+ 1).append(']');
@@ -171,27 +177,33 @@
     private String pathRootObject;
     private DataObject rootObject;
 
-    private String path() {
+    private EObject container(EObject object) {
+        final EObject container = object.eContainer();
+        if (!(container instanceof DataObject))
+            return null;
+        String name = extendedMetaData.getName(container.eClass());
+        return name != null && name.length() == 0 // DocumentRoot
+             ? null : container;
+    }
+
+    private String path() throws XMLStreamException {
         if (pathRootObject == STRING_OPTION)
             pathRootObject = options == null ? null : (String) options.get(OPTION_RootObject_PATH);
         if (pathRootObject != null && dataObject == rootObject)
             return null;
-        EObject container = ((EObject) dataObject).eContainer();
-        if (!(container instanceof DataObject))
+        EObject container = container((EObject) dataObject);
+        if (container == null)
             return null;
-        Property containmentProperty = dataObject.getContainmentProperty();
-        StringBuffer step = step(containmentProperty, container);
-        String path;
+        StringBuffer step = step(container);
         while (true) {
-            path = step.toString();
+            String path = step.toString();
             dataObject = (DataObject) container;
             if (pathRootObject != null && container == rootObject)
                 return path;
-            container = container.eContainer();
-            if (!(container instanceof DataObject))
+            container = container(container);
+            if (container == null)
                 return path;
-            containmentProperty = dataObject.getContainmentProperty();
-            step = step(containmentProperty, container).append('/').append(path);
+            step = step(container).append('/').append(path);
         }
     }
 
@@ -199,9 +211,32 @@
      * not to support DataGraph 3-1 private org.eclipse.emf.ecore.resource.Resource rootResource;
      */
 
-    private String rootElement;
+    protected String rootElementNS;
+
+    String rootElementName;
 
-    String ref() {
+    ExtendedMetaData extendedMetaData;
+
+    protected final String rootElementName() {
+        if (rootElementNS != null)
+            return rootElementName;
+        QName rootElement = (QName) options.get(OPTION_ROOT_ELEMENT);
+        if (rootElement != null) {
+            rootElementNS = rootElement.getNamespaceURI();
+            return rootElementName = rootElement.getLocalPart();
+        }
+        EStructuralFeature element = ((EObject) rootObject).eContainingFeature();
+        if (element == null) {
+            rootElementNS = "";
+            return rootElementName = "descendant-or-self::node()";
+        }
+        rootElementNS = extendedMetaData.getNamespace(element);
+        if (rootElementNS == null)
+            rootElementNS = "";
+        return rootElementName = extendedMetaData.getName(element);
+    }
+
+    String ref() throws XMLStreamException {
         /*
          * not to support DataGraph 3-2 if (rootResource != null) return rootResource.getURIFragment((EObject)
dataObject);
          */
@@ -210,7 +245,7 @@
             return id;
         id = path();
         if (pathRootObject == null)
-            return id == null ? "#/" + rootElement // descendant-or-self::node()
+            return id == null ? "#/" + rootElementName() // descendant-or-self::node()
             : "#//" + id;
         return id == null ? pathRootObject/* + "."*/ : pathRootObject + id;
     }
@@ -240,7 +275,11 @@
 
     private ChangeSummary changeSummary;
 
-    String refDeleted() {
+    protected boolean skipDeletedModification(DataObject modifiedDataObject) {
+        return changeSummary.isDeleted(modifiedDataObject);
+    }
+
+    String refDeleted() throws XMLStreamException {
         String id = EcoreUtil.getID((EObject) dataObject);
         if (id != null)
             return id;
@@ -268,14 +307,16 @@
         
         dataObject = changeSummary.getOldContainer(deletedDataObject);
         Property containmentProperty = dataObject.getContainmentProperty();
-        String name = containmentProperty == null ? rootElement : xsdHelper.getLocalName(containmentProperty);
+        String name = containmentProperty == null ? rootElementName() : xsdHelper.getLocalName(containmentProperty);
         int index = 1;
         for (Iterator iterator = modifiedDataObjects.iterator(); iterator.hasNext();) {
             DataObject modifiedDataObject = (DataObject) iterator.next();
+            if (skipDeletedModification(modifiedDataObject))
+                continue;
             if (modifiedDataObject == dataObject)
                 break;
             Property property = modifiedDataObject.getContainmentProperty();
-            if (property == containmentProperty || name.equals(property == null ? rootElement
: xsdHelper.getLocalName(property)))
+            if (property == containmentProperty || name.equals(property == null ? rootElementName()
: xsdHelper.getLocalName(property)))
                 ++index;
         }
         pathDeleted/*.append("*:")*/.append(name).append('[').append(index).append("]/");
@@ -308,12 +349,11 @@
     }
 
     Collection deletedDataObjects;
-    static final String XSI = "http://www.w3.org/2001/XMLSchema-instance", XSI_PREFIX = "xsi",
TYPE = "type";
 
     protected final void writeElement(Object value, Property property) throws XMLStreamException
{
         if (value == null) {
             writeStartElement(property);
-            writeGlobalAttribute(XSI_PREFIX, XSI, "nil", "true");
+            writeGlobalAttribute(ExtendedMetaData.XSI_PREFIX, ExtendedMetaData.XSI_URI, XMLResource.NIL,
"true");
             writeEndElement(null);
         } else if (value instanceof DataObject) {
             dataObject = (DataObject) value;
@@ -390,9 +430,14 @@
      */
     OPTION_RootObject_PATH = "RootObject path",
     /**
-     * Boolean to  sequence/list/array. Absent/null/Boolean.FALSE is the default (no optimization)
+     * Boolean to optimize sequence/list/array. Absent/null/Boolean.FALSE is the default
(no optimization)
+     */
+    OPTION_OPTIMIZE_LIST = "optimize sequence/list/array",
+    /**
+     * Element QName if the changeSummary Root Object is a XML root; the NameSpace can be
empty, never null; the prefix is ignored.
+     * Absent/null is the default (automatic computation from DocumentRoot if any)
      */
-    OPTION_OPTIMIZE_LIST = "optimize sequence/list/array";
+    OPTION_ROOT_ELEMENT = "Root Element";
 
     /**
      * Exports ChangeSummary
@@ -403,12 +448,10 @@
      *            changeSummary element; the NameSpace can be empty if no NameSpace, or null
if local element; the prefix can be null(no preference)
      * @param writer
      *            Never null
-     * @param rootElement
-     *            Element QName if the changeSummary Root Object is a Document Root; the
NameSpace can be empty, never null; the prefix is ignored
      * @param options
      *            {@link #OPTION_LINE_BREAK}, {@link #OPTION_INDENT}, {@link #OPTION_MARGIN},
{@link #OPTION_RootObject_PATH}, {@link #OPTION_OPTIMIZE_LIST} and XMLResource.OPTION_EXTENDED_META_DATA;
can be null or empty
      */
-    public final void saveChangeSummary(ChangeSummary changeSummary, QName changeSummaryElement,
XMLStreamWriter writer, QName rootElement, Map options)
+    public final void saveChangeSummary(ChangeSummary changeSummary, QName changeSummaryElement,
XMLStreamWriter writer, Map options)
             throws XMLStreamException {
         /*
          * 6-1. Group created, deleted and modified DataObjects
@@ -454,7 +497,7 @@
         writeStartElement(changeSummaryElement.getPrefix(), changeSummaryElementNS, changeSummaryElementName);
         lineBreak = STRING_OPTION;
         rootObject = changeSummary.getRootObject();
-        ExtendedMetaData extendedMetaData = (ExtendedMetaData) options.get(XMLResource.OPTION_EXTENDED_META_DATA);
+        extendedMetaData = (ExtendedMetaData) options.get(XMLResource.OPTION_EXTENDED_META_DATA);
         if (extendedMetaData == null)
         {
             extendedMetaData = ExtendedMetaData.INSTANCE;
@@ -469,17 +512,15 @@
         {
             EClassifier type = changeDescription.eClass();
             if (type != declaration.getType() && type != CHANGE_SUMMARY)
-            {
-                writeGlobalAttribute(XSI_PREFIX, XSI, TYPE, new StringBuffer(prefix(extendedMetaData.getNamespace(type),
null))
+                writeGlobalAttribute(ExtendedMetaData.XSI_PREFIX, ExtendedMetaData.XSI_URI,
XMLResource.TYPE, new StringBuffer(prefix(extendedMetaData.getNamespace(type), null))
                         .append(':').append(extendedMetaData.getName(type)).toString());
-            }
         }
         
         /*
          * 6-3. "create" attribute
          *  input: createdDataObjects (6-1), rootResource (6-2), changeSummary & writer
          */
-        this.rootElement = rootElement.getLocalPart();
+        rootElementNS = null;
         this.changeSummary = changeSummary;
         if (createdDataObjects.hasNext()) {
             StringBuffer buffer = new StringBuffer();
@@ -495,7 +536,7 @@
 
         /*
          * 6-4. "delete" attribute
-         *  input: deletedDataObjects (6-1), modifiedDataObjects (6-1), rootElement &
writer
+         *  input: deletedDataObjects (6-1), modifiedDataObjects (6-1) & writer
          */
         Iterator iterator = deletedDataObjects.iterator();
         if (iterator.hasNext()) {
@@ -534,19 +575,21 @@
             prefix(SDOAnnotations.COMMONJ_SDO_NS, SDOPackage.eNS_PREFIX);
             do {
                 DataObject dataObject = (DataObject) iterator.next();
-                if (deletedDataObjects.contains(dataObject)) continue;
-
-                Collection oldValues = changeSummary.getOldValues(dataObject);
+                if (skipDeletedModification(dataObject))
+                    continue;
                 Property containmentProperty = dataObject.getContainmentProperty();
                 if (containmentProperty == null) {
                     ++nest;
                     startElement();
-                    writer.writeStartElement(rootElement.getNamespaceURI(), rootElement.getLocalPart());
+                    rootElementName();
+                    writer.writeStartElement(rootElementNS, rootElementName);
                 } else
                     writeStartElement(containmentProperty);
+                this.dataObject = dataObject;
                 writeRef();
 
                 String lineBreak = null;
+                Collection oldValues = changeSummary.getOldValues(dataObject);
                 Iterator settings = oldValues.iterator();
                 if (settings.hasNext()) {
                     do {

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/DataObjectXMLStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/DataObjectXMLStreamReader.java?view=diff&rev=498691&r1=498690&r2=498691
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/DataObjectXMLStreamReader.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/DataObjectXMLStreamReader.java
Mon Jan 22 08:48:00 2007
@@ -107,7 +107,7 @@
         populateProperties();
     }
 
-    protected DataObjectXMLStreamReader(Property rootElement, DataObject dataObject, TypeHelper
typeHelper, XSDHelper xsdHelper) {
+    public DataObjectXMLStreamReader(Property rootElement, DataObject dataObject, TypeHelper
typeHelper, XSDHelper xsdHelper) {
         this.typeHelper = typeHelper == null ? TypeHelper.INSTANCE : typeHelper;
         this.xsdHelper = (xsdHelper != null) ? xsdHelper : ((typeHelper == null) ? XSDHelper.INSTANCE
: SDOUtil.createXSDHelper(typeHelper));
         this.rootElement = rootElement;
@@ -221,10 +221,10 @@
     }
 
     public void populateProperties() {
-        declaredNamespaceMap.put("xml", "http://www.w3.org/XML/1998/namespace");
+        /*declaredNamespaceMap.put("xml", "http://www.w3.org/XML/1998/namespace");
         declaredNamespaceMap.put("xmlns", "http://www.w3.org/2000/xmlns/");
         declaredNamespaceMap.put("xsi", "http://www.w3.org/2001/XMLSchema-instance");
-        
+        */
         
         if (properties != null)
             return;

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOXMLResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOXMLResourceImpl.java?view=diff&rev=498691&r1=498690&r2=498691
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOXMLResourceImpl.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOXMLResourceImpl.java
Mon Jan 22 08:48:00 2007
@@ -43,6 +43,7 @@
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EStructuralFeature;
 import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
 import org.eclipse.emf.ecore.xmi.XMIException;
 import org.eclipse.emf.ecore.xmi.XMLHelper;
 import org.eclipse.emf.ecore.xmi.XMLLoad;
@@ -244,13 +245,8 @@
             if (f.getEType() == ((ModelFactoryImpl) ModelFactory.INSTANCE).getChangeSummaryType())
{
                 Object changeSummary = helper.getValue(o, f);
                 StringBuffer margin = new StringBuffer("  ");
-                for (;;) {
-                    EObject container = o.eContainer();
-                    //FB if (container instanceof XMLTypeDocumentRoot) break;
-                    if (container.eContainer() == null) break; //FB DocumentRoot?
-                    o = container;
+                for (EObject container = o.eContainer(), grandContainer; (grandContainer
= container.eContainer()) != null; container = grandContainer)
                     margin.append("  ");
-                }
                 changeSummaryOptions.put(ChangeSummaryStreamSerializer.OPTION_MARGIN, margin.toString());
                 try {
                     if (xmlStreamWriter == null) {
@@ -271,25 +267,57 @@
                         });
                         xmlStreamWriter.setNamespaceContext(new NamespaceContext() {
                             public String getNamespaceURI(String prefix) {
-                                return helper.getNamespaceURI(prefix);
+                                return declareXSI && ExtendedMetaData.XSI_PREFIX.equals(prefix)
? ExtendedMetaData.XSI_URI : helper
+                                        .getNamespaceURI(prefix);
                             }
 
                             public String getPrefix(String namespaceURI) {
-                                return helper.getPrefix(namespaceURI);
+                                return declareXSI && ExtendedMetaData.XSI_URI.equals(namespaceURI)
? ExtendedMetaData.XSI_PREFIX : helper
+                                        .getPrefix(namespaceURI);
                             }
 
                             public Iterator getPrefixes(String namespaceURI) {
-                                return ((SDOXMLHelperImpl) helper).getPrefixes(namespaceURI).iterator();
+                                final Iterator iterator = ((SDOXMLHelperImpl) helper).getPrefixes(namespaceURI).iterator();
+                                return ExtendedMetaData.XSI_URI.equals(namespaceURI) ? new
Iterator() {
+                                    boolean first = true;
+
+                                    public boolean hasNext() {
+                                        if (first)
+                                            if (declareXSI) // never from true to false
+                                                return true;
+                                            else
+                                                first = false;
+                                        return iterator.hasNext();
+                                    }
+
+                                    public Object next() {
+                                        if (first) {
+                                            first = false;
+                                            if (declareXSI)
+                                                return ExtendedMetaData.XSI_PREFIX;
+                                        }
+                                        return iterator.next();
+                                    }
+
+                                    public void remove() {
+                                        if (first)
+                                            declareXSI = false;
+                                        else
+                                            iterator.remove();
+                                    }
+                                } : iterator;
                             }
                         });
                         for (Iterator iterator = helper.getPrefixToNamespaceMap().iterator();
iterator.hasNext();) {
                             Map.Entry entry = (Map.Entry) iterator.next();
                             xmlStreamWriter.setPrefix((String) entry.getKey(), (String) entry.getValue());
                         }
+                        if (declareXSI)
+                            xmlStreamWriter.setPrefix(ExtendedMetaData.XSI_PREFIX, ExtendedMetaData.XSI_URI);
                         changeSummarySerializer = new ChangeSummaryStreamSerializer();
                     }
                     changeSummarySerializer.saveChangeSummary((ChangeSummary) changeSummary,
qName(f), xmlStreamWriter,
-                            qName(o.eContainingFeature()), changeSummaryOptions);
+                            changeSummaryOptions);
                     doc.addLine();
                 } catch (XMLStreamException e) {
                     xmlResource.getErrors().add(new XMIException(e));

Modified: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java?view=diff&rev=498691&r1=498690&r2=498691
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java
Mon Jan 22 08:48:00 2007
@@ -62,6 +62,8 @@
         child.setBigDecimal("price", new BigDecimal("1500.0"));
         child = quote.createDataObject("quotes");
         child.setBigDecimal("price", new BigDecimal("2000.0"));
+        child = child.createDataObject("quotes");
+        child.setBigDecimal("price", new BigDecimal("2000.99"));
         child = quote.createDataObject("quotes");
         child.setBigDecimal("price", new BigDecimal("2500.0"));
 
@@ -100,7 +102,7 @@
         hc.getXMLHelper().save(quote, TEST_NAMESPACE, "stockQuote", baos);
         //hc.getXMLHelper().save(quote, TEST_NAMESPACE, "stockQuote", System.out);
         
-        //assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()),
getClass().getResource(TEST_DATA_AFTER_UNDO)));
+        assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA_AFTER_UNDO)));
     }
 
     protected void setUp() throws Exception {

Modified: incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml?view=diff&rev=498691&r1=498690&r2=498691
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml (original)
+++ incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml Mon Jan
22 08:48:00 2007
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ASCII"?>
-<cs:rootQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cs="http://www.example.com/simpleCS"
xsi:type="cs:RootQuote">
+<cs:stockQuote xmlns:cs="http://www.example.com/simpleCS">
   <symbol>FBNT</symbol>
   <companyName>FlyByNightTechnology</companyName>
   <price>999.0</price>
@@ -16,15 +16,13 @@
   <quotes>
     <price>4000.0</price>
   </quotes>
-  <changes create="#//quotes[3] #//quotes[4]" delete="#//changes/rootQuote[1]/quotes[2]"
logging="false" xmlns:sdo="commonj.sdo">
-    <cs:rootQuote sdo:ref="#/rootQuote" sdo:unset="volume">
+  <changes create="#//quotes[3] #//quotes[4]" delete="#//changes/stockQuote[1]/quotes[2]"
logging="false" xmlns:sdo="commonj.sdo">
+    <cs:stockQuote sdo:ref="#/stockQuote" sdo:unset="volume">
       <symbol>fbnt</symbol>
       <price>1000.0</price>
       <quotes sdo:ref="#//quotes[1]" />
-      <quotes>
-        <price>2000.0</price>
-      </quotes>
+      <quotes><price>2000.0</price><quotes><price>2000.99</price></quotes></quotes>
       <quotes sdo:ref="#//quotes[2]" />
-    </cs:rootQuote>
+    </cs:stockQuote>
   </changes>
-</cs:rootQuote>
+</cs:stockQuote>
\ No newline at end of file

Modified: incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml?view=diff&rev=498691&r1=498690&r2=498691
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml (original)
+++ incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml Mon
Jan 22 08:48:00 2007
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ASCII"?>
-<cs:rootQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cs="http://www.example.com/simpleCS"
xsi:type="cs:RootQuote">
+<cs:stockQuote xmlns:cs="http://www.example.com/simpleCS">
   <symbol>fbnt</symbol>
   <companyName>FlyByNightTechnology</companyName>
   <price>1000.0</price>
@@ -8,9 +8,12 @@
   </quotes>
   <quotes>
     <price>2000.0</price>
+    <quotes>
+      <price>2000.99</price>
+    </quotes>
   </quotes>
   <quotes>
     <price>2500.0</price>
   </quotes>
   <changes logging="false" />
-</cs:rootQuote>
+</cs:stockQuote>
\ No newline at end of file



---------------------------------------------------------------------
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