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 2007/01/08 14:34:59 UTC

svn commit: r494066 [2/6] - in /incubator/tuscany/java/cts: ./ sdo2.1/ sdo2.1/src/ sdo2.1/src/main/ sdo2.1/src/main/java/ sdo2.1/src/main/java/test/ sdo2.1/src/main/java/test/sdo21/ sdo2.1/src/main/java/test/sdo21/framework/ sdo2.1/src/main/java/test/s...

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DateConversionScenario.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DateConversionScenario.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DateConversionScenario.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DateConversionScenario.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,442 @@
+/**
+ *
+ *  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 test.sdo21.scenarios;
+
+import java.lang.reflect.Method;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import test.sdo21.framework.ExpectedConditionError;
+import test.sdo21.framework.ReturnValueError;
+import commonj.sdo.helper.DataHelper;
+
+/**
+ * DateConversionTestCase insures that the DataHelper conversions accurately retain the information in the specified 
+ * fields (e.g. month, day or year).  It also provides coverage for the DataHelper API.  Note that toDate is called each 
+ * time Test.initialize() is called.
+ */
+
+public class DateConversionScenario 
+{
+    private static Calendar test_calendar;
+    private static Date test_date;
+    private static DataHelper data_helper;
+    
+    private static final TestType TO_DATE_TIME = new TestType("toDateTime", new int [] {Calendar.YEAR, Calendar.MONTH, 
+            Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND});
+    private static final TestType TO_DURATION = new TestType("toDuration", new int [] {Calendar.YEAR, Calendar.MONTH, 
+            Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND});
+    private static final TestType TO_TIME = new TestType("toTime", new int [] {Calendar.HOUR_OF_DAY, Calendar.MINUTE, 
+            Calendar.SECOND, Calendar.MILLISECOND});
+    private static final TestType TO_DAY = new TestType("toDay", new int[] {Calendar.DAY_OF_MONTH});
+    private static final TestType TO_MONTH = new TestType("toMonth", new int[] {Calendar.MONTH});
+    private static final TestType TO_MONTH_DAY = new TestType("toMonthDay", new int[] {Calendar.MONTH, Calendar.DAY_OF_MONTH});
+    private static final TestType TO_YEAR = new TestType("toYear", new int[] {Calendar.YEAR});
+    private static final TestType TO_YEAR_MONTH= new TestType("toYearMonth",  new int[] {Calendar.YEAR, Calendar.MONTH});
+    private static final TestType TO_YEAR_MONTH_DAY = new TestType("toYearMonthDay",  new int[] {Calendar.YEAR, 
+            Calendar.MONTH, Calendar.DAY_OF_MONTH});    
+    
+    /**
+     * testDateConversions is used to test the DataHelper API.  This method calls each of the 
+     * testConversionsFrom____() private methods.  Collectively, these methods verify that each of the 
+     * permitted conversions using the DataHelper provide accurate results.
+     * @throws Exception
+     */
+    public static void testDateConversions() throws Exception
+    {
+    	DateConversionScenario tests = new DateConversionScenario();
+    	
+    	tests.testConversionsFromDay();
+    	tests.testConversionsFromDate();
+    	tests.testConversionsFromDateTime();
+    	tests.testConversionsFromDuration();
+    	tests.testConversionsFromMonth();
+    	tests.testConversionsFromMonthDay();
+    	tests.testConversionsFromTime();
+    	tests.testConversionsFromYear();
+    	tests.testConversionsFromYearMonth();
+    	tests.testConversionsFromYearMonthDay();
+    	tests.testToDateFormats();
+    }
+    
+    public DateConversionScenario() throws Exception
+    {
+        data_helper = DataHelper.INSTANCE;
+        test_calendar = new GregorianCalendar();
+        test_calendar.setTime(new Date(System.currentTimeMillis()));
+        test_date = test_calendar.getTime();  
+    }
+    
+    private static class TestType
+    {
+        private static final Class[] DATE_CLASS_ARRAY = {Date.class};
+        private static final Class[] CALENDAR_CLASS_ARRAY = {Calendar.class};
+        
+        Method date_method;
+        Method calendar_method;
+        int [] compare_fields;  
+        
+        public TestType (String method_name, int [] compare_fields)
+        {
+            try
+            {
+                this.date_method = DataHelper.class.getMethod(method_name, DATE_CLASS_ARRAY);
+            }
+            catch (NoSuchMethodException e)
+            {
+                this.date_method = null;
+            }
+                
+            this.compare_fields = compare_fields;    
+            try
+            {
+                this.calendar_method = DataHelper.class.getMethod(method_name, CALENDAR_CLASS_ARRAY);
+            }
+            catch (NoSuchMethodException e)
+            {
+                this.calendar_method = null;
+            }
+
+        }
+        
+        public Method getDateMethod()
+        {
+            return this.date_method;
+        }
+        
+        public Method getCalendarMethod()
+        {
+            return this.calendar_method;
+        }
+    }
+    
+    private static class Test
+    {
+        String from_type;
+        Date from_date;    
+        Calendar from_calendar;
+        Class expected_exception;
+        
+        public Test ()
+        {
+            this.from_date = null;
+            this.from_calendar = null;
+            expected_exception = null;
+        }
+        
+        public void initialize (TestType from_type)
+        {            
+            this.from_type = from_type.getDateMethod().getName();
+            
+            try
+            {    
+                String date_string = (String) from_type.getDateMethod().invoke(data_helper, new Object[] {test_date});
+                this.from_date = data_helper.toDate(date_string);
+                date_string = (String) from_type.getCalendarMethod().invoke(data_helper, new Object[] {test_calendar});
+                this.from_calendar = data_helper.toCalendar(date_string);
+            }
+            catch (Exception e)
+            {
+                this.from_date = null;
+                this.from_calendar = null;
+            }
+            
+        }
+        
+        // This method is needed because there is not a toDate(Date) method in DataHelper.
+        
+        private void initializeToDate()
+        {
+            this.from_calendar = test_calendar;
+            this.from_date = test_date;
+            this.from_type = "toDate";
+        }
+        
+        private void attemptConversion (TestType to_type) throws Exception
+        {
+            executeConversion(to_type.getDateMethod(), new Object[] {this.from_date}, to_type.compare_fields);
+            executeConversion(to_type.getCalendarMethod(), new Object[] {this.from_calendar}, to_type.compare_fields);
+        }
+        
+        private void executeConversion (Method conversion, Object[] parm, int [] compare_fields) throws Exception
+        {
+            String result;
+            
+            try
+            {
+                result = (String) conversion.invoke(data_helper, parm);
+            }
+            catch (Exception e)
+            {
+                System.err.println("An unexpected exception was thrown while calling " + conversion.getName() + 
+                        " after initializing with " + this.from_type + ".");
+                throw e;
+            }
+
+            if (compareFields(parm[0], result, compare_fields) != true)
+            	throw new ExpectedConditionError("The expected value did not result when calling " + conversion.getName() + 
+                        " after initializing with " + this.from_type + ".");
+        }
+        
+        private boolean compareFields(Object compare_to, String output, int [] compare_fields)
+        {
+            Calendar result = data_helper.toCalendar(output);
+            Calendar expected;
+            
+            if (compare_to instanceof Calendar)
+                expected = (GregorianCalendar) test_calendar;
+            else
+            {
+                expected = new GregorianCalendar();
+                expected.setTime((Date) test_date);
+            }
+            
+            for (int i = 0; i < compare_fields.length; i++)
+            {
+                if (expected.get(compare_fields[i]) != result.get(compare_fields[i]))
+                   return false;
+            }
+            return true;
+        }
+        
+    }
+
+    /**
+     * testConversionsFromDay verifies each of the conversions from Day using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromDay() throws Exception
+    {
+        Test FromDay = new Test();
+        
+        FromDay.initialize(TO_DAY);
+        
+        FromDay.attemptConversion(TO_DAY);
+    }
+
+    /**
+     * testConversionsFromDate verifies each of the conversions from Date using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromDate() throws Exception
+    {
+        Test FromDate = new Test();
+        
+        FromDate.initializeToDate();
+        
+        FromDate.attemptConversion(TO_DATE_TIME);
+        FromDate.attemptConversion(TO_DURATION);
+        FromDate.attemptConversion(TO_TIME);
+        FromDate.attemptConversion(TO_DAY);
+        FromDate.attemptConversion(TO_MONTH);
+        FromDate.attemptConversion(TO_MONTH_DAY);
+        FromDate.attemptConversion(TO_YEAR);
+        FromDate.attemptConversion(TO_YEAR_MONTH);
+        FromDate.attemptConversion(TO_YEAR_MONTH_DAY);           
+    }
+  
+    /**
+     * testConversionsFromDateTime verifies each of the conversions from DateTime using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromDateTime() throws Exception
+    {
+        Test FromDateTime = new Test();
+        
+        FromDateTime.initialize(TO_DATE_TIME);
+
+        FromDateTime.attemptConversion(TO_DATE_TIME);
+        FromDateTime.attemptConversion(TO_DURATION);
+        FromDateTime.attemptConversion(TO_TIME);
+        FromDateTime.attemptConversion(TO_DAY);
+        FromDateTime.attemptConversion(TO_MONTH);
+        FromDateTime.attemptConversion(TO_MONTH_DAY);
+        FromDateTime.attemptConversion(TO_YEAR);
+        FromDateTime.attemptConversion(TO_YEAR_MONTH);
+        FromDateTime.attemptConversion(TO_YEAR_MONTH_DAY);            
+    }
+    
+    /**
+     * testConversionsFromDuration verifies each of the conversions from Duration using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromDuration() throws Exception
+    {
+        Test FromDuration = new Test();
+        
+        FromDuration.initialize(TO_DURATION);
+
+        FromDuration.attemptConversion(TO_DURATION);
+        FromDuration.attemptConversion(TO_DATE_TIME);
+        FromDuration.attemptConversion(TO_TIME);
+        FromDuration.attemptConversion(TO_DAY);
+        FromDuration.attemptConversion(TO_MONTH);
+        FromDuration.attemptConversion(TO_MONTH_DAY);
+        FromDuration.attemptConversion(TO_YEAR);
+        FromDuration.attemptConversion(TO_YEAR_MONTH);
+        FromDuration.attemptConversion(TO_YEAR_MONTH_DAY);                   
+    }
+    
+    /**
+     * testConversionsFromMonth verifies each of the conversions from Month using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromMonth() throws Exception
+    {
+        Test FromMonth = new Test();
+        
+        FromMonth.initialize(TO_MONTH);
+
+        FromMonth.attemptConversion(TO_MONTH);           
+    } 
+    
+    /**
+     * testConversionsFromMonthDay verifies each of the conversions from MonthDay using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromMonthDay() throws Exception
+    {
+        Test FromMonthDay = new Test();
+        
+        FromMonthDay.initialize(TO_MONTH_DAY);
+        FromMonthDay.attemptConversion(TO_MONTH_DAY);
+        FromMonthDay.attemptConversion(TO_MONTH);
+        FromMonthDay.attemptConversion(TO_DAY);       
+    } 
+
+    /**
+     * testConversionsFromTime verifies each of the conversions from Time using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromTime() throws Exception
+    {
+        Test FromTime = new Test();
+        
+        FromTime.initialize(TO_TIME);
+
+        FromTime.attemptConversion(TO_TIME);     
+    } 
+    
+    /**
+     * testConversionsFromYear verifies each of the conversions from Year using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromYear() throws Exception
+    {
+        Test FromYear = new Test();
+
+        FromYear.initialize(TO_YEAR);
+
+        FromYear.attemptConversion(TO_YEAR);         
+    } 
+ 
+    /**
+     * testConversionsFromYearMonth verifies each of the conversions from YearMonth using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromYearMonth() throws Exception
+    {
+        Test FromYearMonth = new Test();
+        
+        FromYearMonth.initialize(TO_YEAR_MONTH);
+
+        FromYearMonth.attemptConversion(TO_YEAR_MONTH);
+        FromYearMonth.attemptConversion(TO_MONTH);
+        FromYearMonth.attemptConversion(TO_YEAR);       
+    } 
+    
+    /**
+     * testConversionsFromYearMonthDay verifies each of the conversions from YearMonthDay using the DataHelper
+     * @throws Exception
+     */
+    
+    private void testConversionsFromYearMonthDay() throws Exception
+    {
+        Test FromYearMonthDay = new Test();
+        
+        FromYearMonthDay.initialize(TO_YEAR_MONTH_DAY);
+
+        FromYearMonthDay.attemptConversion(TO_YEAR_MONTH_DAY);
+        FromYearMonthDay.attemptConversion(TO_YEAR_MONTH);
+        FromYearMonthDay.attemptConversion(TO_MONTH_DAY);
+        FromYearMonthDay.attemptConversion(TO_YEAR);        
+        FromYearMonthDay.attemptConversion(TO_MONTH);
+        FromYearMonthDay.attemptConversion(TO_DAY);      
+    } 
+
+    /**
+     * testToDateFormats verifies that strings that should be recognized by toDate do not 
+     * result in a null Date value when passed to DataHelper.toDate(String).
+     * @throws Exception
+     */
+    
+    private void testToDateFormats() throws Exception
+    {
+        String[] validStrings = 
+        {
+            "2006-03-31T03:30:45.123Z",
+            "-2006-03-31T03:30:45.1Z",
+            "2006-03-31T03:30:45Z",
+            "2006-03-31T03:30:45.123",
+            "2006-03-31T03:30:45.1",
+            "-2006-03-31T03:30:45",
+            "2006-03-31T03:30:45.123 EDT",
+            "2006-03-31T03:30:45.1 EDT",
+            "2006-03-31T03:30:45 EDT",
+            "---05 PST",
+            "---04",
+            "--12 GMT",
+            "--12",
+            "--08-08 EST",
+            "--08-08",
+            "1976-08-08 PDT",
+            "1976-08-08",
+            "88-12 CST",
+            "1988-12",
+            "2005 CDT",
+            "1999",
+            "P2006Y 08M 10D T 12H 24M 07S",
+            "P2006Y 10D T 12H",
+            "-P2006Y 08M 10D T 07S.2",
+            "P08M 10D T 07H",
+            "-P 04M 10DT12H 24S.88",
+            "PT12H"
+        };
+        
+        for (int i = 0; i < validStrings.length; i++)
+        {
+        	if (data_helper.toDate(validStrings[i]) == null)
+        	   throw new  ReturnValueError("DataHelper.toData() should not return null for '" + validStrings[i] + "'.");
+        }
+
+    }
+    
+}
+

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DateConversionScenario.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DateConversionScenario.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DeleteScenario.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DeleteScenario.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DeleteScenario.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DeleteScenario.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,69 @@
+package test.sdo21.scenarios;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import test.sdo21.framework.ExpectedConditionError;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+
+public class DeleteScenario
+{
+    /**
+     * testRecursiveDeletion verifies that when a DataObject is deleted, all (recursively) contained 
+     * DataObjects are also deleted.
+     * @param testDO
+     */
+	
+    public static void testRecursiveDeletion (DataObject testDO)
+    {
+    	Type type = testDO.getType();
+    	Property containmentProp = type.getProperty("children");
+    	
+    	if (!(containmentProp.isContainment()))
+    		throw new ExpectedConditionError("Cannot continue with test because Property.isContainment() is false.");
+    	
+    	DataObject child1 = DataFactory.INSTANCE.create(type);
+    	DataObject child2 = DataFactory.INSTANCE.create(type);
+    	DataObject child3 = DataFactory.INSTANCE.create(type);
+    	
+    	List addList = new ArrayList();
+    	
+    	/**
+    	 * Establish a series of containment relationships
+    	 */
+    	
+    	addList.add(child1);
+    	testDO.setList(containmentProp, addList);
+    	
+    	addList.clear();
+    	addList.add(child2);
+    	child1.setList(containmentProp, addList);
+    	
+    	addList.clear();
+    	addList.add(child3);
+    	child2.setList(containmentProp, addList);
+    	
+    	/**
+    	 * Verify that containment has been established correctly.
+    	 */
+    	
+    	if (!(child3.getContainer().equals(child2)) || !(child2.getContainer().equals(child1)) || !(child1.getContainer().equals(testDO)))
+    		throw new ExpectedConditionError("The expected containment relationships were not correctly formed.");
+    		
+    	/**
+    	 * Delete the root DataObject and verify that contained DataObjects are recursively affected.
+    	 */
+    	
+    	testDO.delete();
+    	
+    	if (testDO.getList(containmentProp).size() != 0
+    			|| child1.getContainer() != null
+    			|| child2.getContainer() != null
+    			|| child3.getContainer() != null)
+    		throw new ExpectedConditionError("DataObject.delete() did not recursively affect contained DataObjects.");
+    }
+}
\ No newline at end of file

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DeleteScenario.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/DeleteScenario.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/FVTUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/FVTUtil.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/FVTUtil.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/FVTUtil.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,237 @@
+package test.sdo21.scenarios;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import test.sdo21.framework.ExpectedConditionError;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+
+public class FVTUtil 
+{
+	public final static String TEST_TYPE = "APITest";
+    public final static String TEST_MODEL = "/api_test.xsd";
+    public final static String TEST_NAMESPACE = "http://www.example.com/api_test";
+    public final static String DATA_XML = "/api_test_full.xml";
+    
+    /**
+     * populateFields uses set<Type> to set each of the fields in the DataObject.
+     * It is used to ensure a known set of expected values that are not other than
+     * the default values for the various fields.
+     * @param testDO
+     * @throws ExpectedConditionError 
+     */
+    public static void populateFields (DataObject testDO)
+    {
+        testDO.setString("stringVal", "String 1");
+        testDO.setBoolean("booleanVal", true);     
+        testDO.setBoolean("booleanVal2", false);        
+        testDO.setByte("byteVal", (byte) -127); 
+        testDO.setString("stringVal2", "Second string!");
+        testDO.setBigDecimal("decimalVal", new BigDecimal(-3.00003));
+        testDO.setBigDecimal("decimalVal2", new BigDecimal(18883.999999));
+        testDO.setInt("intVal", (int) 33333);
+        testDO.setFloat("floatVal", (float) 0.88881);
+        testDO.setDouble("doubleVal", (double) 119.13813);
+        testDO.setDate("dateVal", new Date(System.currentTimeMillis()));
+        testDO.setShort("shortVal", (short) -800);
+        testDO.setLong("longVal", (long) 88881113);
+        List children = new ArrayList();     
+        children.add(DataFactory.INSTANCE.create(testDO.getType()));
+        testDO.setList("children", children);
+        testDO.setBytes("bytesVal", new byte[] {120, 80, -40});
+        testDO.setBigInteger("integerVal", new BigInteger("88819313"));
+        testDO.setChar("charVal", '*');
+        testDO.setDataObject("sequencedElem", DataFactory.INSTANCE.create(TypeHelper.INSTANCE.getType(FVTUtil.TEST_NAMESPACE, "Sequenced")));
+//        testDO.setDate("xsdDate", new Date(System.currentTimeMillis()));
+    }
+    
+    /**
+     * serializeDataObject is a private method to be called by the other 
+     * methods in the ScrenarioLibrary
+     * @param dataObject
+     * @param fileName
+     * @throws IOException
+     */
+    public static void serializeDataObject (DataObject dataObject, String fileName) throws IOException
+    {
+    	FileOutputStream fos = new FileOutputStream(fileName);
+    	ObjectOutputStream out = new ObjectOutputStream(fos);
+    	out.writeObject(dataObject);
+    	out.close();
+    }
+    
+    /**
+     * deserializeDataObject is a private method to be called by the other 
+     * methods in the ScrenarioLibrary
+     * @param fileName
+     * @return
+     * @throws IOException
+     * @throws ClassNotFoundException
+     */
+    public static DataObject deserializeDataObject (String fileName) throws IOException, ClassNotFoundException
+    {
+    	FileInputStream fis = new FileInputStream(fileName);
+    	ObjectInputStream input = new ObjectInputStream(fis);
+    	DataObject dataObject = (DataObject) input.readObject();
+    	input.close();
+    	return dataObject;
+    }
+    
+    /**
+     * clearDataObject is used to restore all fields to their default values
+     * @param dataObject
+     */
+    public static void clearDataObject (DataObject dataObject)
+    {
+    	List properties = dataObject.getInstanceProperties();
+    	
+    	for (int i = 0, size = properties.size(); i < size; i++)
+    	{
+    		dataObject.unset(i);
+    	}
+    }
+        
+    /**
+     * printDataObject is provided to aid in troubleshooting
+     * @param dataObject
+     * @param indent
+     */
+    public static void printDataObject (DataObject dataObject, int indent)
+    {
+    	// For each property
+    
+    	List properties = dataObject.getInstanceProperties();
+    	for (int i = 0, size = properties.size(); i < size; i++)
+    	{  
+    		if (dataObject.isSet(i))
+    		{
+    			Property property = (Property) properties.get(i);
+    			if (property.isMany())
+    			{
+    				// For many-valued properties, process a list of values
+    				List values =  dataObject.getList(i);
+    				for (int j = 0, count = values.size(); j < count; j++)
+    					printValue(values.get(j), property, indent);   
+    			}
+    			else
+    			{
+    				// for single-valued properties, print out the value
+    				printValue(dataObject.get(i), property, indent);
+    			}
+    		}
+    	}
+    }
+    
+    /**
+     * areEqualTypes is used to determine of two Types are equivalent even if not identically equal.
+     * The names of the Types are compared, as well as the Types of each of the Properties making up the Type.
+     * @param type1
+     * @param type2
+     * @return
+     */   
+    public static boolean areEqualTypes(Type type1, Type type2)
+    {
+    	List properties1, properties2;
+    	Property property1, property2;
+    	int size = 0, j = 0, k;
+    	boolean found;
+    	
+    	// Equivalent Types have the same name
+    	
+    	if (!(type1.getName().equals(type2.getName())))
+    		return false;
+
+    	// Equivalent Types have the same number of Properties
+    	
+    	properties1 = type1.getProperties();
+    	properties2 = type2.getProperties();
+    	size = properties1.size();
+    	
+    	if (size != properties2.size())
+    		return false;
+    	
+    	// Equivalent Types have Properties of the same name and Type
+    	
+    	for (int i = 0; i < size; i++)
+    	{
+    		property1 = (Property) properties1.get(i);
+    		k = 0;
+    		found = false;
+    		
+    		while (k  < size && !found)
+    		{
+    			// j is used to prevent the initial Properties in properties2 from being checked every time
+    			// j is particularly useful when the Types have Properties in the order
+    			
+    			property2 = (Property) properties2.get((k + j) % size);
+
+    			if (property1.getName().equals(property2.getName()))
+    			{  				
+    				j++;
+    				found = true;
+    				
+    				// Should not use recursion here to compare the Types of the Properties, because
+    				// it is possible that a Type may recursively contain itself.
+    				
+    	    		if (!(property1.getType().getName().equals(property2.getType().getName())))
+    	    	        return false;
+    			}
+    			
+   			    k++;
+    		}
+    		
+    		if (!found)
+    			return false;
+    	}
+    	
+    	return true;
+    }
+    
+    /**
+     * printValue is a private method which is called by printDataObject
+     * @param value
+     * @param property
+     * @param indent
+     */
+    private static void printValue (Object value, Property property, int indent)
+    {
+    	// Get the name of the property
+    	String propertyName = property.getName();
+    	
+    	// Construct a string for the proper indentation
+    	String margin = "";
+    	for (int i = 0; i < indent; i++)
+    		margin += "\t";
+    	
+    	if (value != null && property.isContainment())
+    	{
+    		// For containment properties, display the value
+    		// with printDataObject
+    		
+    		Type type = property.getType();
+    		String typeName = type.getName();
+    		System.out.println(margin + propertyName + " (" + typeName + "):");
+    		printDataObject((DataObject) value, indent + 1);   		
+    	}
+    	else
+    	{
+    		// For non-containment properties, just print the value
+    		System.out.println(margin + propertyName + ": " + value);    		
+    	}
+    	
+    }
+
+}
\ No newline at end of file

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/FVTUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/FVTUtil.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/PropertyScenario.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/PropertyScenario.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/PropertyScenario.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/PropertyScenario.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,146 @@
+package test.sdo21.scenarios;
+
+import java.util.List;
+
+import test.sdo21.framework.ExpectedConditionError;
+import test.sdo21.framework.ReturnValueError;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.helper.DataFactory;
+
+public class PropertyScenario
+{
+    /**
+     * testPropertyAPI is used to test the methods of the Property API
+     * @param testDO
+     * @throws ExpectedConditionError
+     * @throws ReturnValueError
+     */
+	
+    public static void testPropertyAPI (DataObject testDO) throws ExpectedConditionError, ReturnValueError
+    {
+    	Property property;
+
+        /**
+         * Verify Property.getDefault() for both a newly created DataObject and a cleared DataObject.
+         */
+    	
+    	verifyGetDefault(DataFactory.INSTANCE.create(testDO.getType()));
+    	
+    	// Set the values for each Property using populateFields, then unset them using unsetFields.
+    	
+    	FVTUtil.populateFields(testDO);
+    	unsetFields(testDO);
+    	verifyGetDefault(testDO);
+    	
+    	property = testDO.getProperty("children");
+    	
+    	/**
+    	 * Verify getName, getType, isMany==true, isContainment==true
+    	 */
+    	
+    	if (!(property.getName().equals("children")))
+    		throw new ReturnValueError("Property.getName() returned an unexpected value.",
+    				"children", property.getName());
+    		
+    	if (!(property.getType().equals(testDO.getType())))
+    		throw new ReturnValueError("Property.getType() returned an unexpected value.",
+    				testDO.getType(), property.getType());
+    	
+    	if (!(property.isMany()))
+    	    throw new ReturnValueError("Property.isMany() returned an unexpected value.",
+    	    		new Boolean(true), new Boolean(false));
+    	
+    	if (!(property.isContainment()))
+    	    throw new ReturnValueError("Property.isContainment() returned an unexpected value.",
+    	    		new Boolean(true), new Boolean(false));
+    	
+    	property = testDO.getProperty("booleanVal");
+    	
+    	/**
+    	 * Verify isMany==false, isReadOnly==false, isCtonainment==false, getContainingType, 
+    	 * getAliasNames, getOpposite
+    	 */
+    	
+    	if (!(property.getName().equals("booleanVal")))
+    		throw new ReturnValueError("Property.getName() returned an unexpected value.",
+    				"booleanVal", property.getName());
+    	
+    	if (property.isMany())
+    		throw new ReturnValueError("Property.isMany() returned an unexpected value.",
+    				new Boolean(false), new Boolean(true));
+    	
+    	if (property.isReadOnly())
+    		throw new ReturnValueError("Property.isReadOnly() returned an unexpected value.",
+    				new Boolean(false), new Boolean(true));
+    		
+    	if (property.isContainment())
+    		throw new ReturnValueError("Property.isContainment() returned an unexpected value.",
+    				new Boolean(false), new Boolean(true));
+        
+    	if (!(property.getContainingType().equals(testDO.getType())))
+    		throw new ReturnValueError("Property.getContainingType() returned an unexpected value.",
+    				testDO.getType(), property.getContainingType());
+    	
+    	if (property.getAliasNames().size() != 0)
+    		throw new ReturnValueError("Property.getAliasNames() returned a List of unexpected size.",
+    				Integer.valueOf(0), Integer.valueOf(property.getAliasNames().size()));
+    	
+    	// TODO:  Uncomment the following when SDOUtil.addAliasName is implemented
+/*    	
+    	List aliasNames = testDO.getProperty("decimalVal2").getAliasNames();
+    	if (aliasNames.size() != 1)
+    		throw new ReturnValueError("Property.getAliasNames() returned a List of unexpected size.",
+    				Integer.valueOf(1), Integer.valueOf(property.getAliasNames().size()));
+    	else if (!(aliasNames.get(0).equals("Dec2")))
+    		throw new ReturnValueError("Property.getAliasNames() returned a List with unexpected contents.",
+    				"Dec2", aliasNames.get(0));
+*/   			
+    	if (property.getOpposite() != null)
+    		throw new ReturnValueError("Property.getOpposite() did not return null as expected.", 
+    				null, property.getOpposite());
+    }
+
+    /**
+     * verifyGetDefault is a private method that loops through each Property in the passed DataObject and
+     * verifies that the value is equal to the value returned by getDefault for each Property.  The precondition is
+     * that unset has been called for any Property for which a value has been set.
+     * @param testedDO
+     */
+    
+    private static void verifyGetDefault(DataObject testedDO)
+    {
+    	List properties = testedDO.getInstanceProperties();
+    	Property property;
+    	
+    	for (int i = 0; i < properties.size(); i ++)
+    	{
+    		property = (Property) properties.get(i);
+    		
+    		if (property.isMany()) 
+    	    {
+    			if (property.getDefault() != null)
+        			throw new ReturnValueError("Property.getDefault() did not return null for many-valued Property '" 
+                            + property.getName() + "'.", null, property.getDefault());	
+    	    }
+    		else if (testedDO.get(property) != property.getDefault())
+    			throw new ReturnValueError("Property.getDefault() did not return the correct default value for Property '" 
+    					                                          + property.getName() + "'.", testedDO.get(property), property.getDefault());
+    	}
+    }
+    
+    /**
+     * unsetFields() is a private method that loops through the Properties in the passed DataObject and 
+     * unsets each Property.
+     * @param unsetDO
+     */
+    
+    private static void unsetFields(DataObject unsetDO)
+    {
+    	List properties = unsetDO.getInstanceProperties();
+    	
+    	for (int i = 0; i < properties.size(); i ++)
+    		unsetDO.unset(i);
+    }
+}
\ No newline at end of file

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/PropertyScenario.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/PropertyScenario.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/ScenarioLibrary.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/ScenarioLibrary.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/ScenarioLibrary.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/ScenarioLibrary.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,89 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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 test.sdo21.scenarios;
+
+import java.util.List;
+import java.io.IOException;
+import java.util.ArrayList;
+
+
+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.EqualityHelper;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * The Scenario Library is a set of tests which will be called for the various
+ * types of SDOs.  (Static, Dynamic with static resources, and purely dynamic.)
+ */
+
+public class ScenarioLibrary  
+{
+
+
+
+
+    /**
+     * tetFaultyXSD tests that appropiate exception is thrown when a invalid XSD is 
+     * used to define a Type.
+     * ----  Will be specific to semi-Dynamic scenario
+     */
+    public static void testFaultyXSD (DataObject testDO)
+    {
+    	//TODO:  complete 
+    }
+    
+
+    
+    /**
+     * testThreadSafety verifies the thread safety of meta data.
+     */
+    public static void testThreadSafety (DataObject testDO)
+    {
+    	//TODO:  complete
+    }
+    
+    /**
+     * testFaultyWSDL verifies the handling of invalid WSDL.
+     */
+    public static void testFaultyWSDL (DataObject testDO)
+    {
+    	//TODO: complete
+    }
+
+
+    public static void testChangeSummaryAPI(DataObject testDO)
+    {
+    	
+    }
+    
+    
+    
+
+
+    
+}
+
+
+
+
+
+

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/ScenarioLibrary.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/ScenarioLibrary.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/SequenceScenario.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/SequenceScenario.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/SequenceScenario.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/SequenceScenario.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,520 @@
+package test.sdo21.scenarios;
+
+import java.util.List;
+
+import test.sdo21.framework.ExpectedConditionError;
+import test.sdo21.framework.ExpectedExceptionError;
+import test.sdo21.framework.ReturnValueError;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+
+public class SequenceScenario
+{
+    
+    /**
+     * testSequenceAPI tests the methods of the Sequence API
+     * @param testDO
+     * @throws ReturnValueError, ExpectedConditionError, ExpectedExceptionError
+     */
+	
+    public static void testSequenceAPI (DataObject testDO) throws ExpectedConditionError, ReturnValueError, ExpectedExceptionError
+    {
+    	DataObject sequenceDO = testDO.getDataObject("sequencedElem");
+    	Property numberProp = sequenceDO.getProperty("Numbers");
+    	Property letterProp = sequenceDO.getProperty("Letters");
+    	Property invalidProp = testDO.getProperty("dateVal");
+    	
+    	int numberIndex =0, letterIndex =0, invalidIndex, sequenceSize = 0, sequenceIndex;
+    	
+    	List properties = sequenceDO.getType().getProperties();
+    	
+    	invalidIndex = properties.size();
+    	
+    	for (int i = 0; i < properties.size(); i++)
+    	{
+    		if (((Property) properties.get(i)).equals(numberProp))
+    			numberIndex = i;
+    		else if (((Property) properties.get(i)).equals(letterProp))
+    			letterIndex = i;
+    	}
+    	
+    	/**
+    	 * Ensure that the DataObject is sequenced as expected.
+    	 */
+    	
+    	if (!sequenceDO.getType().isSequenced())
+    		throw new ExpectedConditionError("The created Type 'Sequenced' has Type.isSequenced() == false.  The test case may not proceed.");
+        Sequence sequence = sequenceDO.getSequence();
+        boolean errorCaught;
+        
+    	if (sequence.size() != 0)
+    		throw new ReturnValueError("Sequence.size() returned an unexpected value.", 
+    				Integer.valueOf(0), Integer.valueOf(sequence.size()));
+    	
+    	/**
+    	 * Verify that the index specified methods throw an Exception for an invalid index.
+    	 */
+    	
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.getProperty(0);
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.getProperty() should throw an Exception when an invalid index is given.",
+    				IndexOutOfBoundsException.class, null);
+ 
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.remove(0);
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.remove() should throw an Exception when an invalid index is given.",
+    				IndexOutOfBoundsException.class, null);
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.getValue(0);
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.getValue() should throw an Exception when an invalid index is given.",
+    				IndexOutOfBoundsException.class, null);
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.setValue(0, "attempt");
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.setValue() should throw an Exception when an invalid index is given.",
+    				IndexOutOfBoundsException.class, null);
+
+    	// Add elements to the Sequence by updating the DataObject
+    	
+    	List letterList = sequenceDO.getList("Letters");
+    	List numberList = sequenceDO.getList("Numbers");
+    	
+    	letterList.add("A");
+    	letterList.add("B");
+    	numberList.add(Integer.valueOf(5));
+    	letterList.add("C");
+    	numberList.add(Integer.valueOf(16));
+    	
+    	sequenceSize = 5;
+    	
+    	// The expected arrangement of sequence is as follows
+    	// {<Letters, "A">, <Letters, "B">, <Numbers, 5>, <Lettes, "C">, <Numbers, 16>}
+    	
+    	/**
+    	 *  Verify performance of size, getProperty, and getValue
+    	 */
+    	
+    	if (sequence.size() != sequenceSize)
+    		throw new ReturnValueError("Sequence.size() returned an unexpected value.", 
+    				Integer.valueOf(sequenceSize), Integer.valueOf(sequence.size()));
+
+    	if (!(sequence.getProperty(1).equals(letterProp)))
+    		throw new ReturnValueError("Sequence.getProperty() returned an unexpected Property.", 
+    				letterProp, sequence.getProperty(1));	
+    	
+    	if (!(sequence.getProperty(4).equals(numberProp)))
+    		throw new ReturnValueError("Sequence.getProperty() returned an unexpected Property.", 
+    				numberProp, sequence.getProperty(4));	 
+    	
+    	if (!(sequence.getValue(0).equals("A")))
+    		throw new ReturnValueError("Sequence.getValue() returned an unexpected value.", 
+    				"A", sequence.getValue(0));		
+    	
+    	if (!(sequence.getValue(2).equals(Integer.valueOf(5))))
+    		throw new ReturnValueError("Sequence.getValue() returned an unexpected value.", 
+    				Integer.valueOf(5), sequence.getValue(2));	
+    	
+    	/**
+    	 *  Use setValue to modify the Sequence, then verify the outcome
+    	 */
+    	
+    	sequence.setValue(1, "F");
+    	
+    	// Expect:  {<Letters, "A">, <Letters, "F">, <Numbers, 5>, <Lettes, "C">, <Numbers, 16>}
+    	
+    	if (!(sequence.getValue(1).equals("F")))
+    		throw new ExpectedConditionError("Sequence.setValue() did not have the intended effect.", 
+    				"F", sequence.getValue(1));
+    	
+    	/**
+    	 * Use Sequence.remove() to modify the Sequence, then verify the outcome
+    	 */
+    	
+    	sequence.remove(1);
+    	sequenceSize--;
+    
+    	// Expect:  {<Letters, "A">, <Numbers, 5>, <Lettes, "C">, <Numbers, 16>}
+
+    	if (sequence.size() != sequenceSize)
+    		throw new ExpectedConditionError("Sequence.remove() did not decrement the size of the Sequence.");
+    	
+    	if (!(sequence.getValue(1).equals(Integer.valueOf(5))))
+        	throw new ExpectedConditionError("Sequence.remove() did not shift the elements as expected.");
+
+    	//TODO:  Change the following to addText when the API is changed.
+    	
+    	/**
+    	 * Use Sequence.add() to modify the Sequence, then verify the outcome
+    	 */
+    	
+    	sequence.add("Structured text at the end.");
+    	sequenceSize++;
+    	
+    	// Expect:  {<Letters, "A">, <Numbers, 5>, <Lettes, "C">, <Numbers, 16>, "Structured text at the end"}
+    
+    	if (sequence.size() != sequenceSize)
+    		throw new ExpectedConditionError("Sequence.add(String) did not increment the size of the Sequence.");
+
+    	if (!(sequence.getValue(sequenceSize-1).equals("Structured text at the end.")))
+        	throw new ExpectedConditionError("Sequence.add(String) did not place the correct value at the correct index.");
+
+    	if (sequence.getProperty(sequenceSize-1) != null)
+        	throw new ExpectedConditionError("Sequence.add(String) should result in a null Property in the final index.");
+
+    	/**
+    	 * Use Sequence.move() to modify the Sequence, then verify the outcome
+    	 */
+
+    	sequence.move(1, 3);
+    	
+    	// Expect:  {<Letters, "A">, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">, "Structured text at the end"}
+
+    	if (sequence.size() != sequenceSize)
+    		throw new ExpectedConditionError("Sequence.move() had an unexpected effect on the size of the Sequence.",
+    				Integer.valueOf(sequenceSize), Integer.valueOf(sequence.size()));
+    	
+    	if (!(sequence.getValue(1).equals(Integer.valueOf(16))))
+        	throw new ExpectedConditionError("Sequence.move() did not place the expected value at the expected location.",
+        			Integer.valueOf(16), sequence.getValue(1));
+    	
+    	if (!(sequence.getValue(2).equals(Integer.valueOf(5))))
+        	throw new ExpectedConditionError("Sequence.move() had an unexpected effect on the index following the move-to index.",
+        			Integer.valueOf(5), sequence.getValue(2));
+    	
+    	/**
+    	 * Attempt move with an invalid index and verify the error handling.
+    	 */
+    	
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.move(0, 5);
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.move() should throw an Exception when an invalid Exception is given.",
+    				IndexOutOfBoundsException.class, null);
+
+    	/**
+    	 * Use Sequence.add(Property, Object) to modify the Sequence, then verify the outcome
+    	 */
+
+    	sequence.add(numberProp, Integer.valueOf(8));
+    	sequenceSize++;
+    	
+    	// Expect:  {<Letters, "A">, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">, "Structured text at the end", <Numbers, 8>}
+
+    	if (sequence.size() != sequenceSize)
+    		throw new ExpectedConditionError("Sequence.add(Property, Object) did not increment the size of the Sequence.",
+    				Integer.valueOf(sequenceSize), Integer.valueOf(sequence.size()));
+    	
+    	if (!(sequence.getValue(sequenceSize-1).equals(Integer.valueOf(8))))
+        	throw new ExpectedConditionError("Sequence.add(Property, Object) did not place the expected value at the expected index.",
+        			Integer.valueOf(8), sequence.getValue(sequenceSize -1));
+  
+    	if (!(sequence.getProperty(sequenceSize-1).equals(numberProp)))
+        	throw new ExpectedConditionError("Sequence.add(Property, Object) did not place the expected Property at the expected index.",
+        			numberProp, sequence.getProperty(sequenceSize-1));
+    	
+    	/**
+    	 * Attempt add(Property, Object) with an invalid Property and verify the error handling
+    	 */
+    	
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.add(invalidProp, "A");
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+    	
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.add(Property, Object) should throw an Exception when an invalid Property is given.");
+    	
+    	/**
+    	 * Use Sequence.add(String, Object) to modify the Sequence, then verify the outcome
+    	 */
+
+    	sequence.add("Letters", "K");
+    	sequenceSize++;
+    	
+    	// Expect:  {<Letters, "A">, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">, "Structured text at the end", <Numbers, 8>, <Letters, "K">}
+
+    	if (sequence.size() != sequenceSize)
+    		throw new ExpectedConditionError("Sequence.add(String, Object) did not increment the size of the Sequence.",
+    				Integer.valueOf(sequenceSize), Integer.valueOf(sequence.size()));
+    	
+    	if (!(sequence.getValue(sequenceSize-1).equals("K")))
+        	throw new ExpectedConditionError("Sequence.add(String, Object) did not place the expected value at the expected index.",
+        			"K", sequence.getValue(sequenceSize-1));
+  
+    	if (!(sequence.getProperty(sequenceSize-1).equals(letterProp)))
+        	throw new ExpectedConditionError("Sequence.add(String, Object) did not place the expected Property at the expected index.",
+        			letterProp, sequence.getProperty(sequenceSize-1));
+    	
+    	/**
+    	 *  Attempt add(String, Object) with an invalid String and verify the error handling
+    	 */
+    	
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.add("NoSuchProperty", "A");
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+    	
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.add(String, Object) should throw an Exception when an invalid Property is given.");
+
+    	/**
+    	 * Attempt add(String, Object) with an invalid Object and verify the error handling
+    	 */
+    	
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.add("Numbers", "A");
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+    	
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.add(String, Object) should throw an Exception when an invalid Object is given.");
+
+    	/**
+    	 * Use Sequence.add(int, Object) to modify the Sequence, then verify the outcome
+    	 */
+
+    	sequence.add(numberIndex, Integer.valueOf(10)); 
+    	sequenceSize++;
+
+    	// Expect:  {<Letters, "A">, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">, "Structured text at the end", <Numbers, 8>, <Letters, "K">, <Numbers, 10>}
+  	
+     	if (sequence.size() != sequenceSize)
+    		throw new ExpectedConditionError("Sequence.add(int, Object) did not increment the size of the Sequence.",
+    				Integer.valueOf(sequenceSize), Integer.valueOf(sequence.size()));
+    	
+    	if (!(sequence.getValue(sequenceSize-1).equals(Integer.valueOf(10))))
+        	throw new ExpectedConditionError("Sequence.add(int, Object) did not place the expected value at the expected index.",
+        			Integer.valueOf(10), sequence.getValue(sequenceSize-1));
+  
+    	if (!(sequence.getProperty(sequenceSize-1).equals(numberProp)))
+        	throw new ExpectedConditionError("Sequence.add(int, Object) did not place the expected Property at the expected index.",
+        			numberProp, sequence.getProperty(sequenceSize-1));
+    	
+    	/**
+    	 * Attempt add(int, Object) with an invalid Object and verify the error handling
+    	 */
+    	
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.add(invalidIndex, Integer.valueOf(16));
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+    	
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.add(int, Object) should throw an Exception when an invalid index is given.");
+
+    	/**
+    	 * Use Sequence.add(int, String, Object) to modify the Sequence, then verify the outcome
+    	 * TODO  This section is commented out until Tuscany-931 is resolved.
+    	 */
+
+/*
+        sequenceIndex = 1;
+    	sequence.add(sequenceIndex, "Numbers", Integer.valueOf(-4));
+    	sequenceSize++;
+    	
+    	// Expect:  {<Letters, "A">, <Numbers, -4>, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">, "Structured text at the end", 
+    	//                <Numbers, 8>, <Letters, "K">, <Numbers, 10>}
+
+    	if (sequence.size() != sequenceSize)
+    		throw new ExpectedConditionError("Sequence.add(int, String, Object) did not increment the size of the Sequence.",
+    				Integer.valueOf(sequenceSize), Integer.valueOf(sequence.size()));
+    	
+    	if (!(sequence.getValue(sequenceIndex).equals(Integer.valueOf(-4))))
+        	throw new ExpectedConditionError("Sequence.add(int, String, Object) did not place the expected value at the expected index.",
+        			Integer.valueOf(-4), sequence.getValue(sequenceIndex));
+  
+    	if (!(sequence.getProperty(sequenceIndex).equals(numberProp)))
+        	throw new ExpectedConditionError("Sequence.add(int, String, Object) did not place the expected Property at the expected index.",
+        			numberProp, sequence.getProperty(sequenceIndex));
+*/    	
+    	/**
+    	 * Use Sequence.add(int, Property, Object) to modify the Sequence, then verify the outcome
+    	 * TODO  This section is commented out until Tuscany-931 is resolved.
+    	 */
+/*
+        sequenceIndex = 0;
+    	sequence.add(sequenceIndex, numberProp, Integer.valueOf(17));
+    	sequenceSize++;
+    	
+    	// Expect:  {<Numbers, 17>, <Letters, "A">, <Numbers, -4>, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">, "Structured text at the end", 
+    	//           <Numbers, 8>, <Letters, "K">, <Numbers, 10>}
+
+    	if (sequence.size() != sequenceSize)
+    		throw new ExpectedConditionError("Sequence.add(int, Property, Object) did not increment the size of the Sequence.",
+    				Integer.valueOf(sequenceSize), Integer.valueOf(sequence.size()));
+    	
+    	if (!(sequence.getValue(sequenceIndex).equals(Integer.valueOf(17))))
+        	throw new ExpectedConditionError("Sequence.add(int, Property, Object) did not place the expected value at the expected index.",
+        			Integer.valueOf(17), sequence.getValue(sequenceIndex));
+  
+    	if (!(sequence.getProperty(sequenceIndex).equals(numberProp)))
+        	throw new ExpectedConditionError("Sequence.add(int, Property, Object) did not place the expected Property at the expected index.",
+        			numberProp, sequence.getProperty(sequenceIndex));
+*/   	
+    	/**
+    	 * Use Sequence.add(int, int, Object) to modify the Sequence, then verify the outcome
+    	 * TODO  This section is commented out until Tuscany-931 is resolved.
+    	 */
+/*
+    	sequenceIndex = 9;
+    	sequence.add(sequenceIndex, letterIndex, "S");
+    	sequenceSize++;
+    	
+    	// Expect:  {<Numbers, 17>, <Letters, "A">, <Numbers, -4>, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">, "Structured text at the end", 
+    	//           <Numbers, 8>, <Letters, "K">, <Letters, "S">, <Numbers, 10>}
+
+    	if (sequence.size() != sequenceSize)
+    		throw new ExpectedConditionError("Sequence.add(int, Property, Object) did not increment the size of the Sequence.",
+    				Integer.valueOf(sequenceSize), Integer.valueOf(sequence.size()));
+    	
+    	if (!(sequence.getValue(sequenceIndex).equals("S")))
+        	throw new ExpectedConditionError("Sequence.add(int, Property, Object) did not place the expected value at the expected index.",
+        			"S", sequence.getValue(sequenceIndex));
+  
+    	if (!(sequence.getProperty(sequenceIndex).equals(letterProp)))
+        	throw new ExpectedConditionError("Sequence.add(int, Property, Object) did not place the expected Property at the expected index.",
+        			letterProp, sequence.getProperty(sequenceIndex));
+*/    	
+
+    	/**
+    	 * Attempt Sequnce.add(int, int, Object) with an invalid Sequence index and verify proper error handling.
+    	 */
+    	
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.add(sequence.size(), letterIndex, "Z");
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+    	
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.add(int, int, Object) should throw an Exception when an invalid Sequence index is given.");
+
+    	/**
+    	 * Attempt Sequnce.add(int, int, Object) with an invalid Property index and verify proper error handling.
+    	 */
+    	
+    	sequenceIndex = 0;
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.add(sequenceIndex, invalidIndex, "Z");
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+    	
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.add(int, int, Object) should throw an Exception when an invalid Property index is given.");
+
+    	/**
+    	 * Attempt Sequnce.add(int, Property, Object) with an invalid Property  and verify proper error handling.
+    	 */
+    	
+    	sequenceIndex = 0;
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.add(sequenceIndex, invalidProp, "Z");
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+    	
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.add(int, int, Object) should throw an Exception when an invalid Property is given.");
+
+    	/**
+    	 * Attempt Sequnce.add(int, int, Object) with an invalid Property name and verify proper error handling.
+    	 */
+    	
+    	sequenceIndex = 0;
+    	try
+    	{
+    		errorCaught = false;
+    		sequence.add(sequenceIndex, "notAValidProperty", "Z");
+    	}
+    	catch (Exception e)
+    	{
+    		errorCaught = true;
+    	}
+    	
+    	if (!errorCaught)
+    		throw new ExpectedExceptionError("Sequence.add(int, int, Object) should throw an Exception when an invalid Property name is given.");
+
+    	//TODO:  Test add(int, Object instaceof String) after add(int, String) is changed to addText(int, String).
+    }
+    
+}
\ No newline at end of file

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/SequenceScenario.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/SequenceScenario.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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