[ https://issues.apache.org/jira/browse/TUSCANY-1845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534421 ]
Ron Gavlin commented on TUSCANY-1845: ------------------------------------- Below, I have included a test to expose the problem. The test should be enhanced to include all SDO types and not just the three currently listed. I have also attached a stacktrace which demonstrates the current problem for "DateTime". I believe "Day" and several other types also have problems. Below the stacktrace, I have included a patch to SDODataTypes which fixes the problems for "DateTime" and "Day". Let me know if you have questions. - Ron Index: C:/development/working/1/tuscany-das/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java =================================================================== --- C:/development/working/1/tuscany-das/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java (revision 584191) +++ C:/development/working/1/tuscany-das/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java (working copy) @@ -28,10 +28,16 @@ import org.apache.tuscany.das.rdb.Command; import org.apache.tuscany.das.rdb.DAS; +import org.apache.tuscany.das.rdb.impl.SDODataTypeHelper; import org.apache.tuscany.das.rdb.test.data.TypesData; import org.apache.tuscany.das.rdb.test.framework.DasTest; +import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl; import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.impl.HelperProvider; public class TypeTests extends DasTest { @@ -40,6 +46,15 @@ new TypesData(getAutoConnection()).refresh(); } + public void testTypeMapping() throws Exception { + TypeHelper typeHelper = HelperProvider.getDefaultContext().getTypeHelper(); + String[] sdoTypeNames = new String[] {"Date", "DateTime", "Day"}; + for (int i = 0; i < sdoTypeNames.length; i++) { + Type sdoType = typeHelper.getType(ModelFactoryImpl.NAMESPACE_URI, sdoTypeNames[i]); + SDODataTypeHelper.columnTypeForSDOType(sdoType); + } + } + /** * Read various types. */ java.lang.RuntimeException: Not a valid SDO Type [EMAIL PROTECTED] (name: DateTime) (instanceClassName: java.lang.String) (serializable: true) at org.apache.tuscany.das.rdb.impl.SDODataTypeHelper.columnTypeForSDOType(SDODataTypeHelper.java:105) at org.apache.tuscany.das.rdb.test.TypeTests.testTypeMapping(TypeTests.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Index: C:/development/working/1/tuscany-das/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java =================================================================== --- C:/development/working/1/tuscany-das/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java (revision 584191) +++ C:/development/working/1/tuscany-das/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypes.java (working copy) @@ -44,10 +44,10 @@ public static final Type DATE = TYPE_HELPER.getType("commonj.sdo", "Date"); public static final String DATE_STR = "commonj.sdo.Date"; - public static final Type DATETIME = TYPE_HELPER.getType("commonj.sdo", "Date"); - public static final String DATETIME_STR = "commonj.sdo.Date"; + public static final Type DATETIME = TYPE_HELPER.getType("commonj.sdo", "DateTime"); + public static final String DATETIME_STR = "commonj.sdo.DateTime"; - public static final Type DAY = TYPE_HELPER.getType("commonj.sdo", "Date"); + public static final Type DAY = TYPE_HELPER.getType("commonj.sdo", "Day"); public static final String DAY_STR = "commonj.sdo.Day"; public static final Type DECIMAL = TYPE_HELPER.getType("commonj.sdo", "Float"); > SDODataTypeHelper.columnTypeForSDOType() throws RuntimeException for > "DateTime" SDO Type. > ----------------------------------------------------------------------------------------- > > Key: TUSCANY-1845 > URL: https://issues.apache.org/jira/browse/TUSCANY-1845 > Project: Tuscany > Issue Type: Bug > Components: Java DAS RDB > Affects Versions: Java-DAS-Next > Environment: Windows XP, Sun JDK 1.4.2_11 > Reporter: Ron Gavlin > Fix For: Java-DAS-Next > > > When SDODataTypeHelper.columnTypeForSDOType(Type sdoType) is invoked for > sdoType "DateTime", a RuntimeException is thrown. It appears that > SDODataTypes.DATETIME is being initialized incorrectly. There are other > constants in SDODataTypes that also appear to be initialized incorrectly. I > would suggest that the initialization of all constants in SDODataTypes be > reviewed for accuracy. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]