You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2008/07/28 16:30:24 UTC

svn commit: r680370 [13/22] - in /tuscany/java/sdo: distribution/src/main/assembly/ distribution/src/main/release/bin/ distribution/src/main/release/bin/samples/ impl/ impl/src/main/java/org/apache/tuscany/sdo/helper/ impl/src/main/java/org/apache/tusc...

Propchange: tuscany/java/sdo/impl/src/test/java/com/example/ExpectedException/impl/ExpectedExceptionTypeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/java/sdo/impl/src/test/java/com/example/ExpectedException/impl/SequenceReadOnlyTypeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sdo/impl/src/test/java/com/example/ExpectedException/impl/SequenceReadOnlyTypeImpl.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/impl/src/test/java/com/example/ExpectedException/impl/SequenceReadOnlyTypeImpl.java (original)
+++ tuscany/java/sdo/impl/src/test/java/com/example/ExpectedException/impl/SequenceReadOnlyTypeImpl.java Mon Jul 28 07:30:12 2008
@@ -1,354 +1,354 @@
-/**
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package com.example.ExpectedException.impl;
-
-import com.example.ExpectedException.ExpectedExceptionFactory;
-import com.example.ExpectedException.SequenceReadOnlyType;
-
-import commonj.sdo.Sequence;
-import commonj.sdo.Type;
-
-import org.apache.tuscany.sdo.impl.DataObjectBase;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Sequence Read Only Type</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- *   <li>{@link com.example.ExpectedException.impl.SequenceReadOnlyTypeImpl#getMixed <em>Mixed</em>}</li>
- *   <li>{@link com.example.ExpectedException.impl.SequenceReadOnlyTypeImpl#getReadOnlyVal <em>Read Only Val</em>}</li>
- *   <li>{@link com.example.ExpectedException.impl.SequenceReadOnlyTypeImpl#getReadOnlyListVal <em>Read Only List Val</em>}</li>
- *   <li>{@link com.example.ExpectedException.impl.SequenceReadOnlyTypeImpl#getUniqueName <em>Unique Name</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class SequenceReadOnlyTypeImpl extends DataObjectBase implements SequenceReadOnlyType
-{
-
-  public final static int MIXED = -1;
-
-  public final static int READ_ONLY_VAL = 0;
-
-  public final static int READ_ONLY_LIST_VAL = 1;
-
-  public final static int UNIQUE_NAME = 2;
-
-  public final static int SDO_PROPERTY_COUNT = 3;
-
-  public final static int EXTENDED_PROPERTY_COUNT = -1;
-
-
-  /**
-   * The internal feature id for the '<em><b>Mixed</b></em>' attribute list.
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   * @ordered
-   */ 
-  public final static int INTERNAL_MIXED = 0;
-
-  /**
-   * The internal feature id for the '<em><b>Read Only Val</b></em>' attribute.
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   * @ordered
-   */ 
-  public final static int INTERNAL_READ_ONLY_VAL = 1;
-
-  /**
-   * The internal feature id for the '<em><b>Read Only List Val</b></em>' attribute.
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   * @ordered
-   */ 
-  public final static int INTERNAL_READ_ONLY_LIST_VAL = 2;
-
-  /**
-   * The internal feature id for the '<em><b>Unique Name</b></em>' attribute.
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   * @ordered
-   */ 
-  public final static int INTERNAL_UNIQUE_NAME = 3;
-
-  /**
-   * The number of properties for this type.
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   * @ordered
-   */
-  public final static int INTERNAL_PROPERTY_COUNT = 4;
-
-  protected int internalConvertIndex(int internalIndex)
-  {
-    switch (internalIndex)
-    {
-      case INTERNAL_MIXED: return MIXED;
-      case INTERNAL_READ_ONLY_VAL: return READ_ONLY_VAL;
-      case INTERNAL_READ_ONLY_LIST_VAL: return READ_ONLY_LIST_VAL;
-      case INTERNAL_UNIQUE_NAME: return UNIQUE_NAME;
-    }
-    return super.internalConvertIndex(internalIndex);
-  }
-
-
-  /**
-   * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @see #getMixed()
-   * @generated
-   * @ordered
-   */
-  
-  protected Sequence mixed = null;
-  
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public SequenceReadOnlyTypeImpl()
-  {
-    super();
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public Type getStaticType()
-  {
-    return ((ExpectedExceptionFactoryImpl)ExpectedExceptionFactory.INSTANCE).getSequenceReadOnlyType();
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public Sequence getMixed()
-  {
-    if (mixed == null)
-    {
-      mixed = createSequence(INTERNAL_MIXED);
-    }
-    return mixed;
-  }
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public String getReadOnlyVal()
-  {
-    return (String)get(getMixed(), getType(), INTERNAL_READ_ONLY_VAL);
-  }
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public boolean isSetReadOnlyVal()
-  {
-        return isSet(getMixed(), getType(), INTERNAL_READ_ONLY_VAL);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public String getReadOnlyListVal()
-  {
-    return (String)get(getMixed(), getType(), INTERNAL_READ_ONLY_LIST_VAL);
-  }
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public boolean isSetReadOnlyListVal()
-  {
-        return isSet(getMixed(), getType(), INTERNAL_READ_ONLY_LIST_VAL);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public String getUniqueName()
-  {
-    return (String)get(getMixed(), getType(), INTERNAL_UNIQUE_NAME);
-  }
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public void setUniqueName(String newUniqueName)
-  {
-    set(getMixed(), getType(), INTERNAL_UNIQUE_NAME, newUniqueName);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public void unsetUniqueName()
-  {
-        unset(getMixed(), getType(), INTERNAL_UNIQUE_NAME);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public boolean isSetUniqueName()
-  {
-        return isSet(getMixed(), getType(), INTERNAL_UNIQUE_NAME);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
-  {
-    switch (propertyIndex)
-    {
-      case MIXED:
-        return removeFromSequence(getMixed(), otherEnd, changeContext);
-    }
-    return super.inverseRemove(otherEnd, propertyIndex, changeContext);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public Object get(int propertyIndex, boolean resolve)
-  {
-    switch (propertyIndex)
-    {
-      case MIXED:
-        // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view
-        //if (coreType) 
-        return getMixed();
-      case READ_ONLY_VAL:
-        return getReadOnlyVal();
-      case READ_ONLY_LIST_VAL:
-        return getReadOnlyListVal();
-      case UNIQUE_NAME:
-        return getUniqueName();
-    }
-    return super.get(propertyIndex, resolve);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public void set(int propertyIndex, Object newValue)
-  {
-    switch (propertyIndex)
-    {
-      case MIXED:
-      	setSequence(getMixed(), newValue);
-        return;
-      case UNIQUE_NAME:
-        setUniqueName((String)newValue);
-        return;
-    }
-    super.set(propertyIndex, newValue);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public void unset(int propertyIndex)
-  {
-    switch (propertyIndex)
-    {
-      case MIXED:
-        unsetSequence(getMixed());
-        return;
-      case UNIQUE_NAME:
-        unsetUniqueName();
-        return;
-    }
-    super.unset(propertyIndex);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public boolean isSet(int propertyIndex)
-  {
-    switch (propertyIndex)
-    {
-      case MIXED:
-        return mixed != null && !isSequenceEmpty(getMixed());
-      case READ_ONLY_VAL:
-        return isSetReadOnlyVal();
-      case READ_ONLY_LIST_VAL:
-        return isSetReadOnlyListVal();
-      case UNIQUE_NAME:
-        return isSetUniqueName();
-    }
-    return super.isSet(propertyIndex);
-  }
-
-  /**
-   * <!-- begin-user-doc -->
-   * <!-- end-user-doc -->
-   * @generated
-   */
-  public String toString()
-  {
-    if (isProxy(this)) return super.toString();
-
-    StringBuffer result = new StringBuffer(super.toString());
-    result.append(" (mixed: ");
-    result.append(mixed);
-    result.append(')');
-    return result.toString();
-  }
-
-} //SequenceReadOnlyTypeImpl
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package com.example.ExpectedException.impl;
+
+import com.example.ExpectedException.ExpectedExceptionFactory;
+import com.example.ExpectedException.SequenceReadOnlyType;
+
+import commonj.sdo.Sequence;
+import commonj.sdo.Type;
+
+import org.apache.tuscany.sdo.impl.DataObjectBase;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Sequence Read Only Type</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ *   <li>{@link com.example.ExpectedException.impl.SequenceReadOnlyTypeImpl#getMixed <em>Mixed</em>}</li>
+ *   <li>{@link com.example.ExpectedException.impl.SequenceReadOnlyTypeImpl#getReadOnlyVal <em>Read Only Val</em>}</li>
+ *   <li>{@link com.example.ExpectedException.impl.SequenceReadOnlyTypeImpl#getReadOnlyListVal <em>Read Only List Val</em>}</li>
+ *   <li>{@link com.example.ExpectedException.impl.SequenceReadOnlyTypeImpl#getUniqueName <em>Unique Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class SequenceReadOnlyTypeImpl extends DataObjectBase implements SequenceReadOnlyType
+{
+
+  public final static int MIXED = -1;
+
+  public final static int READ_ONLY_VAL = 0;
+
+  public final static int READ_ONLY_LIST_VAL = 1;
+
+  public final static int UNIQUE_NAME = 2;
+
+  public final static int SDO_PROPERTY_COUNT = 3;
+
+  public final static int EXTENDED_PROPERTY_COUNT = -1;
+
+
+  /**
+   * The internal feature id for the '<em><b>Mixed</b></em>' attribute list.
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   * @ordered
+   */ 
+  public final static int INTERNAL_MIXED = 0;
+
+  /**
+   * The internal feature id for the '<em><b>Read Only Val</b></em>' attribute.
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   * @ordered
+   */ 
+  public final static int INTERNAL_READ_ONLY_VAL = 1;
+
+  /**
+   * The internal feature id for the '<em><b>Read Only List Val</b></em>' attribute.
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   * @ordered
+   */ 
+  public final static int INTERNAL_READ_ONLY_LIST_VAL = 2;
+
+  /**
+   * The internal feature id for the '<em><b>Unique Name</b></em>' attribute.
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   * @ordered
+   */ 
+  public final static int INTERNAL_UNIQUE_NAME = 3;
+
+  /**
+   * The number of properties for this type.
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   * @ordered
+   */
+  public final static int INTERNAL_PROPERTY_COUNT = 4;
+
+  protected int internalConvertIndex(int internalIndex)
+  {
+    switch (internalIndex)
+    {
+      case INTERNAL_MIXED: return MIXED;
+      case INTERNAL_READ_ONLY_VAL: return READ_ONLY_VAL;
+      case INTERNAL_READ_ONLY_LIST_VAL: return READ_ONLY_LIST_VAL;
+      case INTERNAL_UNIQUE_NAME: return UNIQUE_NAME;
+    }
+    return super.internalConvertIndex(internalIndex);
+  }
+
+
+  /**
+   * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @see #getMixed()
+   * @generated
+   * @ordered
+   */
+  
+  protected Sequence mixed = null;
+  
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public SequenceReadOnlyTypeImpl()
+  {
+    super();
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public Type getStaticType()
+  {
+    return ((ExpectedExceptionFactoryImpl)ExpectedExceptionFactory.INSTANCE).getSequenceReadOnlyType();
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public Sequence getMixed()
+  {
+    if (mixed == null)
+    {
+      mixed = createSequence(INTERNAL_MIXED);
+    }
+    return mixed;
+  }
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public String getReadOnlyVal()
+  {
+    return (String)get(getMixed(), getType(), INTERNAL_READ_ONLY_VAL);
+  }
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public boolean isSetReadOnlyVal()
+  {
+        return isSet(getMixed(), getType(), INTERNAL_READ_ONLY_VAL);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public String getReadOnlyListVal()
+  {
+    return (String)get(getMixed(), getType(), INTERNAL_READ_ONLY_LIST_VAL);
+  }
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public boolean isSetReadOnlyListVal()
+  {
+        return isSet(getMixed(), getType(), INTERNAL_READ_ONLY_LIST_VAL);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public String getUniqueName()
+  {
+    return (String)get(getMixed(), getType(), INTERNAL_UNIQUE_NAME);
+  }
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public void setUniqueName(String newUniqueName)
+  {
+    set(getMixed(), getType(), INTERNAL_UNIQUE_NAME, newUniqueName);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public void unsetUniqueName()
+  {
+        unset(getMixed(), getType(), INTERNAL_UNIQUE_NAME);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public boolean isSetUniqueName()
+  {
+        return isSet(getMixed(), getType(), INTERNAL_UNIQUE_NAME);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
+  {
+    switch (propertyIndex)
+    {
+      case MIXED:
+        return removeFromSequence(getMixed(), otherEnd, changeContext);
+    }
+    return super.inverseRemove(otherEnd, propertyIndex, changeContext);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public Object get(int propertyIndex, boolean resolve)
+  {
+    switch (propertyIndex)
+    {
+      case MIXED:
+        // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view
+        //if (coreType) 
+        return getMixed();
+      case READ_ONLY_VAL:
+        return getReadOnlyVal();
+      case READ_ONLY_LIST_VAL:
+        return getReadOnlyListVal();
+      case UNIQUE_NAME:
+        return getUniqueName();
+    }
+    return super.get(propertyIndex, resolve);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public void set(int propertyIndex, Object newValue)
+  {
+    switch (propertyIndex)
+    {
+      case MIXED:
+      	setSequence(getMixed(), newValue);
+        return;
+      case UNIQUE_NAME:
+        setUniqueName((String)newValue);
+        return;
+    }
+    super.set(propertyIndex, newValue);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public void unset(int propertyIndex)
+  {
+    switch (propertyIndex)
+    {
+      case MIXED:
+        unsetSequence(getMixed());
+        return;
+      case UNIQUE_NAME:
+        unsetUniqueName();
+        return;
+    }
+    super.unset(propertyIndex);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public boolean isSet(int propertyIndex)
+  {
+    switch (propertyIndex)
+    {
+      case MIXED:
+        return mixed != null && !isSequenceEmpty(getMixed());
+      case READ_ONLY_VAL:
+        return isSetReadOnlyVal();
+      case READ_ONLY_LIST_VAL:
+        return isSetReadOnlyListVal();
+      case UNIQUE_NAME:
+        return isSetUniqueName();
+    }
+    return super.isSet(propertyIndex);
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
+  public String toString()
+  {
+    if (isProxy(this)) return super.toString();
+
+    StringBuffer result = new StringBuffer(super.toString());
+    result.append(" (mixed: ");
+    result.append(mixed);
+    result.append(')');
+    return result.toString();
+  }
+
+} //SequenceReadOnlyTypeImpl

Propchange: tuscany/java/sdo/impl/src/test/java/com/example/ExpectedException/impl/SequenceReadOnlyTypeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/BoundsTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/BoundsTestCase.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/BoundsTestCase.java (original)
+++ tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/BoundsTestCase.java Mon Jul 28 07:30:12 2008
@@ -1,79 +1,79 @@
-/**
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tuscany.sdo.test;
-
-import java.io.InputStream;
-import java.net.URL;
-
-import org.apache.tuscany.sdo.api.SDOUtil;
-import org.apache.tuscany.sdo.api.SDOHelper;
-
-import junit.framework.TestCase;
-
-import commonj.sdo.*;
-import commonj.sdo.helper.*;
-
-public class BoundsTestCase extends TestCase {
-    private final String TEST_MODEL = "/bounds.xsd";
-    private final String TEST_NAMESPACE = "http://www.example.com/bounds";
-
-    private TypeHelper typeHelper;
-    private XSDHelper xsdHelper;
-    private DataFactory dataFactory;
-
-    public void testBounds() {
-    	Property priceProperty = typeHelper.getOpenContentProperty(TEST_NAMESPACE, "price");
-        assertTrue(priceProperty.isOpenContent());
-        assertEquals(SDOHelper.UNSPECIFIED, SDOUtil.getUpperBound(priceProperty));
-        assertEquals(0, SDOUtil.getLowerBound(priceProperty));
-        
-        Type quoteType = typeHelper.getType(TEST_NAMESPACE, "OpenQuote");
-        DataObject quote = dataFactory.create(quoteType);
-        assertEquals(2, SDOUtil.getUpperBound(quote.getInstanceProperty("symbol")));
-        assertEquals(0, SDOUtil.getLowerBound(quote.getInstanceProperty("symbol")));
-        
-        //XSD default value of maxOccurs and minOccurs is 1, unbounded returns -1 for maxOccurs
-        Type quoteType2 = typeHelper.getType(TEST_NAMESPACE, "OpenQuote2");
-        DataObject quote2 = dataFactory.create(quoteType2);
-        assertEquals(SDOHelper.UNBOUNDED, SDOUtil.getUpperBound(quote2.getInstanceProperty("symbol")));
-        assertEquals(1, SDOUtil.getLowerBound(quote2.getInstanceProperty("symbol")));
-        
-        //XSD default value of maxOccurs and minOccurs is 1
-        Type quoteType3 = typeHelper.getType(TEST_NAMESPACE, "OpenQuote3");
-        DataObject quote3 = dataFactory.create(quoteType3);
-        assertEquals(1, SDOUtil.getUpperBound(quote3.getInstanceProperty("symbol")));
-        assertEquals(1, SDOUtil.getLowerBound(quote3.getInstanceProperty("symbol")));        
-    }
-
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        HelperContext hc = SDOUtil.createHelperContext();
-        typeHelper = hc.getTypeHelper();
-        dataFactory = hc.getDataFactory();
-        xsdHelper = hc.getXSDHelper();
-        
-        // Populate the meta data for the test (Stock Quote) model
-        URL url = getClass().getResource(TEST_MODEL);
-        InputStream inputStream = url.openStream();
-        xsdHelper.define(inputStream, url.toString());
-        inputStream.close();
-    }
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.apache.tuscany.sdo.api.SDOHelper;
+
+import junit.framework.TestCase;
+
+import commonj.sdo.*;
+import commonj.sdo.helper.*;
+
+public class BoundsTestCase extends TestCase {
+    private final String TEST_MODEL = "/bounds.xsd";
+    private final String TEST_NAMESPACE = "http://www.example.com/bounds";
+
+    private TypeHelper typeHelper;
+    private XSDHelper xsdHelper;
+    private DataFactory dataFactory;
+
+    public void testBounds() {
+    	Property priceProperty = typeHelper.getOpenContentProperty(TEST_NAMESPACE, "price");
+        assertTrue(priceProperty.isOpenContent());
+        assertEquals(SDOHelper.UNSPECIFIED, SDOUtil.getUpperBound(priceProperty));
+        assertEquals(0, SDOUtil.getLowerBound(priceProperty));
+        
+        Type quoteType = typeHelper.getType(TEST_NAMESPACE, "OpenQuote");
+        DataObject quote = dataFactory.create(quoteType);
+        assertEquals(2, SDOUtil.getUpperBound(quote.getInstanceProperty("symbol")));
+        assertEquals(0, SDOUtil.getLowerBound(quote.getInstanceProperty("symbol")));
+        
+        //XSD default value of maxOccurs and minOccurs is 1, unbounded returns -1 for maxOccurs
+        Type quoteType2 = typeHelper.getType(TEST_NAMESPACE, "OpenQuote2");
+        DataObject quote2 = dataFactory.create(quoteType2);
+        assertEquals(SDOHelper.UNBOUNDED, SDOUtil.getUpperBound(quote2.getInstanceProperty("symbol")));
+        assertEquals(1, SDOUtil.getLowerBound(quote2.getInstanceProperty("symbol")));
+        
+        //XSD default value of maxOccurs and minOccurs is 1
+        Type quoteType3 = typeHelper.getType(TEST_NAMESPACE, "OpenQuote3");
+        DataObject quote3 = dataFactory.create(quoteType3);
+        assertEquals(1, SDOUtil.getUpperBound(quote3.getInstanceProperty("symbol")));
+        assertEquals(1, SDOUtil.getLowerBound(quote3.getInstanceProperty("symbol")));        
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        HelperContext hc = SDOUtil.createHelperContext();
+        typeHelper = hc.getTypeHelper();
+        dataFactory = hc.getDataFactory();
+        xsdHelper = hc.getXSDHelper();
+        
+        // Populate the meta data for the test (Stock Quote) model
+        URL url = getClass().getResource(TEST_MODEL);
+        InputStream inputStream = url.openStream();
+        xsdHelper.define(inputStream, url.toString());
+        inputStream.close();
+    }
 }
\ No newline at end of file

Propchange: tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/BoundsTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java (original)
+++ tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java Mon Jul 28 07:30:12 2008
@@ -1,219 +1,219 @@
-/**
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tuscany.sdo.test;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-import commonj.sdo.ChangeSummary;
-import commonj.sdo.DataObject;
-import commonj.sdo.Property;
-import commonj.sdo.Sequence;
-import commonj.sdo.Type;
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLHelper;
-import commonj.sdo.helper.XSDHelper;
-
-public class ChangeSummaryPropertyTestCase extends TestCase {
-    private final String TEST_MODEL = "/simpleWithChangeSummary.xsd";
-    private final String TEST_NAMESPACE = "http://www.example.com/simpleCS";
-
-    private final String TEST_DATA_BEFORE_UNDO = "/simpleWithChangeSummary.xml";
-    private final String TEST_DATA_AFTER_UNDO = "/simpleWithChangeSummaryUndone.xml";
-    
-    HelperContext hc;
-    DataFactory dataFactory;
-    XMLHelper xmlHelper;
-    
-    void verify(ChangeSummary cs, DataObject quote, String nameSpace, String element, String beforeUndo, String afterUndo) throws IOException {
-        // Stop logging changes and serialize the resulting data graph
-        //
-        cs.endLogging();
-
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        xmlHelper.save(quote, nameSpace, element, baos);
-        //xmlHelper.save(quote, nameSpace, element, System.out);
-
-        byte[] bytes = baos.toByteArray();
-        URL url = getClass().getResource(beforeUndo);
-        assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(bytes), url));
-        
-        DataObject loaded = xmlHelper.load(new ByteArrayInputStream(bytes)).getRootObject();
-        baos.reset();
-        xmlHelper.save(loaded, nameSpace, element, baos);
-        //xmlHelper.save(loaded, nameSpace, element, System.out);
-        assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), url));
-        
-        // Undo all changes and then serialize the resulting data graph again
-        //
-        cs.undoChanges();
-        
-        baos.reset();
-        xmlHelper.save(quote, nameSpace, element, baos);
-        //xmlHelper.save(quote, nameSpace, element, System.out);
-        
-        assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(afterUndo)));
-    }
-    
-    /**
-     * ChangeSummary property test.
-     */
-    protected final void change(String nameSpace, String beforeUndo, String afterUndo) throws Exception {
-        Type quoteType = hc.getTypeHelper().getType(nameSpace, "RootQuote");
-        DataObject quote = dataFactory.create(quoteType);
-        
-        ChangeSummary cs = quote.getChangeSummary();
-        ChangeSummary csp = (ChangeSummary)quote.get("changes");
-
-        assertSame(cs, csp);
-
-        quote.setString("symbol", "fbnt");
-        quote.setString("companyName", "FlyByNightTechnology");
-        quote.setBigDecimal("price", new BigDecimal("1000.0"));
-        DataObject child = quote.createDataObject("quotes");
-        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"));
-
-        // Begin logging changes
-        //
-        cs.beginLogging();
-
-        // Modify the data graph in various ways
-        //
-        quote.setString("symbol", "FBNT");
-        quote.setBigDecimal("price", new BigDecimal("999.0"));
-        quote.setDouble("volume", 1000);
-
-        child = quote.createDataObject("quotes");
-        child.setBigDecimal("price", new BigDecimal("3000.0"));
-        child = quote.createDataObject("quotes");
-        child.setBigDecimal("price", new BigDecimal("4000.0"));
-
-        quote.getDataObject("quotes[2]").delete();
-
-        verify(cs, quote, nameSpace, "stockQuote", beforeUndo, afterUndo);
-    }
-    
-    /**
-     * Simple ChangeSummary property test.
-     */
-    public void testChangeSummary() throws Exception {
-        change(TEST_NAMESPACE, TEST_DATA_BEFORE_UNDO, TEST_DATA_AFTER_UNDO);
-    }
-    
-    static final String SequenceTest_NameSpace = "http://www.example.com/sequenceCS";
-
-    /**
-     * Mixed ChangeSummary property test.
-     */
-    public void testMixedChangeSummary() throws Exception {
-        change(SequenceTest_NameSpace, "/mixedChangeSummary.xml", "/mixedChangeSummaryUndone.xml");
-    }
-    
-    protected final DataObject createDataObject(Type quoteType, Object value, Sequence sequence, Property property) {
-        DataObject child = dataFactory.create(quoteType);
-        child.set("symbol", value);
-        sequence.add(property, child);
-        return child;
-    }
-    
-    static final String SequenceTest_ELEMENT = "openQuote";
-
-    private XSDHelper xsdHelper;
-
-    /**
-     * Open/any ChangeSummary property test.
-     */
-    public void testOpenChangeSummary() throws Exception {
-        DataObject quote = dataFactory.create(xsdHelper.getGlobalProperty(SequenceTest_NameSpace, SequenceTest_ELEMENT, true).getType());
-        
-        ChangeSummary cs = quote.getChangeSummary();
-        ChangeSummary csp = (ChangeSummary)quote.get("changes");
-
-        assertSame(cs, csp);
-
-        quote.set("symbol", "fbnt");
-        Property property = xsdHelper.getGlobalProperty("http://www.example.com/open", "openStockQuote", true);
-        Type quoteType = property.getType();
-        List openStockQuotes = ((DataObject)quote).getList(property);
-        
-        addQuote(openStockQuotes, quoteType, "1500.0");
-        DataObject osq2 = addQuote(openStockQuotes, quoteType, "2000.0");
-        addQuote(osq2.getList(property), quoteType, "2000.99");
-        addQuote(openStockQuotes, quoteType, "2500.0");
-
-        // Begin logging changes
-        //
-        cs.beginLogging();
-
-        // Modify the data graph in various ways
-        //
-        quote.set("symbol", "FBNT");
-
-        addQuote(openStockQuotes, quoteType, "3000.0");
-        addQuote(openStockQuotes, quoteType, "4000.0");
-
-        openStockQuotes.remove(osq2);
-
-
-        verify(cs, quote, SequenceTest_NameSpace, SequenceTest_ELEMENT, "/openChangeSummary.xml", "/openChangeSummaryUndone.xml");
-    }
-
-    private DataObject addQuote(List openStockQuotes, Type quoteType,
-            Object value) {
-        DataObject osq = dataFactory.create(quoteType);
-        osq.set("symbol", value);
-	    openStockQuotes.add(osq);
-        return osq;
-    }
-
-    void define(String model) throws Exception {
-        // Populate the meta data for the test model
-        URL url = getClass().getResource(model);
-        xsdHelper.define(url.openStream(), url.toString());
-    }
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        hc = SDOUtil.createHelperContext();
-        xsdHelper = hc.getXSDHelper();
-        dataFactory = hc.getDataFactory();
-        xmlHelper = hc.getXMLHelper();
-
-        // Populate the meta data for the test (Stock Quote) model
-        define(TEST_MODEL);
-
-        define("/SequenceChangeSummary.xsd");
-    }
-}
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+
+public class ChangeSummaryPropertyTestCase extends TestCase {
+    private final String TEST_MODEL = "/simpleWithChangeSummary.xsd";
+    private final String TEST_NAMESPACE = "http://www.example.com/simpleCS";
+
+    private final String TEST_DATA_BEFORE_UNDO = "/simpleWithChangeSummary.xml";
+    private final String TEST_DATA_AFTER_UNDO = "/simpleWithChangeSummaryUndone.xml";
+    
+    HelperContext hc;
+    DataFactory dataFactory;
+    XMLHelper xmlHelper;
+    
+    void verify(ChangeSummary cs, DataObject quote, String nameSpace, String element, String beforeUndo, String afterUndo) throws IOException {
+        // Stop logging changes and serialize the resulting data graph
+        //
+        cs.endLogging();
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        xmlHelper.save(quote, nameSpace, element, baos);
+        //xmlHelper.save(quote, nameSpace, element, System.out);
+
+        byte[] bytes = baos.toByteArray();
+        URL url = getClass().getResource(beforeUndo);
+        assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(bytes), url));
+        
+        DataObject loaded = xmlHelper.load(new ByteArrayInputStream(bytes)).getRootObject();
+        baos.reset();
+        xmlHelper.save(loaded, nameSpace, element, baos);
+        //xmlHelper.save(loaded, nameSpace, element, System.out);
+        assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), url));
+        
+        // Undo all changes and then serialize the resulting data graph again
+        //
+        cs.undoChanges();
+        
+        baos.reset();
+        xmlHelper.save(quote, nameSpace, element, baos);
+        //xmlHelper.save(quote, nameSpace, element, System.out);
+        
+        assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(afterUndo)));
+    }
+    
+    /**
+     * ChangeSummary property test.
+     */
+    protected final void change(String nameSpace, String beforeUndo, String afterUndo) throws Exception {
+        Type quoteType = hc.getTypeHelper().getType(nameSpace, "RootQuote");
+        DataObject quote = dataFactory.create(quoteType);
+        
+        ChangeSummary cs = quote.getChangeSummary();
+        ChangeSummary csp = (ChangeSummary)quote.get("changes");
+
+        assertSame(cs, csp);
+
+        quote.setString("symbol", "fbnt");
+        quote.setString("companyName", "FlyByNightTechnology");
+        quote.setBigDecimal("price", new BigDecimal("1000.0"));
+        DataObject child = quote.createDataObject("quotes");
+        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"));
+
+        // Begin logging changes
+        //
+        cs.beginLogging();
+
+        // Modify the data graph in various ways
+        //
+        quote.setString("symbol", "FBNT");
+        quote.setBigDecimal("price", new BigDecimal("999.0"));
+        quote.setDouble("volume", 1000);
+
+        child = quote.createDataObject("quotes");
+        child.setBigDecimal("price", new BigDecimal("3000.0"));
+        child = quote.createDataObject("quotes");
+        child.setBigDecimal("price", new BigDecimal("4000.0"));
+
+        quote.getDataObject("quotes[2]").delete();
+
+        verify(cs, quote, nameSpace, "stockQuote", beforeUndo, afterUndo);
+    }
+    
+    /**
+     * Simple ChangeSummary property test.
+     */
+    public void testChangeSummary() throws Exception {
+        change(TEST_NAMESPACE, TEST_DATA_BEFORE_UNDO, TEST_DATA_AFTER_UNDO);
+    }
+    
+    static final String SequenceTest_NameSpace = "http://www.example.com/sequenceCS";
+
+    /**
+     * Mixed ChangeSummary property test.
+     */
+    public void testMixedChangeSummary() throws Exception {
+        change(SequenceTest_NameSpace, "/mixedChangeSummary.xml", "/mixedChangeSummaryUndone.xml");
+    }
+    
+    protected final DataObject createDataObject(Type quoteType, Object value, Sequence sequence, Property property) {
+        DataObject child = dataFactory.create(quoteType);
+        child.set("symbol", value);
+        sequence.add(property, child);
+        return child;
+    }
+    
+    static final String SequenceTest_ELEMENT = "openQuote";
+
+    private XSDHelper xsdHelper;
+
+    /**
+     * Open/any ChangeSummary property test.
+     */
+    public void testOpenChangeSummary() throws Exception {
+        DataObject quote = dataFactory.create(xsdHelper.getGlobalProperty(SequenceTest_NameSpace, SequenceTest_ELEMENT, true).getType());
+        
+        ChangeSummary cs = quote.getChangeSummary();
+        ChangeSummary csp = (ChangeSummary)quote.get("changes");
+
+        assertSame(cs, csp);
+
+        quote.set("symbol", "fbnt");
+        Property property = xsdHelper.getGlobalProperty("http://www.example.com/open", "openStockQuote", true);
+        Type quoteType = property.getType();
+        List openStockQuotes = ((DataObject)quote).getList(property);
+        
+        addQuote(openStockQuotes, quoteType, "1500.0");
+        DataObject osq2 = addQuote(openStockQuotes, quoteType, "2000.0");
+        addQuote(osq2.getList(property), quoteType, "2000.99");
+        addQuote(openStockQuotes, quoteType, "2500.0");
+
+        // Begin logging changes
+        //
+        cs.beginLogging();
+
+        // Modify the data graph in various ways
+        //
+        quote.set("symbol", "FBNT");
+
+        addQuote(openStockQuotes, quoteType, "3000.0");
+        addQuote(openStockQuotes, quoteType, "4000.0");
+
+        openStockQuotes.remove(osq2);
+
+
+        verify(cs, quote, SequenceTest_NameSpace, SequenceTest_ELEMENT, "/openChangeSummary.xml", "/openChangeSummaryUndone.xml");
+    }
+
+    private DataObject addQuote(List openStockQuotes, Type quoteType,
+            Object value) {
+        DataObject osq = dataFactory.create(quoteType);
+        osq.set("symbol", value);
+	    openStockQuotes.add(osq);
+        return osq;
+    }
+
+    void define(String model) throws Exception {
+        // Populate the meta data for the test model
+        URL url = getClass().getResource(model);
+        xsdHelper.define(url.openStream(), url.toString());
+    }
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        hc = SDOUtil.createHelperContext();
+        xsdHelper = hc.getXSDHelper();
+        dataFactory = hc.getDataFactory();
+        xmlHelper = hc.getXMLHelper();
+
+        // Populate the meta data for the test (Stock Quote) model
+        define(TEST_MODEL);
+
+        define("/SequenceChangeSummary.xsd");
+    }
+}

Propchange: tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/CrossScopeCopyTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/CrossScopeCopyTestCase.java?rev=680370&r1=680369&r2=680370&view=diff
==============================================================================
--- tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/CrossScopeCopyTestCase.java (original)
+++ tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/CrossScopeCopyTestCase.java Mon Jul 28 07:30:12 2008
@@ -1,474 +1,474 @@
-/**
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.tuscany.sdo.test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.Vector;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sdo.api.SDOUtil;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.Property;
-import commonj.sdo.Type;
-import commonj.sdo.helper.CopyHelper;
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.TypeHelper;
-
-public class CrossScopeCopyTestCase extends TestCase 
-{
-   // Literals
-   private static final String TEST_NAMESPACE  = "http://www.example.com/bank";
-   private static final String BANK_MODEL      = "/bank.xsd";
-   private static final String BANK_TYPE       = "bankType";
-   private static final String BRANCH_TYPE     = "branchType";
-   private static final String SERVICE_TYPE    = "serviceType";
-   private static final String ACCOUNT_TYPE    = "accountType";
-   private static final String CUSTOMER_TYPE   = "customerType";
-   private static final String ADDRESS_TYPE    = "addressType";
-   private static final String DYNAMIC_TYPE    = "dynamicType";
-    
-   // SDO model objects
-   private HelperContext hca;
-   private HelperContext hcb;
-   private TypeHelper scopeA;
-   private TypeHelper scopeB;
-
-   // SDO instance objects
-   private DataObject bankSDO;
-   private DataObject branchSDO1;
-   private DataObject branchSDO2;
-   private DataObject serviceSDO1;
-   private DataObject serviceSDO2;
-   private DataObject serviceSDO3;
-   private DataObject customerSDO1;
-   private DataObject customerSDO2;
-   private DataObject customerSDO3;
-   private DataObject customerSDO4;
-    
-   private int indent = 0;
-    
-   public void testCrossScopeCopy() throws IOException 
-   {
-       CopyHelper copyHelperB = SDOUtil.createCrossScopeCopyHelper(hcb);
-       
-       // Perform Shallow Copy Test 
-       DataObject copiedSDO = copyHelperB.copyShallow(bankSDO);
-       shallowCopyAssertions(bankSDO, copiedSDO);
-       
-       // Perform Deep Copy Test
-       copiedSDO = copyHelperB.copy(bankSDO);
-       deepCopyAssertions(bankSDO, copiedSDO);
-       
-       // Inter-Reference Copy
-       copiedSDO = copyHelperB.copy(customerSDO1);
-       DataObject prop = (DataObject)copiedSDO.get("HomeBranch");
-       assertTrue(prop==null);
-       
-       // Perform invalid namespace test
-       DataObject sdo = hca.getDataFactory().create(TEST_NAMESPACE, DYNAMIC_TYPE );
-       sdo.set("custNum", "099" );
-       sdo.set("firstName", "John");
-       sdo.set("lastName", "Doe");
-       boolean failed = false;
-       try
-       {
-           // In this case, we are copying an object to a scope 
-           // where the object's type has not been defined.  That
-           // will generate a null pointer exception what we will 
-           // catch.
-           copyHelperB.copy(sdo);
-       }
-       catch(java.lang.NullPointerException ex)
-       {
-           failed = true;
-       }
-       assertTrue(failed);
-   }
-
-   protected void setUp() throws Exception 
-   {
-       super.setUp();
-
-       // Create Two Scopes
-       hca = SDOUtil.createHelperContext();
-       hcb = SDOUtil.createHelperContext();
-       scopeA = hca.getTypeHelper();
-       scopeB = hcb.getTypeHelper();
-          
-       // Populate scopes with bank model now
-       URL url = getClass().getResource(BANK_MODEL);
-       InputStream inputStream = url.openStream();
-       hca.getXSDHelper().define(inputStream, url.toString());
-       inputStream.close();
-       inputStream = url.openStream();
-       hcb.getXSDHelper().define(inputStream, url.toString());
-       inputStream.close();
-
-       // Now Populate scopeA with some dynamic models
-       populateScopeWithDynamicTypes(scopeA);
-       
-       // Construct Source Tree
-       constructSourceTree(hca.getDataFactory());
-   }   
-
-   private void shallowCopyAssertions(DataObject sdo, DataObject copiedSdo)
-   {
-       assertEquals(sdo.getType().getName(), copiedSdo.getType().getName());
-       assertEquals(sdo.getType().getURI(), copiedSdo.getType().getURI());
-       assertNotSame(sdo.getType(), copiedSdo.getType());
-       assertEquals(sdo.getInstanceProperties().size(), copiedSdo
-                    .getInstanceProperties().size());
-
-       for(Iterator it = sdo.getInstanceProperties().iterator(), it2 = copiedSdo
-           .getInstanceProperties().iterator(); it.hasNext();)
-       {
-           Property p1 = (Property) it.next(), p2 = (Property) it2.next();
-           assertEquals(p1.getName(), p2.getName());
-           Object o1 = sdo.get(p1), o2 = copiedSdo.get(p2);
-           if(p1.getType().isDataType())
-           {
-               assertEquals(o1, o2);
-               // TODO is there a way I can distinguish between mutable and
-               // immutable types
-               // so that I can do some "same object" tests
-           }
-           else
-           {
-               assertNotSame(p1, p2);
-               if(p2.isMany())
-               {
-                   assertEquals(copiedSdo.getList(p2).size(), 0);
-               }
-               else
-               {
-                   assertNull(copiedSdo.get(p2));
-               }
-           }
-           try
-           {
-               sdo.get(p2);
-               assertTrue(false);
-           }
-           catch(Exception e)
-           {
-               // expected route
-           }
-           try
-           {
-               copiedSdo.get(p1);
-               assertTrue(false);
-           }
-           catch(Exception e2)
-           {
-               // expected route
-           }
-       }
-   }
-   
-   private void deepCopyAssertions(DataObject sdo, DataObject copiedSdo)
-   {
-       //indent();
-       
-       //System.out.println("checking objects of types: "
-       //                   + sdo.getType().getName() + ", "
-       //                   + copiedSdo.getType().getName());
-       indent++;
-
-       assertEquals(sdo.getType().getName(), copiedSdo.getType().getName());
-       assertEquals(sdo.getType().getURI(), copiedSdo.getType().getURI());
-       assertNotSame(sdo.getType(), copiedSdo.getType());
-       assertEquals(sdo.getInstanceProperties().size(), copiedSdo
-                    .getInstanceProperties().size());
-
-       for(Iterator it = sdo.getInstanceProperties().iterator(), it2 = copiedSdo
-           .getInstanceProperties().iterator(); it.hasNext();)
-       {
-           Property p1 = (Property) it.next(), p2 = (Property) it2.next();
-           assertEquals(p1.getName(), p2.getName());
-           Object o1 = sdo.get(p1), o2 = copiedSdo.get(p2);
-           if(p1.getType().isDataType())
-           {
-               assertEquals(o1, o2);
-               // TODO is there a way I can distinguish between mutable and
-               // immutable types
-               // so that I can do some "same object" tests
-           }
-           else
-           {
-               assertNotSame(p1, p2);
-               if(p2.isMany())
-               {
-                   assertEquals(sdo.getList(p1).size(), copiedSdo.getList(p2)
-                                .size());
-                   for(Iterator it3 = sdo.getList(p1).iterator(), it4 = copiedSdo
-                       .getList(p2).iterator(); it3.hasNext();)
-                   {
-                       deepCopyAssertions((DataObject) it3.next(),
-                                          (DataObject) it4.next());
-                   }
-               }
-               else
-               {
-                   deepCopyAssertions(sdo.getDataObject(p1), copiedSdo
-                                      .getDataObject(p2));
-               }
-           }
-           try
-           {
-               sdo.get(p2);
-               assertTrue(false);
-           }
-           catch(Exception e)
-           {
-               // expected route
-           }
-           try
-           {
-               copiedSdo.get(p1);
-               assertTrue(false);
-           }
-           catch(Exception e2)
-           {
-               // expected route
-           }
-       }
-
-       indent--;
-   }
-
-   /*
-   private void indent()
-   {
-       for(int i=0; i <indent; i++) System.out.print(" ");
-   }
-   */   
-   
-   protected void constructSourceTree(DataFactory df)
-   {
-       // Create Instances
-       bankSDO      = df.create(TEST_NAMESPACE, BANK_TYPE );
-       branchSDO1   = df.create(TEST_NAMESPACE, BRANCH_TYPE );  
-       branchSDO2   = df.create(TEST_NAMESPACE, BRANCH_TYPE );  
-       serviceSDO1  = df.create(TEST_NAMESPACE, SERVICE_TYPE );  
-       serviceSDO2  = df.create(TEST_NAMESPACE, SERVICE_TYPE );  
-       serviceSDO3  = df.create(TEST_NAMESPACE, SERVICE_TYPE );  
-       customerSDO1 = df.create(TEST_NAMESPACE, CUSTOMER_TYPE );  
-       customerSDO2 = df.create(TEST_NAMESPACE, CUSTOMER_TYPE );  
-       customerSDO3 = df.create(TEST_NAMESPACE, CUSTOMER_TYPE );  
-       customerSDO4 = df.create(TEST_NAMESPACE, CUSTOMER_TYPE );  
-       
-       // Populate the Bank Instance
-       bankSDO.set("name", "Fourth National");
-       Vector v = new Vector();
-       v.add(branchSDO1);
-       v.add(branchSDO2);
-       bankSDO.set("Branch",v);
-       v.removeAllElements();
-       v.add(serviceSDO1);
-       v.add(serviceSDO2);
-       v.add(serviceSDO3);
-       bankSDO.set("Service",v);
-       v.removeAllElements();
-       v.add(customerSDO1);
-       v.add(customerSDO2);
-       v.add(customerSDO3);
-       v.add(customerSDO4);
-       bankSDO.set("Customer",v);
-       v.removeAllElements();
-       
-       // Populate Branch Instances
-       // Branch 1
-       branchSDO1.set("ID", "BR100");
-       DataObject addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
-       addr.set("Street", "1302 Money Street");
-       addr.set("City",   "Apex");
-       addr.set("State", "NC");
-       addr.set("Zip", "27502");
-       branchSDO1.set("Address", addr);
-       v.add("If you are north, head south");
-       v.add("If you are south, head north");
-       branchSDO1.set("Directions", v);
-       v.removeAllElements();
-       DataObject account1 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
-       account1.set("ID", "0000 1200 0001");
-       account1.set("Service",  serviceSDO1 );
-       account1.setBigDecimal("Balance", new BigDecimal("3124.12"));
-       v.add(account1);
-       DataObject account2 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
-       account2.set("ID", "0000 8899 0001");
-       account2.set("Service",  serviceSDO1 );
-       account2.setBigDecimal("Balance", new BigDecimal("20.00"));
-       v.add(account2);
-       DataObject account3 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
-       account3.set("ID", "0000 3110 0020");
-       account3.set("Service",  serviceSDO3 );
-       account3.setBigDecimal("Balance", new BigDecimal("5000.00"));
-       v.add(account3);
-       branchSDO1.set("Account", v);
-       v.removeAllElements();
-       // Branch 2
-       branchSDO2.set("ID", "BR200");
-       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
-       addr.set("Street", "1207 Cash Court");
-       addr.set("City",  "Raleigh");
-       addr.set("State", "NC");
-       addr.set("Zip", "27701");
-       branchSDO2.set("Address", addr);
-       v.add("If you are east, head west");
-       v.add("If you are west, head east");
-       branchSDO2.set("Directions", v);
-       v.removeAllElements();
-       DataObject account4 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
-       account4.set("ID", "0000 0011 0001");
-       account4.set("Service",  serviceSDO1 );
-       account4.setBigDecimal("Balance", new BigDecimal("99.12"));
-       v.add(account4);
-       DataObject account5 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
-       account5.set("ID", "0000 9911 0001");
-       account5.set("Service",  serviceSDO2 );
-       account5.setBigDecimal("Balance", new BigDecimal("820.00"));
-       v.add(account5);
-       DataObject account6 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
-       account6.set("ID", "0000 0001 0020");
-       account6.set("Service",  serviceSDO3 );
-       account6.setBigDecimal("Balance", new BigDecimal("9000.00"));
-       v.add(account6);
-       branchSDO2.set("Account", v);
-       v.removeAllElements();
-       
-       // Populate Service Instances
-       serviceSDO1.set("ID", "SRV01");  
-       serviceSDO1.set("Name", "Checking");  
-       serviceSDO1.setBigDecimal("Fee", new BigDecimal("0.00"));
-       serviceSDO2.set("ID", "SRV02");  
-       serviceSDO2.set("Name", "Savings");  
-       serviceSDO2.setBigDecimal("Fee", new BigDecimal("0.00"));
-       serviceSDO3.set("ID", "SRV03");  
-       serviceSDO3.set("Name", "Loan");  
-       serviceSDO3.setBigDecimal("Fee", new BigDecimal("0.00"));
-       
-       // Populate Customer Instances
-       // Customer 1
-       customerSDO1.set("ID", "CUST01");  
-       customerSDO1.set("First", "James");  
-       customerSDO1.set("Last", "Madison");  
-       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
-       addr.set("Street", "1234 Easy Street");
-       addr.set("City",  "New York");
-       addr.set("State", "NY");
-       addr.set("Zip", "27511");
-       customerSDO1.set("Address", addr);
-       customerSDO1.set("HomeBranch", branchSDO1);
-       v.add(account1);
-       customerSDO1.set("Account", v);
-       v.removeAllElements();
-       v.add(customerSDO2);
-       v.add(customerSDO3);
-       customerSDO1.set("Related", v);
-       v.removeAllElements();
-       // Customer 2
-       customerSDO2.set("ID", "CUST02");  
-       customerSDO2.set("First", "George");  
-       customerSDO2.set("Last", "Washington");  
-       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
-       addr.set("Street", "1776 Potomac Avenue");
-       addr.set("City",  "Washington");
-       addr.set("State", "DC");
-       addr.set("Zip", "50555");
-       customerSDO2.set("Address", addr);
-       customerSDO2.set("HomeBranch", branchSDO1);
-       v.add(account2);
-       v.add(account3);
-       customerSDO2.set("Account", v);
-       v.removeAllElements();
-       // Customer 3
-       customerSDO3.set("ID", "CUST03");  
-       customerSDO3.set("First", "Thomas");  
-       customerSDO3.set("Last", "Jefferson");  
-       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
-       addr.set("Street", "1492 Columbus Avenue");
-       addr.set("City",  "Charlottesville");
-       addr.set("State", "VA");
-       addr.set("Zip", "20121");
-       customerSDO3.set("Address", addr);
-       customerSDO3.set("HomeBranch", branchSDO2);
-       v.add(account4);
-       customerSDO3.set("Account", v);
-       v.removeAllElements();
-       // Customer 4
-       customerSDO4.set("ID", "CUST04");  
-       customerSDO4.set("First", "Benjamin");  
-       customerSDO4.set("Last", "Franklin");  
-       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
-       addr.set("Street", "99 Light Street");
-       addr.set("City",  "Philadelphia");
-       addr.set("State", "PA");
-       addr.set("Zip", "19251");
-       customerSDO4.set("Address", addr);
-       customerSDO4.set("HomeBranch", branchSDO2);
-       v.add(account5);
-       v.add(account6);
-       customerSDO4.set("Account", v);
-       v.removeAllElements();
-       
-   }
-   
-   private void populateScopeWithDynamicTypes(TypeHelper scope)
-   {
-       Type stringType = scope.getType("commonj.sdo", "String");
-       DataObject customerType = DataFactory.INSTANCE.create("commonj.sdo", "Type");
-       customerType.set("uri", TEST_NAMESPACE);
-       customerType.set("name", DYNAMIC_TYPE );
-       DataObject custNumProperty = customerType.createDataObject("property");
-       custNumProperty.set("name", "custNum");
-       custNumProperty.set("type", stringType);
-       DataObject firstNameProperty = customerType.createDataObject("property");
-       firstNameProperty.set("name", "firstName");
-       firstNameProperty.set("type", stringType);
-       DataObject lastNameProperty = customerType.createDataObject("property");
-       lastNameProperty.set("name", "lastName");
-       lastNameProperty.set("type", stringType);
-       scope.define(customerType);
-   }
-   
-   /*
-   private void dumpObject(DataObject sdo, String node )
-   {
-       try 
-       {
-           ByteArrayOutputStream baos = new ByteArrayOutputStream();
-           SDOUtil.createXMLHelper(scopeA).save(sdo, TEST_NAMESPACE, 
-                                   node, baos);
-           System.out.println(baos.toString());
-       } 
-       catch (IOException e)
-       {
-           e.printStackTrace();
-       }
-   }  
-   */ 
-}
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tuscany.sdo.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Vector;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.CopyHelper;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+
+public class CrossScopeCopyTestCase extends TestCase 
+{
+   // Literals
+   private static final String TEST_NAMESPACE  = "http://www.example.com/bank";
+   private static final String BANK_MODEL      = "/bank.xsd";
+   private static final String BANK_TYPE       = "bankType";
+   private static final String BRANCH_TYPE     = "branchType";
+   private static final String SERVICE_TYPE    = "serviceType";
+   private static final String ACCOUNT_TYPE    = "accountType";
+   private static final String CUSTOMER_TYPE   = "customerType";
+   private static final String ADDRESS_TYPE    = "addressType";
+   private static final String DYNAMIC_TYPE    = "dynamicType";
+    
+   // SDO model objects
+   private HelperContext hca;
+   private HelperContext hcb;
+   private TypeHelper scopeA;
+   private TypeHelper scopeB;
+
+   // SDO instance objects
+   private DataObject bankSDO;
+   private DataObject branchSDO1;
+   private DataObject branchSDO2;
+   private DataObject serviceSDO1;
+   private DataObject serviceSDO2;
+   private DataObject serviceSDO3;
+   private DataObject customerSDO1;
+   private DataObject customerSDO2;
+   private DataObject customerSDO3;
+   private DataObject customerSDO4;
+    
+   private int indent = 0;
+    
+   public void testCrossScopeCopy() throws IOException 
+   {
+       CopyHelper copyHelperB = SDOUtil.createCrossScopeCopyHelper(hcb);
+       
+       // Perform Shallow Copy Test 
+       DataObject copiedSDO = copyHelperB.copyShallow(bankSDO);
+       shallowCopyAssertions(bankSDO, copiedSDO);
+       
+       // Perform Deep Copy Test
+       copiedSDO = copyHelperB.copy(bankSDO);
+       deepCopyAssertions(bankSDO, copiedSDO);
+       
+       // Inter-Reference Copy
+       copiedSDO = copyHelperB.copy(customerSDO1);
+       DataObject prop = (DataObject)copiedSDO.get("HomeBranch");
+       assertTrue(prop==null);
+       
+       // Perform invalid namespace test
+       DataObject sdo = hca.getDataFactory().create(TEST_NAMESPACE, DYNAMIC_TYPE );
+       sdo.set("custNum", "099" );
+       sdo.set("firstName", "John");
+       sdo.set("lastName", "Doe");
+       boolean failed = false;
+       try
+       {
+           // In this case, we are copying an object to a scope 
+           // where the object's type has not been defined.  That
+           // will generate a null pointer exception what we will 
+           // catch.
+           copyHelperB.copy(sdo);
+       }
+       catch(java.lang.NullPointerException ex)
+       {
+           failed = true;
+       }
+       assertTrue(failed);
+   }
+
+   protected void setUp() throws Exception 
+   {
+       super.setUp();
+
+       // Create Two Scopes
+       hca = SDOUtil.createHelperContext();
+       hcb = SDOUtil.createHelperContext();
+       scopeA = hca.getTypeHelper();
+       scopeB = hcb.getTypeHelper();
+          
+       // Populate scopes with bank model now
+       URL url = getClass().getResource(BANK_MODEL);
+       InputStream inputStream = url.openStream();
+       hca.getXSDHelper().define(inputStream, url.toString());
+       inputStream.close();
+       inputStream = url.openStream();
+       hcb.getXSDHelper().define(inputStream, url.toString());
+       inputStream.close();
+
+       // Now Populate scopeA with some dynamic models
+       populateScopeWithDynamicTypes(scopeA);
+       
+       // Construct Source Tree
+       constructSourceTree(hca.getDataFactory());
+   }   
+
+   private void shallowCopyAssertions(DataObject sdo, DataObject copiedSdo)
+   {
+       assertEquals(sdo.getType().getName(), copiedSdo.getType().getName());
+       assertEquals(sdo.getType().getURI(), copiedSdo.getType().getURI());
+       assertNotSame(sdo.getType(), copiedSdo.getType());
+       assertEquals(sdo.getInstanceProperties().size(), copiedSdo
+                    .getInstanceProperties().size());
+
+       for(Iterator it = sdo.getInstanceProperties().iterator(), it2 = copiedSdo
+           .getInstanceProperties().iterator(); it.hasNext();)
+       {
+           Property p1 = (Property) it.next(), p2 = (Property) it2.next();
+           assertEquals(p1.getName(), p2.getName());
+           Object o1 = sdo.get(p1), o2 = copiedSdo.get(p2);
+           if(p1.getType().isDataType())
+           {
+               assertEquals(o1, o2);
+               // TODO is there a way I can distinguish between mutable and
+               // immutable types
+               // so that I can do some "same object" tests
+           }
+           else
+           {
+               assertNotSame(p1, p2);
+               if(p2.isMany())
+               {
+                   assertEquals(copiedSdo.getList(p2).size(), 0);
+               }
+               else
+               {
+                   assertNull(copiedSdo.get(p2));
+               }
+           }
+           try
+           {
+               sdo.get(p2);
+               assertTrue(false);
+           }
+           catch(Exception e)
+           {
+               // expected route
+           }
+           try
+           {
+               copiedSdo.get(p1);
+               assertTrue(false);
+           }
+           catch(Exception e2)
+           {
+               // expected route
+           }
+       }
+   }
+   
+   private void deepCopyAssertions(DataObject sdo, DataObject copiedSdo)
+   {
+       //indent();
+       
+       //System.out.println("checking objects of types: "
+       //                   + sdo.getType().getName() + ", "
+       //                   + copiedSdo.getType().getName());
+       indent++;
+
+       assertEquals(sdo.getType().getName(), copiedSdo.getType().getName());
+       assertEquals(sdo.getType().getURI(), copiedSdo.getType().getURI());
+       assertNotSame(sdo.getType(), copiedSdo.getType());
+       assertEquals(sdo.getInstanceProperties().size(), copiedSdo
+                    .getInstanceProperties().size());
+
+       for(Iterator it = sdo.getInstanceProperties().iterator(), it2 = copiedSdo
+           .getInstanceProperties().iterator(); it.hasNext();)
+       {
+           Property p1 = (Property) it.next(), p2 = (Property) it2.next();
+           assertEquals(p1.getName(), p2.getName());
+           Object o1 = sdo.get(p1), o2 = copiedSdo.get(p2);
+           if(p1.getType().isDataType())
+           {
+               assertEquals(o1, o2);
+               // TODO is there a way I can distinguish between mutable and
+               // immutable types
+               // so that I can do some "same object" tests
+           }
+           else
+           {
+               assertNotSame(p1, p2);
+               if(p2.isMany())
+               {
+                   assertEquals(sdo.getList(p1).size(), copiedSdo.getList(p2)
+                                .size());
+                   for(Iterator it3 = sdo.getList(p1).iterator(), it4 = copiedSdo
+                       .getList(p2).iterator(); it3.hasNext();)
+                   {
+                       deepCopyAssertions((DataObject) it3.next(),
+                                          (DataObject) it4.next());
+                   }
+               }
+               else
+               {
+                   deepCopyAssertions(sdo.getDataObject(p1), copiedSdo
+                                      .getDataObject(p2));
+               }
+           }
+           try
+           {
+               sdo.get(p2);
+               assertTrue(false);
+           }
+           catch(Exception e)
+           {
+               // expected route
+           }
+           try
+           {
+               copiedSdo.get(p1);
+               assertTrue(false);
+           }
+           catch(Exception e2)
+           {
+               // expected route
+           }
+       }
+
+       indent--;
+   }
+
+   /*
+   private void indent()
+   {
+       for(int i=0; i <indent; i++) System.out.print(" ");
+   }
+   */   
+   
+   protected void constructSourceTree(DataFactory df)
+   {
+       // Create Instances
+       bankSDO      = df.create(TEST_NAMESPACE, BANK_TYPE );
+       branchSDO1   = df.create(TEST_NAMESPACE, BRANCH_TYPE );  
+       branchSDO2   = df.create(TEST_NAMESPACE, BRANCH_TYPE );  
+       serviceSDO1  = df.create(TEST_NAMESPACE, SERVICE_TYPE );  
+       serviceSDO2  = df.create(TEST_NAMESPACE, SERVICE_TYPE );  
+       serviceSDO3  = df.create(TEST_NAMESPACE, SERVICE_TYPE );  
+       customerSDO1 = df.create(TEST_NAMESPACE, CUSTOMER_TYPE );  
+       customerSDO2 = df.create(TEST_NAMESPACE, CUSTOMER_TYPE );  
+       customerSDO3 = df.create(TEST_NAMESPACE, CUSTOMER_TYPE );  
+       customerSDO4 = df.create(TEST_NAMESPACE, CUSTOMER_TYPE );  
+       
+       // Populate the Bank Instance
+       bankSDO.set("name", "Fourth National");
+       Vector v = new Vector();
+       v.add(branchSDO1);
+       v.add(branchSDO2);
+       bankSDO.set("Branch",v);
+       v.removeAllElements();
+       v.add(serviceSDO1);
+       v.add(serviceSDO2);
+       v.add(serviceSDO3);
+       bankSDO.set("Service",v);
+       v.removeAllElements();
+       v.add(customerSDO1);
+       v.add(customerSDO2);
+       v.add(customerSDO3);
+       v.add(customerSDO4);
+       bankSDO.set("Customer",v);
+       v.removeAllElements();
+       
+       // Populate Branch Instances
+       // Branch 1
+       branchSDO1.set("ID", "BR100");
+       DataObject addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
+       addr.set("Street", "1302 Money Street");
+       addr.set("City",   "Apex");
+       addr.set("State", "NC");
+       addr.set("Zip", "27502");
+       branchSDO1.set("Address", addr);
+       v.add("If you are north, head south");
+       v.add("If you are south, head north");
+       branchSDO1.set("Directions", v);
+       v.removeAllElements();
+       DataObject account1 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
+       account1.set("ID", "0000 1200 0001");
+       account1.set("Service",  serviceSDO1 );
+       account1.setBigDecimal("Balance", new BigDecimal("3124.12"));
+       v.add(account1);
+       DataObject account2 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
+       account2.set("ID", "0000 8899 0001");
+       account2.set("Service",  serviceSDO1 );
+       account2.setBigDecimal("Balance", new BigDecimal("20.00"));
+       v.add(account2);
+       DataObject account3 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
+       account3.set("ID", "0000 3110 0020");
+       account3.set("Service",  serviceSDO3 );
+       account3.setBigDecimal("Balance", new BigDecimal("5000.00"));
+       v.add(account3);
+       branchSDO1.set("Account", v);
+       v.removeAllElements();
+       // Branch 2
+       branchSDO2.set("ID", "BR200");
+       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
+       addr.set("Street", "1207 Cash Court");
+       addr.set("City",  "Raleigh");
+       addr.set("State", "NC");
+       addr.set("Zip", "27701");
+       branchSDO2.set("Address", addr);
+       v.add("If you are east, head west");
+       v.add("If you are west, head east");
+       branchSDO2.set("Directions", v);
+       v.removeAllElements();
+       DataObject account4 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
+       account4.set("ID", "0000 0011 0001");
+       account4.set("Service",  serviceSDO1 );
+       account4.setBigDecimal("Balance", new BigDecimal("99.12"));
+       v.add(account4);
+       DataObject account5 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
+       account5.set("ID", "0000 9911 0001");
+       account5.set("Service",  serviceSDO2 );
+       account5.setBigDecimal("Balance", new BigDecimal("820.00"));
+       v.add(account5);
+       DataObject account6 = df.create(TEST_NAMESPACE, ACCOUNT_TYPE );
+       account6.set("ID", "0000 0001 0020");
+       account6.set("Service",  serviceSDO3 );
+       account6.setBigDecimal("Balance", new BigDecimal("9000.00"));
+       v.add(account6);
+       branchSDO2.set("Account", v);
+       v.removeAllElements();
+       
+       // Populate Service Instances
+       serviceSDO1.set("ID", "SRV01");  
+       serviceSDO1.set("Name", "Checking");  
+       serviceSDO1.setBigDecimal("Fee", new BigDecimal("0.00"));
+       serviceSDO2.set("ID", "SRV02");  
+       serviceSDO2.set("Name", "Savings");  
+       serviceSDO2.setBigDecimal("Fee", new BigDecimal("0.00"));
+       serviceSDO3.set("ID", "SRV03");  
+       serviceSDO3.set("Name", "Loan");  
+       serviceSDO3.setBigDecimal("Fee", new BigDecimal("0.00"));
+       
+       // Populate Customer Instances
+       // Customer 1
+       customerSDO1.set("ID", "CUST01");  
+       customerSDO1.set("First", "James");  
+       customerSDO1.set("Last", "Madison");  
+       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
+       addr.set("Street", "1234 Easy Street");
+       addr.set("City",  "New York");
+       addr.set("State", "NY");
+       addr.set("Zip", "27511");
+       customerSDO1.set("Address", addr);
+       customerSDO1.set("HomeBranch", branchSDO1);
+       v.add(account1);
+       customerSDO1.set("Account", v);
+       v.removeAllElements();
+       v.add(customerSDO2);
+       v.add(customerSDO3);
+       customerSDO1.set("Related", v);
+       v.removeAllElements();
+       // Customer 2
+       customerSDO2.set("ID", "CUST02");  
+       customerSDO2.set("First", "George");  
+       customerSDO2.set("Last", "Washington");  
+       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
+       addr.set("Street", "1776 Potomac Avenue");
+       addr.set("City",  "Washington");
+       addr.set("State", "DC");
+       addr.set("Zip", "50555");
+       customerSDO2.set("Address", addr);
+       customerSDO2.set("HomeBranch", branchSDO1);
+       v.add(account2);
+       v.add(account3);
+       customerSDO2.set("Account", v);
+       v.removeAllElements();
+       // Customer 3
+       customerSDO3.set("ID", "CUST03");  
+       customerSDO3.set("First", "Thomas");  
+       customerSDO3.set("Last", "Jefferson");  
+       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
+       addr.set("Street", "1492 Columbus Avenue");
+       addr.set("City",  "Charlottesville");
+       addr.set("State", "VA");
+       addr.set("Zip", "20121");
+       customerSDO3.set("Address", addr);
+       customerSDO3.set("HomeBranch", branchSDO2);
+       v.add(account4);
+       customerSDO3.set("Account", v);
+       v.removeAllElements();
+       // Customer 4
+       customerSDO4.set("ID", "CUST04");  
+       customerSDO4.set("First", "Benjamin");  
+       customerSDO4.set("Last", "Franklin");  
+       addr = df.create(TEST_NAMESPACE, ADDRESS_TYPE );
+       addr.set("Street", "99 Light Street");
+       addr.set("City",  "Philadelphia");
+       addr.set("State", "PA");
+       addr.set("Zip", "19251");
+       customerSDO4.set("Address", addr);
+       customerSDO4.set("HomeBranch", branchSDO2);
+       v.add(account5);
+       v.add(account6);
+       customerSDO4.set("Account", v);
+       v.removeAllElements();
+       
+   }
+   
+   private void populateScopeWithDynamicTypes(TypeHelper scope)
+   {
+       Type stringType = scope.getType("commonj.sdo", "String");
+       DataObject customerType = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+       customerType.set("uri", TEST_NAMESPACE);
+       customerType.set("name", DYNAMIC_TYPE );
+       DataObject custNumProperty = customerType.createDataObject("property");
+       custNumProperty.set("name", "custNum");
+       custNumProperty.set("type", stringType);
+       DataObject firstNameProperty = customerType.createDataObject("property");
+       firstNameProperty.set("name", "firstName");
+       firstNameProperty.set("type", stringType);
+       DataObject lastNameProperty = customerType.createDataObject("property");
+       lastNameProperty.set("name", "lastName");
+       lastNameProperty.set("type", stringType);
+       scope.define(customerType);
+   }
+   
+   /*
+   private void dumpObject(DataObject sdo, String node )
+   {
+       try 
+       {
+           ByteArrayOutputStream baos = new ByteArrayOutputStream();
+           SDOUtil.createXMLHelper(scopeA).save(sdo, TEST_NAMESPACE, 
+                                   node, baos);
+           System.out.println(baos.toString());
+       } 
+       catch (IOException e)
+       {
+           e.printStackTrace();
+       }
+   }  
+   */ 
+}

Propchange: tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/CrossScopeCopyTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native