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 [3/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/TypeConversionScenario.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeConversionScenario.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeConversionScenario.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeConversionScenario.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,1207 @@
+/**
+ *
+ *  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.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.SimpleDateFormat;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import test.sdo21.framework.ExpectedConditionError;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+
+public class TypeConversionScenario
+{
+    // The following constants describe the index for the fields in api_test.xsd.
+    
+    private static int STRING_VAL_INDEX;
+    private static int BOOLEAN_VAL_INDEX;
+    private static int BYTE_VAL_INDEX;
+    private static int DECIMAL_VAL_INDEX ;
+    private static int INT_VAL_INDEX;
+    private static int FLOAT_VAL_INDEX;
+    private static int DOUBLE_VAL_INDEX;
+    private static int DATE_VAL_INDEX;
+    private static int SHORT_VAL_INDEX;
+    private static int LONG_VAL_INDEX ;
+    private static int BYTES_VAL_INDEX;
+    private static int INTEGER_VAL_INDEX ;
+    private static int CHAR_VAL_INDEX;
+    
+    private static Property STRING_VAL_PROP;
+    private static Property BOOLEAN_VAL_PROP;
+    private static Property BYTE_VAL_PROP;
+    private static Property DECIMAL_VAL_PROP ;
+    private static Property INT_VAL_PROP;
+    private static Property FLOAT_VAL_PROP;
+    private static Property DOUBLE_VAL_PROP;
+    private static Property DATE_VAL_PROP;
+    private static Property SHORT_VAL_PROP;
+    private static Property LONG_VAL_PROP ;
+    private static Property BYTES_VAL_PROP;
+    private static Property INTEGER_VAL_PROP ;
+    private static Property CHAR_VAL_PROP;
+    
+    // The following variables are Method arrays.  Each array refers to a specific get<Type>, but within
+    // the array exist the get<Type>(index), get<Type>(property), and get<Type>(path).  Rather than
+    // referring to each of the three in every circumstance, the more compact array appears.
+    
+    private static ConversionType TO_BOOLEAN = new ConversionType("getBoolean");
+    private static ConversionType TO_BYTE = new ConversionType("getByte");
+    private static ConversionType TO_CHAR = new ConversionType("getChar");
+    private static ConversionType TO_DOUBLE = new ConversionType("getDouble");
+    private static ConversionType TO_FLOAT = new ConversionType("getFloat");
+    private static ConversionType TO_INT = new ConversionType("getInt");
+    private static ConversionType TO_LONG = new ConversionType("getLong");
+    private static ConversionType TO_SHORT = new ConversionType("getShort");
+    private static ConversionType TO_BYTES = new ConversionType("getBytes");
+    private static ConversionType TO_BIGDECIMAL = new ConversionType("getBigDecimal");
+    private static ConversionType TO_BIGINTEGER = new ConversionType("getBigInteger");
+    private static ConversionType TO_DATAOBJECT = new ConversionType("getDataObject");
+    private static ConversionType TO_DATE = new ConversionType("getDate");
+    private static ConversionType TO_STRING = new ConversionType("getString");
+    private static ConversionType TO_LIST = new ConversionType("getList");
+    private static ConversionType TO_SEQUENCE = new ConversionType("getSequence");
+    
+    private static GeneralComparator COMPARE_ANY;
+    
+    //  There will be several instances where a Property must be passed as a parameter.  Have available the Type
+    //  to call getProperty() as needed.
+    
+    private static Type API_TEST_TYPE;
+    
+    // The default constructor establishes each of the Method and Method[] variables.
+    
+    public TypeConversionScenario(DataObject test_obj) throws Exception
+    {       
+        COMPARE_ANY = new GeneralComparator();
+        API_TEST_TYPE = test_obj.getType();
+             
+        List properties = API_TEST_TYPE.getProperties();
+        Property property;
+        String name;
+        
+        for (int i = 0; i < properties.size(); i++)
+        {
+            property = (Property) properties.get(i);
+            name = property.getName();
+            
+            if (name.equals("booleanVal"))
+            {
+                BOOLEAN_VAL_INDEX = i;
+                BOOLEAN_VAL_PROP = property;
+            }
+            else if (name.equals("stringVal"))
+            {
+                STRING_VAL_INDEX = i;
+                STRING_VAL_PROP = property;
+            }
+            else if (name.equals("byteVal"))
+            {
+                BYTE_VAL_INDEX = i;
+                BYTE_VAL_PROP = property;
+            }
+            else if (name.equals("decimalVal"))
+            {
+                DECIMAL_VAL_INDEX = i;
+                DECIMAL_VAL_PROP = property;
+            }
+            else if (name.equals("intVal"))
+            {
+                INT_VAL_INDEX = i;
+                INT_VAL_PROP = property;
+            }
+            else if (name.equals("floatVal"))
+            {
+                FLOAT_VAL_INDEX = i;
+                FLOAT_VAL_PROP = property;
+            }
+            else if (name.equals("doubleVal"))
+            {
+                DOUBLE_VAL_INDEX = i;
+                DOUBLE_VAL_PROP = property;
+            }
+            else if (name.equals("dateVal"))
+            {
+                DATE_VAL_INDEX = i;
+                DATE_VAL_PROP = property;
+            }
+            else if (name.equals("shortVal"))
+            {
+                SHORT_VAL_INDEX = i;
+                SHORT_VAL_PROP = property;
+            }
+            else if (name.equals("longVal"))
+            {
+                LONG_VAL_INDEX = i;
+                LONG_VAL_PROP = property;
+            }
+            else if (name.equals("bytesVal"))
+            {
+                BYTES_VAL_INDEX = i;
+                BYTES_VAL_PROP = property;
+            }
+            else if (name.equals("integerVal"))
+            {
+                INTEGER_VAL_INDEX = i;
+                INTEGER_VAL_PROP = property;
+            }
+            else if (name.equals("charVal"))
+            {
+                CHAR_VAL_INDEX = i;
+                CHAR_VAL_PROP = property;
+            }
+
+        }
+        
+    }
+    
+    /**
+     * testTypeConversions verifies that each of the permitted Type conversions performs properly.  
+     * @param test_obj
+     * @throws Exception
+     */
+    public static void testTypeConversions(DataObject test_obj) throws Exception
+    {
+        TypeConversionScenario tests = new TypeConversionScenario(test_obj);
+        
+        tests.testBigDecimalConversion(test_obj);
+        tests.testBigDecimalExceptions(test_obj);
+        tests.testBigIntegerConversion(test_obj);
+        tests.testBigIntegerExceptions(test_obj);
+        tests.testBooleanConversion(test_obj);
+        tests.testBooleanExceptions(test_obj);
+        tests.testByteConversion(test_obj);
+        tests.testByteExceptions(test_obj);
+        tests.testBytesConversion(test_obj);
+        tests.testBytesExceptions(test_obj);
+        tests.testCharConversion(test_obj);
+        tests.testCharExceptions(test_obj);
+        tests.testDateConversion(test_obj);
+        tests.testDateExceptions(test_obj);
+        tests.testDoubleConversion(test_obj);
+        tests.testDateExceptions(test_obj);
+        tests.testDoubleConversion(test_obj);
+        tests.testDoubleExceptions(test_obj);
+        tests.testFloatConversion(test_obj);
+        tests.testFloatExceptions(test_obj);
+        tests.testIntConversion(test_obj);
+        tests.testIntExceptions(test_obj);
+        tests.testLongConversion(test_obj);
+        tests.testLongExceptions(test_obj);
+        tests.testShortConversion(test_obj);
+        tests.testShortExceptions(test_obj);
+        tests.testStringConversion(test_obj);
+        tests.testStringExceptions(test_obj);
+    }
+    
+    private static class ConversionType
+    {
+        // The following constants are used because the getMethod function requires an Class
+        // array describing the parameters to the functions.  
+        
+        private static final Class[] INT_CLASS_ARRAY = {int.class};
+        private static final Class[] PROPERTY_CLASS_ARRAY = {Property.class};
+        private static final Class[] STRING_CLASS_ARRAY = {String.class};
+        
+        Method index_method;
+        Method property_method;
+        Method path_method;
+        
+        public ConversionType (String method_name)
+        {
+            try
+            {
+                this.index_method = DataObject.class.getMethod(method_name, INT_CLASS_ARRAY);
+                this.property_method = DataObject.class.getMethod(method_name, PROPERTY_CLASS_ARRAY);
+                this.path_method = DataObject.class.getMethod(method_name, STRING_CLASS_ARRAY);
+            }
+            catch (NoSuchMethodException e)
+            {
+                this.index_method = null;
+                this.property_method = null;
+                this.path_method = null;
+            }
+        }
+        
+        public Method getIndexMethod()
+        {
+            return this.index_method;
+        }
+        
+        public Method getPropertyMethod()
+        {
+            return this.property_method;
+        }
+        
+        public Method getPathMethod()
+        {
+            return this.path_method;
+        }
+    }
+ 
+    // Each instance of Test describes a convert-from type.  The index, property and path parms
+    // will refer to the same field, which is a field of the convert-from type.
+    
+    private static class Test
+    {
+        Object[] index_parm;
+        Object[] property_parm;
+        Object[] path_parm;
+        Object expected_value;
+        String from_type;
+
+        // The constructor prepares a test DataObject and determines how to access the field
+        // in three different ways - index, property, and path.
+        
+        Test(String path, int index)
+        {
+            this.index_parm = new Object[] {new Integer(index)};
+            this.property_parm = new Object[] {API_TEST_TYPE.getProperty(path)};
+            this.path_parm = new Object[] {path};
+            this.expected_value = null;
+        }
+        
+        /**
+         * initialize() is a private method that establishes the initial value of the test field.
+         * @return
+         */ 
+        
+        private void initialize(Class type, String type_name, Object initial_value, DataObject test_obj) throws Exception
+        {
+            Class[] classArray = {int.class, type};
+            Object[] initValueArray = new Object[] {this.index_parm[0], initial_value};
+            
+            Method setter = DataObject.class.getMethod("set" + type_name, classArray);
+            setter.invoke(test_obj, initValueArray);
+            this.expected_value = initial_value;    
+            this.from_type = type_name;
+        }
+        
+        /**
+         * attemptConversion is a private method that attempts the conversion to the specified type, using 
+         * DataObject.get____().  The get___() function can be called with an index, path, and property.  
+         * attemptConversion() calls each of those three.
+         * @param to_type
+         * @param test_obj
+         * @throws Exception
+         */
+        
+        private void attemptConversion(ConversionType to_type, DataObject test_obj) throws Exception
+        {     
+              performConversion(to_type.getIndexMethod(), this.index_parm, test_obj);
+              performConversion(to_type.getPathMethod(), this.path_parm, test_obj);
+              performConversion(to_type.getPropertyMethod(), this.property_parm, test_obj);
+        }
+        
+        /**
+         * checkConversionException verifies that for a particular to and from Type pairing, the expected Exceptoin is thrown.
+         * @param to_type
+         * @param expected_exception
+         * @param test_obj
+         * @throws Exception
+         */
+        
+        private void checkConversionException(ConversionType to_type, Class expected_exception, DataObject test_obj) throws Exception
+        {
+            boolean index_err, path_err, property_err, consistency_err = false;
+            
+            index_err = executeExceptionCase(to_type.getIndexMethod(), this.index_parm, expected_exception, test_obj);
+            path_err = executeExceptionCase(to_type.getPathMethod(), this.path_parm, expected_exception, test_obj);
+            property_err = executeExceptionCase(to_type.getPropertyMethod(), this.property_parm, expected_exception, test_obj);
+            
+            if (index_err != path_err || path_err != property_err)
+                consistency_err = true;
+            else if (index_err == false)
+                attemptConversion(to_type, test_obj);
+            
+            if (consistency_err)
+                throw new ExpectedConditionError("An exception inconsistency exists for " + to_type.getPathMethod().getName() + " when called " 
+                    + "for a " + this.from_type + " property.");
+        }
+        
+        /**
+         * performConversion is a private method that is called by attemptConversion for each of the 
+         * Property identification mechanisms.  (Property, index, or name.)  
+         * @param convert
+         * @param parm
+         * @param test_obj
+         * @throws Exception
+         */
+        
+        private void performConversion (Method convert, Object[] parm, DataObject test_obj) throws Exception
+        {
+            try
+            {
+                if (COMPARE_ANY.compare(convert.invoke(test_obj, parm), this.expected_value) != 0)
+                    throw new ExpectedConditionError("Conversion did not yield expected value for " + convert.getName() + " on a " + this.from_type + " property.");
+           }
+            catch (Exception e)
+            {
+                Throwable cause = e.getCause();
+                if (cause == null)
+                {
+                    System.err.println("An exception of type " + e.getClass() + " occurred while performing " + convert.getName()
+                          + " on a " + this.from_type + " property.");
+                }
+                else
+                {
+                    System.err.println("An exception of type " + cause.getClass() + " occurred while performing " + convert.getName()
+                          + " on a " + this.from_type + " property.");
+                }
+                  
+                throw e;
+            }
+    
+        }
+        
+        /**
+         * executeExceptionCase is a private method that insures a particular to and from Type pairing will throw the expected
+         * Exception when an a conversion is attempted using get____(<x>).  executeExceptionCase is called by checkConversionException
+         * for each mechanism of identifying the Property.  (Property, name, or index.)
+         * @param convert
+         * @param parm
+         * @param expected_exception
+         * @param test_obj
+         * @return
+         * @throws Exception
+         */
+        private boolean executeExceptionCase (Method convert, Object[] parm, Class expected_exception, DataObject test_obj) throws Exception
+        {
+            boolean exception_thrown = false;
+            try
+            {
+                convert.invoke(test_obj, parm);
+            }
+            catch (Exception e)
+            {
+                exception_thrown = true;
+                Throwable cause = e.getCause();
+                if (cause == null)
+                {
+                    if (expected_exception != e.getClass())
+                        throw new ExpectedConditionError("An unexpected exception occurred while performing " + convert.getName()
+                                + " on a " + this.from_type + " property.");
+                }
+                else 
+                {
+                    if (expected_exception != cause.getClass())
+                        throw new ExpectedConditionError("An unexpected exception occurred while performing " + convert.getName()
+                                + " on a " + this.from_type + " property.");
+                }
+            }
+              
+            return exception_thrown;
+        }
+    }
+
+    private static class GeneralComparator implements Comparator
+    {
+    	/**
+    	 * The compare method fo the GeneralComparator class is used to compare two of any Types between
+    	 * which a covnersion is permitted in SDO.
+    	 */
+    	
+        public int compare(Object obj1, Object obj2)
+        {        
+            if (obj1.getClass() == obj2.getClass())
+            {
+                if (obj1.equals(obj2))
+                    return 0;
+                else
+                    return 1;
+            }
+            
+            else if (obj1.getClass() == Date.class)
+            {
+                if (obj2.getClass() == String.class)
+                {
+                    try
+                    {                
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy'-'MM'-'dd'T'H':'mm':'ss.S");
+                        
+                        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+                        obj2 = sdf.parse((String) obj2);
+                                                
+                        if (obj1.equals(obj2))
+                            return 0;                        
+                    }
+                    catch (Exception e)
+                    {
+                        System.out.println(e.getMessage());
+                    }
+
+                    return 1;
+                }
+                
+                else
+                {
+                    Date temp = (Date) obj1;
+                    
+                    return compare(new Long(temp.getTime()), obj2);
+                }                                      
+                
+            }
+
+            else if (obj2.getClass() == Date.class)
+            {                
+                return compare(obj2, obj1);
+            }                
+            
+            else if (obj1.getClass() == Boolean.class)
+            {
+                Boolean temp = (Boolean) obj1;
+                
+                if (temp.booleanValue())
+                {
+                    if (obj2.toString().equalsIgnoreCase("true"))
+                       return 0;
+                    else
+                        return 1;
+                }
+                
+                else
+                {
+                    if (obj2.toString().equalsIgnoreCase("true"))
+                       return 1;
+                    else
+                        return 0;
+                }
+            }
+            
+            else if (obj2.getClass() == Boolean.class)
+               return compare(obj2, obj1);
+            
+            else if (obj1.getClass() == Byte.class || obj2.getClass() == Byte.class)
+            {
+                byte b1 = (Double.valueOf(obj1.toString())).byteValue();
+                byte b2 = (Double.valueOf(obj2.toString())).byteValue();
+                
+                if (b1 == b2)
+                    return 0;
+                else if (b1 < b2)
+                    return -1;
+                else
+                    return 1;
+            }
+            
+            else if (obj1.getClass().toString().charAt(6) == '[')
+            {
+                long result = 0;
+                long multiplier = 1;
+                
+                byte[] array = (byte[]) obj1;
+                for (int i = 0; i < array.length; i++)
+                {
+                    result += array[array.length - i - 1] * multiplier;
+                    multiplier *= 256;
+                }
+
+                return compare(obj2, new Long(result));
+            }
+            
+            else if (obj2.getClass().toString().charAt(6) == '[')
+            {
+                return compare(obj2, obj1);
+            }
+            
+            else if (obj1.getClass() == Short.class || obj2.getClass() == Short.class)
+            {
+                short s1 = (Double.valueOf(obj1.toString())).shortValue();
+                short s2 = (Double.valueOf(obj2.toString())).shortValue();
+                
+                if (s1 == s2)
+                    return 0;
+                else if (s1 < s2)
+                    return -1;
+                else
+                    return 1;                
+            }
+            
+            else if (obj1.getClass() == Integer.class || obj2.getClass() == Integer.class)
+            {                
+                int i1 = (Double.valueOf(obj1.toString())).intValue();
+                int i2 = (Double.valueOf(obj2.toString())).intValue();
+                
+                if (i1 == i2)
+                    return 0;
+                else if (i1 < i2)
+                    return -1;
+                else
+                    return 1;                
+            }            
+            
+            else if (   obj1.getClass() == Long.class || obj2.getClass() == Long.class
+                     || obj1.getClass() == BigInteger.class || obj2.getClass() == BigInteger.class)
+            {
+                long l1 = (Double.valueOf(obj1.toString())).longValue();
+                long l2 = (Double.valueOf(obj2.toString())).longValue();
+                
+                if (l1 == l2)
+                    return 0;
+                else if (l1 < l2)
+                    return -1;
+                else
+                    return 1;                
+            }
+
+            else if (obj1.getClass() == Float.class || obj2.getClass() == Float.class)
+            {
+                float f1 = (Double.valueOf(obj1.toString())).floatValue();
+                float f2 = (Double.valueOf(obj2.toString())).floatValue();
+                
+                if (f1 == f2)
+                    return 0;
+                else if (f1 < f2)
+                    return -1;
+                else
+                    return 1;                
+            }
+            
+            else if (obj1.getClass() == Double.class || obj2.getClass() == Double.class)
+            {
+                Double b1 = Double.valueOf(obj1.toString());
+                Double b2 = Double.valueOf(obj2.toString());
+                
+                return b1.compareTo(b2);                
+            }
+        
+            else if (obj1.getClass() == BigDecimal.class || obj2.getClass() == BigDecimal.class)
+            {
+                BigDecimal b1 = new BigDecimal(obj1.toString());
+                BigDecimal b2 = new BigDecimal(obj2.toString());
+                
+                return b1.compareTo(b2);                
+            }
+            
+            else
+            {
+                if (obj1.toString().equals(obj2.toString()))
+                    return 0;
+                else
+                    return 1;
+            }
+        }
+        
+    }    
+
+    /**
+     * TODO:  Uncomment below as appropriate when TUSCANY-581 is resolved.
+     * In the following test cases, several instances are commented out.
+     * For these cases, the test case currently fails.  A JIRA issue (TUSCANY-581) has 
+     * been opened to either correct the behavior (then uncomment the lines) or to 
+     * alter the specification against which the test cases were designed (and then
+     * remove the lines - assuming the alteration is to remove stating the 
+     * nature of the exception).  
+     */
+    
+    /**
+     * testBooleanConversion verifies the conversion from boolean to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testBooleanConversion(DataObject test_obj) throws Exception
+    {
+        Test FromBoolean = new Test("booleanVal", BOOLEAN_VAL_INDEX);
+        
+        FromBoolean.initialize(boolean.class, "Boolean", Boolean.valueOf(true), test_obj);
+        
+        FromBoolean.attemptConversion(TO_BOOLEAN, test_obj);
+        FromBoolean.attemptConversion(TO_STRING, test_obj);
+    } 
+    
+    /**
+     * testBooleanExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from boolean  is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testBooleanExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromBoolean = new Test("booleanVal", BOOLEAN_VAL_INDEX);
+
+        FromBoolean.initialize(boolean.class, "Boolean", Boolean.valueOf(true), test_obj);
+
+//        FromBoolean.checkConversionException(TO_BYTE, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_DOUBLE, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_FLOAT, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_INT, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_LONG, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_SHORT, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_BIGDECIMAL, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_BIGINTEGER, ClassCastException.class, test_obj);
+        FromBoolean.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromBoolean.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+        FromBoolean.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromBoolean.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+    
+    /**
+     * testByteConversion verifies the conversion from byte to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testByteConversion(DataObject test_obj) throws Exception
+    {
+        Test FromByte = new Test("byteVal", BYTE_VAL_INDEX);
+        
+        FromByte.initialize(byte.class, "Byte", Byte.valueOf("-127"), test_obj);
+        
+        FromByte.attemptConversion(TO_BYTE, test_obj);
+        FromByte.attemptConversion(TO_DOUBLE, test_obj);
+        FromByte.attemptConversion(TO_FLOAT, test_obj);
+        FromByte.attemptConversion(TO_INT, test_obj);
+        FromByte.attemptConversion(TO_LONG, test_obj);
+        FromByte.attemptConversion(TO_SHORT, test_obj);
+        FromByte.attemptConversion(TO_STRING, test_obj);
+    }
+    
+    /**
+     * testByteExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion 
+     * from byte is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    private void testByteExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromByte = new Test("byteVal", BYTE_VAL_INDEX);
+        
+        FromByte.initialize(byte.class, "Byte", Byte.valueOf("-127"), test_obj);
+
+//        FromByte.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromByte.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromByte.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+        FromByte.checkConversionException(TO_BIGDECIMAL, ClassCastException.class, test_obj);
+        FromByte.checkConversionException(TO_BIGINTEGER, ClassCastException.class, test_obj);
+        FromByte.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromByte.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+        FromByte.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromByte.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+
+    /**
+     * testCharConversion verifies the conversion from char to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testCharConversion(DataObject test_obj) throws Exception
+    {
+        Test FromChar = new Test("charVal", CHAR_VAL_INDEX);
+        
+        FromChar.initialize(char.class, "Char", new Character('?'), test_obj);
+        
+        FromChar.attemptConversion(TO_CHAR, test_obj);
+        FromChar.attemptConversion(TO_STRING, test_obj);
+    }
+    
+    /**
+     * testCharExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion 
+     * from char is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    private void testCharExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromChar = new Test("charVal", CHAR_VAL_INDEX);
+        
+        FromChar.initialize(char.class, "Char", new Character('?'), test_obj);
+
+//        FromChar.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);        
+//        FromChar.checkConversionException(TO_BYTE, ClassCastException.class, test_obj);
+//        FromChar.checkConversionException(TO_DOUBLE, ClassCastException.class, test_obj);
+//        FromChar.checkConversionException(TO_FLOAT, ClassCastException.class, test_obj);
+//        FromChar.checkConversionException(TO_INT, ClassCastException.class, test_obj);
+//        FromChar.checkConversionException(TO_LONG, ClassCastException.class, test_obj);
+//        FromChar.checkConversionException(TO_SHORT, ClassCastException.class, test_obj);
+//        FromChar.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+//        FromChar.checkConversionException(TO_BIGDECIMAL, ClassCastException.class, test_obj);
+//        FromChar.checkConversionException(TO_BIGINTEGER, ClassCastException.class, test_obj);
+        FromChar.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromChar.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+        FromChar.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromChar.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+    
+    /**
+     * testDoubleConversion verifies the conversion from double to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testDoubleConversion(DataObject test_obj) throws Exception
+    {
+        Test FromDouble = new Test("doubleVal", DOUBLE_VAL_INDEX);
+        
+        FromDouble.initialize(double.class, "Double", new Double(Double.MAX_VALUE), test_obj);
+        
+        FromDouble.attemptConversion(TO_BYTE, test_obj);
+        FromDouble.attemptConversion(TO_DOUBLE, test_obj);
+        FromDouble.attemptConversion(TO_FLOAT, test_obj);
+        FromDouble.attemptConversion(TO_INT, test_obj);
+        FromDouble.attemptConversion(TO_LONG, test_obj);
+        FromDouble.attemptConversion(TO_SHORT, test_obj);
+        FromDouble.attemptConversion(TO_BIGDECIMAL, test_obj);
+        FromDouble.attemptConversion(TO_BIGINTEGER, test_obj);
+        FromDouble.attemptConversion(TO_STRING, test_obj);
+    }
+    
+    /**
+     * testDoubleExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from double  is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testDoubleExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromDouble = new Test("doubleVal", DOUBLE_VAL_INDEX);
+        
+        FromDouble.initialize(double.class, "Double", new Double(Double.MAX_VALUE), test_obj);
+
+//        FromDouble.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromDouble.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromDouble.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+        FromDouble.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromDouble.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+        FromDouble.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromDouble.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+    
+    /**
+     * testFloatConversion verifies the conversion from float to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testFloatConversion(DataObject test_obj) throws Exception
+    {
+        Test FromFloat = new Test("floatVal", FLOAT_VAL_INDEX);
+        
+        FromFloat.initialize(float.class, "Float", new Float(Float.MIN_VALUE), test_obj);
+        
+        FromFloat.attemptConversion(TO_BYTE, test_obj);
+        FromFloat.attemptConversion(TO_DOUBLE, test_obj);
+        FromFloat.attemptConversion(TO_FLOAT, test_obj);
+        FromFloat.attemptConversion(TO_INT, test_obj);
+        FromFloat.attemptConversion(TO_LONG, test_obj);
+        FromFloat.attemptConversion(TO_SHORT, test_obj);
+        FromFloat.attemptConversion(TO_BIGDECIMAL, test_obj);
+        FromFloat.attemptConversion(TO_BIGINTEGER, test_obj);
+        FromFloat.attemptConversion(TO_STRING, test_obj);
+    }
+
+    /**
+     * testFloatExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from float  is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testFloatExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromFloat = new Test("floatVal", FLOAT_VAL_INDEX);
+        
+        FromFloat.initialize(float.class, "Float", new Float(Float.MIN_VALUE), test_obj);
+
+//        FromFloat.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromFloat.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromFloat.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+        FromFloat.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromFloat.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+        FromFloat.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromFloat.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+    
+    /**
+     * testIntConversion verifies the conversion from int to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testIntConversion(DataObject test_obj) throws Exception
+    {
+        Test FromInt = new Test("intVal", INT_VAL_INDEX);
+        
+        FromInt.initialize(int.class, "Int", new Integer(5), test_obj);
+        
+        FromInt.attemptConversion(TO_BYTE, test_obj);
+        FromInt.attemptConversion(TO_DOUBLE, test_obj);
+        FromInt.attemptConversion(TO_FLOAT, test_obj);
+        FromInt.attemptConversion(TO_INT, test_obj);
+        FromInt.attemptConversion(TO_LONG, test_obj);
+        FromInt.attemptConversion(TO_SHORT, test_obj);
+        FromInt.attemptConversion(TO_BIGDECIMAL, test_obj);
+        FromInt.attemptConversion(TO_BIGINTEGER, test_obj);
+        FromInt.attemptConversion(TO_STRING, test_obj);
+    }
+    
+    /**
+     * testIntExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from int is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testIntExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromInt = new Test("intVal", INT_VAL_INDEX);
+        
+        FromInt.initialize(int.class, "Int", new Integer(5), test_obj);
+
+//        FromInt.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromInt.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromInt.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+        FromInt.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromInt.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+        FromInt.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromInt.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+    
+    /**
+     * testLongConversion verifies the conversion from long to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testLongConversion(DataObject test_obj) throws Exception
+    {
+        Test FromLong = new Test("longVal", LONG_VAL_INDEX);
+        
+        FromLong.initialize(long.class, "Long", new Long(7000L), test_obj);
+        
+        FromLong.attemptConversion(TO_BYTE, test_obj);
+        FromLong.attemptConversion(TO_DOUBLE, test_obj);
+        FromLong.attemptConversion(TO_FLOAT, test_obj);
+        FromLong.attemptConversion(TO_INT, test_obj);
+        FromLong.attemptConversion(TO_LONG, test_obj);
+        FromLong.attemptConversion(TO_SHORT, test_obj);
+        FromLong.attemptConversion(TO_BIGDECIMAL, test_obj);
+        FromLong.attemptConversion(TO_BIGINTEGER, test_obj);
+        FromLong.attemptConversion(TO_DATE, test_obj);
+        FromLong.attemptConversion(TO_STRING, test_obj);
+    }
+    
+    /**
+     * testLongExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from long is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testLongExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromLong = new Test("longVal", LONG_VAL_INDEX);
+        
+        FromLong.initialize(long.class, "Long", new Long(7000L), test_obj);
+
+//        FromLong.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromLong.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromLong.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+        FromLong.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+        FromLong.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromLong.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+    
+    /**
+     * testShortConversion verifies the conversion from short to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testShortConversion(DataObject test_obj) throws Exception
+    {
+        Test FromShort = new Test("shortVal", SHORT_VAL_INDEX);
+        
+        FromShort.initialize(short.class, "Short", new Short("-8000"), test_obj);
+        
+        FromShort.attemptConversion(TO_BYTE, test_obj);
+        FromShort.attemptConversion(TO_DOUBLE, test_obj);
+        FromShort.attemptConversion(TO_FLOAT, test_obj);
+        FromShort.attemptConversion(TO_INT, test_obj);
+        FromShort.attemptConversion(TO_LONG, test_obj);
+        FromShort.attemptConversion(TO_SHORT, test_obj);
+        FromShort.attemptConversion(TO_STRING, test_obj);
+    }    
+    
+    /**
+     * testShortExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from short is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testShortExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromShort = new Test("shortVal", SHORT_VAL_INDEX);
+        
+        FromShort.initialize(short.class, "Short", new Short("-8000"), test_obj);
+
+//        FromShort.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromShort.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromShort.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+        FromShort.checkConversionException(TO_BIGDECIMAL, ClassCastException.class, test_obj);
+        FromShort.checkConversionException(TO_BIGINTEGER, ClassCastException.class, test_obj);
+        FromShort.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromShort.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+        FromShort.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromShort.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+    
+    /**
+     * testStringConversion verifies the conversion from String to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testStringConversion(DataObject test_obj) throws Exception
+    {
+        Test FromString = new Test("stringVal", STRING_VAL_INDEX);
+        
+        FromString.initialize(String.class, "String", "5", test_obj);
+        
+        FromString.attemptConversion(TO_BOOLEAN, test_obj);
+        FromString.attemptConversion(TO_BYTE, test_obj);
+        FromString.attemptConversion(TO_CHAR, test_obj);
+        FromString.attemptConversion(TO_DOUBLE, test_obj);
+        FromString.attemptConversion(TO_FLOAT, test_obj);
+        FromString.attemptConversion(TO_INT, test_obj);
+        FromString.attemptConversion(TO_LONG, test_obj);
+        FromString.attemptConversion(TO_SHORT, test_obj);
+        FromString.attemptConversion(TO_BIGDECIMAL, test_obj);
+        FromString.attemptConversion(TO_BIGINTEGER, test_obj);
+        FromString.attemptConversion(TO_STRING, test_obj);
+
+        FromString.initialize(String.class, "String", "1999-07-25T8:50:14.33Z", test_obj);
+        FromString.attemptConversion(TO_DATE, test_obj);
+    }
+
+    /**
+     * testStringExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from String is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testStringExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromString = new Test("stringVal", STRING_VAL_INDEX);
+        
+        FromString.initialize(String.class, "String", "5", test_obj);
+        
+//        FromString.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+        FromString.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+        FromString.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromString.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+    
+    /**
+     * testBytesConversion verifies the conversion from Bytes to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testBytesConversion(DataObject test_obj) throws Exception
+    {
+        Test FromBytes = new Test("bytesVal", BYTES_VAL_INDEX);
+        
+        FromBytes.initialize(byte[].class, "Bytes", new byte[] {10,100}, test_obj);
+        
+        FromBytes.attemptConversion(TO_BYTES, test_obj);
+        FromBytes.attemptConversion(TO_BIGINTEGER, test_obj);
+    }
+
+    /**
+     * testBytesExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from Bytes is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testBytesExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromBytes = new Test("bytesVal", BYTES_VAL_INDEX);
+        
+        FromBytes.initialize(byte[].class, "Bytes", new byte[] {10,100}, test_obj);
+        
+//        FromBytes.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_BYTE, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_DOUBLE, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_FLOAT, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_INT, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_LONG, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_SHORT, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_BIGDECIMAL, ClassCastException.class, test_obj);
+        FromBytes.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+//        FromBytes.checkConversionException(TO_STRING, ClassCastException.class, test_obj);
+        FromBytes.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromBytes.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+      
+    /**
+     * testBigDecimalConversion verifies the conversion from BigDecimal to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testBigDecimalConversion(DataObject test_obj) throws Exception
+    {
+        Test FromBigDecimal = new Test("decimalVal", DECIMAL_VAL_INDEX);
+        
+        FromBigDecimal.initialize(BigDecimal.class, "BigDecimal", new BigDecimal("-3"), test_obj);
+        
+        FromBigDecimal.attemptConversion(TO_DOUBLE, test_obj);
+        FromBigDecimal.attemptConversion(TO_FLOAT, test_obj);
+        FromBigDecimal.attemptConversion(TO_INT, test_obj);
+        FromBigDecimal.attemptConversion(TO_LONG, test_obj);
+        FromBigDecimal.attemptConversion(TO_BIGDECIMAL, test_obj);
+        FromBigDecimal.attemptConversion(TO_BIGINTEGER, test_obj);
+        FromBigDecimal.attemptConversion(TO_STRING, test_obj);
+    }
+    
+    /**
+     * testBigDecimalExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from BigDecimal is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testBigDecimalExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromBigDecimal = new Test("decimalVal", DECIMAL_VAL_INDEX);
+        
+        FromBigDecimal.initialize(BigDecimal.class, "BigDecimal", new BigDecimal("-3"), test_obj);
+
+//        FromBigDecimal.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromBigDecimal.checkConversionException(TO_BYTE, ClassCastException.class, test_obj);
+//        FromBigDecimal.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromBigDecimal.checkConversionException(TO_SHORT, ClassCastException.class, test_obj);
+//        FromBigDecimal.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+        FromBigDecimal.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromBigDecimal.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+        FromBigDecimal.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromBigDecimal.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+    
+    /**
+     * testBigIntegerConversion verifies the conversion from BigInteger to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testBigIntegerConversion(DataObject test_obj) throws Exception
+    {
+        Test FromBigInteger = new Test("integerVal", INTEGER_VAL_INDEX);
+        
+        FromBigInteger.initialize(BigInteger.class, "BigInteger", new BigInteger("31500"), test_obj);
+        
+        FromBigInteger.attemptConversion(TO_DOUBLE, test_obj);
+        FromBigInteger.attemptConversion(TO_FLOAT, test_obj);
+        FromBigInteger.attemptConversion(TO_INT, test_obj);
+        FromBigInteger.attemptConversion(TO_LONG, test_obj);
+        FromBigInteger.attemptConversion(TO_SHORT, test_obj); 
+        FromBigInteger.attemptConversion(TO_BYTES, test_obj);
+        FromBigInteger.attemptConversion(TO_BIGDECIMAL, test_obj);
+        FromBigInteger.attemptConversion(TO_BIGINTEGER, test_obj);
+        FromBigInteger.attemptConversion(TO_STRING, test_obj);
+    }
+    
+    /**
+     * testBigIntegerExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from BigInteger is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testBigIntegerExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromBigInteger = new Test("integerVal", INTEGER_VAL_INDEX);
+        
+        FromBigInteger.initialize(BigInteger.class, "BigInteger", new BigInteger("31500"), test_obj);
+
+//        FromBigInteger.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromBigInteger.checkConversionException(TO_BYTE, ClassCastException.class, test_obj);
+//        FromBigInteger.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+        FromBigInteger.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+//        FromBigInteger.checkConversionException(TO_DATE, ClassCastException.class, test_obj);
+        FromBigInteger.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromBigInteger.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+
+    /**
+     * testDateConversion verifies the conversion from Date to each of the allowed types.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testDateConversion(DataObject test_obj) throws Exception
+    {
+        Test FromDate = new Test("dateVal", DATE_VAL_INDEX);
+        
+        FromDate.initialize(Date.class, "Date", new Date(System.currentTimeMillis()), test_obj);
+        
+        FromDate.attemptConversion(TO_LONG, test_obj);
+        FromDate.attemptConversion(TO_DATE, test_obj);
+        FromDate.attemptConversion(TO_STRING, test_obj);
+    }    
+    
+    /**
+     * testDateExceptions verifies that the appropriate Exceptions are thrown when an unpermitted conversion
+     * from Date is attempted.
+     * @param test_obj
+     * @throws Exception
+     */
+    
+    private void testDateExceptions(DataObject test_obj) throws Exception
+    {
+        Test FromDate = new Test("dateVal", DATE_VAL_INDEX);
+        
+        FromDate.initialize(Date.class, "Date", new Date(System.currentTimeMillis()), test_obj);
+        
+//        FromDate.checkConversionException(TO_BOOLEAN, ClassCastException.class, test_obj);
+//        FromDate.checkConversionException(TO_BYTE, ClassCastException.class, test_obj);
+//        FromDate.checkConversionException(TO_CHAR, ClassCastException.class, test_obj);
+//        FromDate.checkConversionException(TO_DOUBLE, ClassCastException.class, test_obj);
+//        FromDate.checkConversionException(TO_FLOAT, ClassCastException.class, test_obj);
+//        FromDate.checkConversionException(TO_INT, ClassCastException.class, test_obj);
+//        FromDate.checkConversionException(TO_SHORT, ClassCastException.class, test_obj);
+//        FromDate.checkConversionException(TO_BYTES, ClassCastException.class, test_obj);
+//        FromDate.checkConversionException(TO_BIGDECIMAL, ClassCastException.class, test_obj);
+//        FromDate.checkConversionException(TO_BIGINTEGER, ClassCastException.class, test_obj);
+        FromDate.checkConversionException(TO_DATAOBJECT, ClassCastException.class, test_obj);
+        FromDate.checkConversionException(TO_LIST, ClassCastException.class, test_obj);
+        FromDate.checkConversionException(TO_SEQUENCE, ClassCastException.class, test_obj);
+    }
+}
\ No newline at end of file

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

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

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeCreateUtility.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeCreateUtility.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeCreateUtility.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeCreateUtility.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,209 @@
+package test.sdo21.scenarios;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XSDHelper;
+
+public class TypeCreateUtility
+{
+    
+    /**
+     * createDynamicWithStaticResources creates the DataObject type from an existing
+     * XSD.  The same XSD is used to create the Types statically using the XSD2JavaGenerator.
+     * The XSD should be kept in synch with the createDynamically method in this class.
+     * @throws IOException
+     */
+	
+	public static void createDynamicWithStaticResources() throws IOException
+    {
+        // Populate the meta data for the test model (APITest)
+        URL url = TypeCreateUtility.class.getResource(FVTUtil.TEST_MODEL);
+        InputStream inputStream = url.openStream();
+        XSDHelper.INSTANCE.define(inputStream, url.toString());
+        inputStream.close();
+    }
+	
+	/**
+	 * TODO:  DAS Adheres to an existing type
+	 */
+	
+	public static void createDASAdherence()
+	{
+
+	}
+	
+	/**
+	 * TODO:  DAS dynamically generates the type
+	 */
+	public static void createDASDynamically()
+	{
+	
+	}
+	
+	/**
+	 * createDynamically() creates the SDO Types using the TypeHelper.  This method should be kept in
+	 * synch with the XSD used for createDynamicallyWithStaticResources.  The same XSD is used for
+	 * the static generation of SDO Types using XSD2JavaGenerator.
+	 */
+	public static void createDynamically()
+    {
+    	TypeHelper types = TypeHelper.INSTANCE;
+    	Type stringType = types.getType("commonj.sdo", "String");
+    	Type intType = types.getType("commonj.sdo", "Int");
+    	Type booleanType = types.getType("commonj.sdo", "Boolean");
+    	Type byteType = types.getType("commonj.sdo", "Byte");
+    	Type decimalType = types.getType("commonj.sdo", "Decimal");
+    	Type floatType = types.getType("commonj.sdo", "Float");
+    	Type doubleType = types.getType("commonj.sdo", "Double");
+    	Type dateType = types.getType("commonj.sdo", "Date");
+    	Type shortType = types.getType("commonj.sdo", "Short");
+    	Type longType = types.getType("commonj.sdo", "Long");
+    	Type bytesType = types.getType("commonj.sdo", "Bytes");
+    	Type integerType = types.getType("commonj.sdo", "Integer");
+    	Type charType = types.getType("commonj.sdo", "Character");
+//    	Type dateXSDType = types.getType("http://www.w3.org/2001/XMLSchema", "date");
+//    	Collection aliases = new ArrayList();
+      
+    	DataObject abstractTypeDO = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+    	abstractTypeDO.set("uri", FVTUtil.TEST_NAMESPACE);
+    	abstractTypeDO.set("name", "Abstract");
+    	abstractTypeDO.setBoolean("abstract", true);
+    	abstractTypeDO.setBoolean("sequenced", true);
+    	
+        DataObject firstProperty = abstractTypeDO.createDataObject("property");
+        firstProperty.set("name", "firstName");
+        firstProperty.set("type", stringType);
+        
+        DataObject lastProperty = abstractTypeDO.createDataObject("property");
+        lastProperty.set("name", "lastName");
+        lastProperty.set("type", stringType);
+    	
+    	Type abstractType = types.define(abstractTypeDO);
+        
+    	DataObject sequenceTypeDO = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+    	sequenceTypeDO.set("uri", FVTUtil.TEST_NAMESPACE);
+    	sequenceTypeDO.set("name", "Sequenced");
+    	sequenceTypeDO.setBoolean("sequenced", true);
+    	
+    	List baseTypes = new ArrayList();
+    	baseTypes.add(abstractType);
+    	sequenceTypeDO.setList("baseType", baseTypes);
+    
+        // TODO:  Uncomment the following when SDOUtil.addAliasName is implemented
+    	/*      aliases.clear();
+    	        aliases.add("Seq2");
+    	        sequenceTypeDO.set("aliasName", aliases);
+    	*/   
+    	
+        DataObject Letters = sequenceTypeDO.createDataObject("property");
+        Letters.set("name", "Letters");
+        Letters.set("type", stringType);
+        Letters.setBoolean("many", true);
+        
+        DataObject Numbers = sequenceTypeDO.createDataObject("property");
+        Numbers.set("name", "Numbers");
+        Numbers.set("type", intType);
+        Numbers.setBoolean("many", true);
+        
+        Type sequenceType = types.define(sequenceTypeDO);
+        
+    	DataObject testType = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+    	testType.set("uri", FVTUtil.TEST_NAMESPACE);
+    	testType.set("name", FVTUtil.TEST_TYPE);
+    	
+        DataObject stringProperty = testType.createDataObject("property");
+        stringProperty.set("name", "stringVal");
+        stringProperty.set("type", stringType);
+        
+        DataObject booleanProperty = testType.createDataObject("property");
+        booleanProperty.set("name", "booleanVal");
+        booleanProperty.set("type", booleanType);
+        
+        DataObject boolean2Property = testType.createDataObject("property");
+        boolean2Property.set("name", "booleanVal2");
+        boolean2Property.set("type", booleanType);
+        
+        DataObject byteProperty = testType.createDataObject("property");
+        byteProperty.set("name", "byteVal");
+        byteProperty.set("type", byteType);
+        
+        DataObject string2Property = testType.createDataObject("property");
+        string2Property.set("name", "stringVal2");
+        string2Property.set("type", stringType);
+        
+        DataObject decimalProperty = testType.createDataObject("property");
+        decimalProperty.set("name", "decimalVal");
+        decimalProperty.set("type", decimalType);
+        
+        DataObject decimal2Property = testType.createDataObject("property");
+        decimal2Property.set("name", "decimalVal2");
+        decimal2Property.set("type", decimalType);
+        
+        // TODO:  Uncomment the following when SDOUtil.addAliasName is implemented
+/*      aliases.clear();
+        aliases.add("Dec2");
+        decimal2Property.set("aliasName", aliases);
+*/        
+        DataObject intProperty = testType.createDataObject("property");
+        intProperty.set("name", "intVal");
+        intProperty.set("type", intType);
+        
+        DataObject floatProperty = testType.createDataObject("property");
+        floatProperty.set("name", "floatVal");
+        floatProperty.set("type", floatType);
+        
+        DataObject doubleProperty = testType.createDataObject("property");
+        doubleProperty.set("name", "doubleVal");
+        doubleProperty.set("type", doubleType);
+        
+        DataObject dateProperty = testType.createDataObject("property");
+        dateProperty.set("name", "dateVal");
+        dateProperty.set("type", dateType);
+        
+        DataObject shortProperty = testType.createDataObject("property");
+        shortProperty.set("name", "shortVal");
+        shortProperty.set("type", shortType);
+        
+        DataObject longProperty = testType.createDataObject("property");
+        longProperty.set("name", "longVal");
+        longProperty.set("type", longType);
+
+        DataObject childrenProperty = testType.createDataObject("property");
+        childrenProperty.set("name", "children");
+        childrenProperty.setBoolean("many", true);
+        childrenProperty.setBoolean("containment", true);
+        childrenProperty.set("type", testType);
+        
+        DataObject bytesProperty = testType.createDataObject("property");
+        bytesProperty.set("name", "bytesVal");
+        bytesProperty.set("type", bytesType);
+        
+        DataObject integerProperty = testType.createDataObject("property");
+        integerProperty.set("name", "integerVal");
+        integerProperty.set("type", integerType);
+        
+        DataObject charProperty = testType.createDataObject("property");
+        charProperty.set("name", "charVal");
+        charProperty.set("type", charType);
+        
+/*      Problem with dateXSDType - prevents subsequent properties
+        DataObject dateXSDProperty = testType.createDataObject("property");
+        dateXSDProperty.set("name", "dateXSDVal");
+        dateXSDProperty.set("type", dateXSDType);
+*/        
+        DataObject sequenceProperty = testType.createDataObject("property");
+        sequenceProperty.set("name", "sequencedElem");
+        sequenceProperty.set("type", sequenceType);
+            
+        types.define(testType);
+    }
+}
\ No newline at end of file

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

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

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeHelperScenario.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeHelperScenario.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeHelperScenario.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeHelperScenario.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,199 @@
+package test.sdo21.scenarios;
+
+import java.util.ArrayList;
+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.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.impl.HelperProvider;
+
+public class TypeHelperScenario
+{
+    
+    /**
+     * testTypeHelperAPI tests the methods in the TypeHelper API
+     * @param testDO
+     * @throws ReturnValueError, ExpectedExceptionError, ExpectedConditionError
+     */
+    
+    public static void testTypeHelperAPI (DataObject testDO) throws ReturnValueError, ExpectedExceptionError, ExpectedConditionError
+    {
+        Type testType = testDO.getType();    
+        
+        TypeHelper types = HelperProvider.getTypeHelper();
+        Type stringType = types.getType("commonj.sdo", "String");
+        Type intType = types.getType("commonj.sdo", "Int");
+        boolean errorCaught;
+        
+        /**
+         * Verify the performance of TypeHelper.getType(URI, Name) and TypeHelper.getType(Class)
+         */
+        
+        Type returnedType = types.getType(testType.getURI(), testType.getName());
+        
+        if (!(FVTUtil.areEqualTypes(returnedType, testType)))
+            throw new ReturnValueError("TypeHelper.getType(URI, Name) did not return the expected Type.",
+                    testType, returnedType);
+        
+        if (testType.getInstanceClass() != null)
+        {
+            returnedType = types.getType(testType.getInstanceClass());
+            if (!(FVTUtil.areEqualTypes(returnedType, testType)))
+                throw new ReturnValueError("TypeHelper.getType(Class) did not return the expected Type.",
+                        testType, returnedType);
+        }
+        
+        /**
+         * Verify the proper performance of TypeHelper.getType(Class) when a non-SDO class is passed to TypeHelper.getType(Class)
+         */
+        
+        returnedType = types.getType(TypeHelperScenario.class);
+        if (returnedType != null)
+            throw new ReturnValueError("Types.getType(Class) should return null when no Type was defined for the interface Class.");
+        
+        /**
+         * Verify the proper performance of TypeHelper.getClass(URI, Name) when the namespace for URI does not include Name
+         */
+        
+        returnedType = types.getType(testDO.getType().getURI(),  "UndefinedName");
+        if (returnedType != null)
+            throw new ReturnValueError("Types.getType(URI, Name) should return null when no Type has the indicated Name in the URI namespace.");
+
+        /**
+         * Verify the proper performance of TypeHelper.getClass(URI, Name) when the Name exists but not in the namespace of the URI
+         */
+        
+        returnedType = types.getType("UndefinedURI",  testDO.getType().getName());
+        if (returnedType != null)
+            throw new ReturnValueError("Types.getType(URI, Name) should return null when no Type has the indicated Name in the URI namespace.");
+
+        /**
+         * Verify the performance of TypeHelper.define(DataObject)
+         */
+        
+        DataObject defineTypeDO = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+        defineTypeDO.set("uri", FVTUtil.TEST_NAMESPACE);
+        defineTypeDO.set("name", "DefinedType");
+        DataObject IDProperty = defineTypeDO.createDataObject("property");
+        IDProperty.set("name", "ID");
+        IDProperty.set("type", stringType);
+        Type definedType = types.define(defineTypeDO);
+      
+        /**
+         * Attempt to create an instance of the newly defined Type.
+         */
+        
+        DataObject result = DataFactory.INSTANCE.create(FVTUtil.TEST_NAMESPACE, defineTypeDO.getString("name"));
+        if (   result == null 
+            || !(result.getType().getName().equals("DefinedType"))
+            || result.getProperty("ID") == null)
+            throw new ExpectedConditionError("TypeHelper.define(DataObject) did not create a Type that could be instantiated.");
+
+        result = DataFactory.INSTANCE.create(definedType);
+        if (   result == null 
+                || !(result.getType().getName().equals("DefinedType"))
+                || result.getProperty("ID") == null)
+                throw new ExpectedConditionError("TypeHelper.define(DataObject) did not create a Type that could be instantiated.");
+
+        /**
+         * Verify the performance of TypeHelper.define(List)
+         */
+        
+        DataObject define1 = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+        define1.set("uri", FVTUtil.TEST_NAMESPACE);
+        define1.set("name", "Define1Type");
+        DataObject firstNameProperty = define1.createDataObject("property");
+        firstNameProperty.set("name", "firstName");
+        firstNameProperty.set("type", stringType);
+        
+        DataObject define2 = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+        define2.set("uri", FVTUtil.TEST_NAMESPACE);
+        define2.set("name", "Define2Type"); 
+        DataObject lastNameProperty = define2.createDataObject("property");
+        lastNameProperty.set("name", "lastName");
+        lastNameProperty.set("type", stringType);
+        
+        List DOList = new ArrayList();
+        DOList.add(define1);
+        DOList.add(define2);
+        
+        types.define(DOList);
+
+        result = DataFactory.INSTANCE.create(FVTUtil.TEST_NAMESPACE, define1.getString("name"));  
+        if (result == null 
+                || !(result.getType().getName().equals("Define1Type"))
+                || result.getProperty("firstName") == null)
+            throw new ExpectedConditionError("TypeHelper.define(List) did not create a Type that could be instantiated.");
+  
+        result = DataFactory.INSTANCE.create(FVTUtil.TEST_NAMESPACE, define2.getString("name"));         
+        if (result == null 
+                || !(result.getType().getName().equals("Define2Type"))
+                || result.getProperty("lastName") == null)
+            throw new ExpectedConditionError("TypeHelper.define(List) did not create a Type that could be instantiated.");
+       
+       //TODO:  Determine what should happen when a Type is redefined (same URI & Name, but different properties).
+       //               When this is known, uncomment the following and supply the appropriate test.
+       //               While it's not clear to what should happen (from the spec), what is happening is that there is no 
+       //               notification of the duplication, and the originally defined Type is returned by the define() in the latter instance.
+        
+        /*
+        
+        DataObject define3 = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+        define3.set("uri", FVTUtil.TEST_NAMESPACE);
+        define3.set("name", "Define2Type");
+        DataObject numProperty = define3.createDataObject("property");
+        numProperty.set("name", "num");
+        numProperty.set("type",intType);
+         
+        definedType = types.define(define3);
+        */
+        
+        /**
+         * Attempt TypeHelper.define(List) when a member of the List is not a DataObject.
+         */
+      
+        DataObject define4 = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+        define4.set("uri", FVTUtil.TEST_NAMESPACE);
+        define4.set("name", "Define4Type");
+        DataObject ID1Property = define4.createDataObject("property");
+        ID1Property.set("name", "ID1");
+        ID1Property.set("type", intType);
+
+        DataObject define5 = DataFactory.INSTANCE.create("commonj.sdo", "Type");
+        define5.set("uri", FVTUtil.TEST_NAMESPACE);
+        define5.set("name", "Define5Type"); 
+        DataObject ID2Property = define5.createDataObject("property");
+        ID2Property.set("name", "ID2");
+        ID2Property.set("type", intType);
+ 
+        DOList.clear();
+        DOList.add(define4);
+        DOList.add("A");
+        DOList.add(define5);
+
+        try
+        {
+            errorCaught = false;
+            types.define(DOList);
+        }
+        catch (Exception e)
+        {
+            errorCaught = true;
+        }
+        
+        if (!errorCaught)
+               throw new ExpectedExceptionError("TypeHelper.define(List) should throw an Exception when the List contains a member "
+                                                                         + "that is not a DataObject");
+
+        //TODO:  Determine whether the other members of the list (particularly those preceeding the non DataObject) should
+        // now be defined Types.  Not clear in the spec what should happen.   What currently happens is that those members
+        // before the Exception are defined, but those after (in the List) are not.  Because of the Exception, there is no 
+        // return value from define(List).  This would require some involved error-case checking by the user to recover from.
+    }
+}
\ No newline at end of file

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

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

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeScenario.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeScenario.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeScenario.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/TypeScenario.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,218 @@
+package test.sdo21.scenarios;
+
+import java.util.List;
+
+import test.sdo21.framework.ReturnValueError;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.TypeHelper;
+
+public class TypeScenario
+{
+    /**
+     * testTypeAPI is used to test the methods of the Type object
+     * their return values.
+     * @param testDO
+     * @throws ReturnValueError
+     */
+    
+    public static void testTypeAPI (DataObject testDO) throws ReturnValueError
+    {
+    	Type type = testDO.getType();
+    	Type booleanType = testDO.getProperty("booleanVal").getType();
+    	Type sequencedType = testDO.getProperty("sequencedElem").getType();
+    	Type abstractType = TypeHelper.INSTANCE.getType(FVTUtil.TEST_NAMESPACE, "Abstract");
+    	Class instanceClass;
+    	
+    	/**
+    	 * Verify the accuracy of Type.getName() and Type.getURI()
+    	 */
+    	
+    	if (!(type.getName().equals(FVTUtil.TEST_TYPE)))
+    		throw new ReturnValueError("Type.getName() returned an unexpected value.", FVTUtil.TEST_TYPE, type.getName());
+    	
+    	if (!(type.getURI().equals(FVTUtil.TEST_NAMESPACE)))
+    		throw new ReturnValueError("Type.getURI() returned an unexpected value.", FVTUtil.TEST_NAMESPACE, type.getURI());
+    	
+    	/**
+    	 * Verify the accuracy of Type.getInstanceClass().  For the dynamic cases it will return null.  For the static
+    	 * case it will return com.ibm.sdo.fvt.staticSdo.APITest.
+    	 */
+    	
+    	instanceClass = type.getInstanceClass();
+    	if (instanceClass != null && !(instanceClass.getName().equals("com.ibm.sdo.fvt.staticSdo.APITest")))
+    		throw new ReturnValueError("Type.getInstanceClass() did not return the expected value.");
+    	
+    	/**
+    	 * Verify Type.isInstance() == true and == false
+    	 */
+        if (type.isInstance(booleanType))
+    		throw new ReturnValueError("Type.getInstance() returned an unexpected value.", 
+    				new Boolean(false), new Boolean(true));   
+        
+    	if (!(type.isInstance(testDO)))
+    		throw new ReturnValueError("Type.getInstance() returned an unexpected value.", 
+    				new Boolean(true), new Boolean(false));
+    	
+    	/**
+    	 * Verify Type.isDataType() == true and == false
+    	 */
+    	if (type.isDataType())
+    		throw new ReturnValueError("Type.isDataType() returned an unexpected value.", 
+    				new Boolean(false), new Boolean(true));
+    	
+    	if (!(booleanType.isDataType()))
+    		throw new ReturnValueError("Type.isDataType() returned an unexpected value.", 
+    				new Boolean(true), new Boolean(false));
+    	  	
+    	/** 
+    	 * Verify Type.isSequenced() == true and == false
+    	 */
+    	if (type.isSequenced())
+    		throw new ReturnValueError("Type.isSequenced() returned an unexpected value.", 
+    				new Boolean(false), new Boolean(true));
+    	
+    	if (!(sequencedType.isSequenced()))
+    		throw new ReturnValueError("Type.isSequenced() returned an unexpected value.", 
+    				new Boolean(true), new Boolean(false));   
+    	
+    	/**
+    	 * Verify Type.isOpen() == true and == false
+    	 */
+    	// TODO  Verify isOpen == true
+    	
+    	if (type.isOpen())
+    		throw new ReturnValueError("Type.isOpen() returned an unexpected value.", 
+    				new Boolean(false), new Boolean(true));
+    	
+    	/** 
+    	 * Verify Type.isAbstract() == true and == false
+    	 */
+    	if (type.isAbstract())
+    		throw new ReturnValueError("Type.isAbstract() returned an unexpected value.", 
+    				new Boolean(false), new Boolean(true));
+    	
+    	if (!(abstractType.isAbstract()))
+    		throw new ReturnValueError("Type.isAbstract() returned an unexpected value.", 
+    				new Boolean(true), new Boolean(false));
+    	
+    	/**
+    	 * Verify Type.getBaseTypes() for empty and nonempty Lists of BaseTypes.
+    	 */
+    	if (type.getBaseTypes().size() != 0)
+    		throw new ReturnValueError("Type.getBaseTypes() returned a List of unexpected size.",
+    				Integer.valueOf(0), type.getBaseTypes());
+    	
+    	if (sequencedType.getBaseTypes().size() == 0)
+    		throw new ReturnValueError("Type.getBaseTypes() did not return the expected base type.");
+    		
+    	/**
+    	 * Verify Type.getAliasNames for empty and nonempty Lists of alias names.
+    	 */
+    	List aliases = type.getAliasNames();
+    	if (aliases.size() != 0)
+    		throw new ReturnValueError("Type.getAliasNames() returned a List of unexpected size.",
+    				Integer.valueOf(0), Integer.valueOf(aliases.size()));
+    	
+    // TODO:  Uncomment the following when SDOUtil.addAliasName is implemented
+    /*	
+    	aliases = sequencedType.getAliasNames();
+    	if (aliases.size() != 1)
+    		throw new ReturnValueError("Type.getAliasNames() returned a List of unexpected size.",
+    				Integer.valueOf(1), Integer.valueOf(aliases.size()));
+    	else if (aliases.get(1).equals("Seq2"))
+    		throw new ReturnValueError("Type.getAliasNames() returned a List with unexpected contents.",
+    				"Seq2", aliases.get(0));;
+    	*/	
+    	
+    	/** 
+    	 * Verify the Lists returned by Type.getProperties() and Type.getDeclaredProperties()
+    	 */
+    	if (!verifyPropertyList(type.getProperties()))
+    		throw new ReturnValueError("Type.getProperties() did not return the expected List.");
+    	
+    	if (!verifyPropertyList(type.getDeclaredProperties()))
+    		throw new ReturnValueError("Type.getProperties() did not return the expected List.");
+    	
+    	/**
+    	 * Verify the accuracy of Type.getProperty()
+    	 */
+    	Property returnedProp = type.getProperty("booleanVal");
+    	if (!(returnedProp.getName().equals("booleanVal")))
+    		throw new ReturnValueError("Type.getProperty() returned an unexpected Property.",
+    				"booleanVal", returnedProp.getName());
+    	
+    	/**
+    	 * Verify the handling of an inaccurate name by Type.getProperty()
+    	 */
+    	if (type.getProperty("madeUpName") != null)
+    		throw new ReturnValueError("Type.getProperty() returned an unexpected Property.",
+    				null, type.getProperty("madeUpName").getName());
+    }
+    
+    /**
+     * verifyPropertyList is a private method used to ensure that all expected Properties are contained in the input List
+     * @param properties
+     * @return
+     */
+    private static boolean verifyPropertyList(List properties)
+    {
+    	boolean stringValFound = false, booleanValFound=false, booleanVal2Found = false, byteValFound = false;
+        boolean stringVal2Found = false, 	decimalValFound = false, 	decimalVal2Found = false, intValFound = false;
+        boolean floatValFound = false, doubleValFound = false, dateValFound = false, shortValFound = false, longValFound = false;
+        boolean childrenFound = false, bytesValFound = false, integerValFound = false, 	charValFound = false, sequencedElemFound = false;
+        
+    	Property currProperty;
+    	for (int i = 0; i < properties.size(); i++)
+    	{
+    		currProperty = (Property) properties.get(i);
+    		
+    		if (!stringValFound && currProperty.getName().equals("stringVal"))
+    			stringValFound = true;
+    		else if (!booleanValFound && currProperty.getName().equals("booleanVal"))
+    			booleanValFound = true;
+    		else if (!booleanVal2Found && currProperty.getName().equals("booleanVal2"))
+    			booleanVal2Found = true;
+    		else if (!byteValFound && currProperty.getName().equals("byteVal"))
+    			byteValFound = true;
+    		else if (!stringVal2Found && currProperty.getName().equals("stringVal2"))
+    			stringVal2Found = true;    			
+    		else if (!decimalValFound && currProperty.getName().equals("decimalVal"))
+    			decimalValFound = true;    		
+    		else if (!decimalVal2Found && currProperty.getName().equals("decimalVal2"))
+    			decimalVal2Found = true;  
+    		else if (!intValFound && currProperty.getName().equals("intVal"))
+    			intValFound = true;  
+    		else if (!floatValFound && currProperty.getName().equals("floatVal"))
+    			floatValFound = true;  
+    		else if (!doubleValFound && currProperty.getName().equals("doubleVal"))
+    			doubleValFound = true;  
+    		else if (!dateValFound && currProperty.getName().equals("dateVal"))
+    			dateValFound = true;  
+    		else if (!shortValFound && currProperty.getName().equals("shortVal"))
+    			shortValFound = true;  
+    		else if (!longValFound && currProperty.getName().equals("longVal"))
+    			longValFound = true;  
+    		else if (!childrenFound && currProperty.getName().equals("children"))
+    			childrenFound = true;  
+    		else if (!bytesValFound && currProperty.getName().equals("bytesVal"))
+    			bytesValFound = true;  
+    		else if (!integerValFound && currProperty.getName().equals("integerVal"))
+    			integerValFound = true;      		
+    		else if (!charValFound && currProperty.getName().equals("charVal"))
+    			charValFound = true;      	
+    		else if (!sequencedElemFound && currProperty.getName().equals("sequencedElem"))
+    			sequencedElemFound = true;      
+    	}
+    	
+    	if (stringValFound && booleanValFound && booleanVal2Found && byteValFound && stringVal2Found 
+    			&& decimalValFound && decimalVal2Found && intValFound && floatValFound && doubleValFound 
+    			&& dateValFound && shortValFound && longValFound && childrenFound && bytesValFound 
+    			&& integerValFound && charValFound && sequencedElemFound)
+            return true;
+    	else
+    		return false;
+    }
+}
\ No newline at end of file

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

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

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/XMLScenario.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/XMLScenario.java?view=auto&rev=494066
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/XMLScenario.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/XMLScenario.java Mon Jan  8 05:34:57 2007
@@ -0,0 +1,46 @@
+package test.sdo21.scenarios;
+
+import java.io.IOException;
+
+import test.sdo21.framework.ExpectedConditionError;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.EqualityHelper;
+
+public class XMLScenario
+{
+    /**
+     * Serialize the DataObject then Deserialize the output.  Result should be equivalent
+     * to testDO.
+     * @param testDO
+     * @throws IOException
+     * @throws EqualityConditionError 
+     * @throws ClassNotFoundException 
+     */
+    
+    public static void testSerializeDeserialize (DataObject testDO) throws IOException, ExpectedConditionError, ClassNotFoundException 
+    {    	
+    	FVTUtil.populateFields(testDO);
+    	FVTUtil.serializeDataObject(testDO, "temporaryFile");
+    	DataObject tempDO = FVTUtil.deserializeDataObject("temporaryFile");
+    	
+    	// TODO:  Remove the unsets and return equalShallow to equal when CMVC defect 404384 is resolved. 
+    	// NOTE:  The temporary masks (unset and equal->equalShallow) seem only to work for the dynamic case.
+
+    	tempDO.unset("bytesVal");
+    	testDO.unset("bytesVal");
+    	
+        if (!(EqualityHelper.INSTANCE.equalShallow(testDO, tempDO)))
+        	throw new ExpectedConditionError("Serialization and deserialization resulted in a nonequivalent DataObject.");   	
+    }
+
+    /**
+     * testFaultyXML verifies that appropriate exception is thrown when an invalid 
+     * XML document is specified.  It will also test the condition that an XML document 
+     * is in itself valid, but does not comply with the XSD.
+     */
+    public static void testFaultyXML (DataObject testDO)
+    {
+    	//TODO:   complete
+    }
+}
\ No newline at end of file

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

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/XMLScenario.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