[PATCH] Tuscany-543 DAS: Consider using a URI to identify Static SDO Types in config model
Attached is a patch to switch our runtime and existing static type tests over to using an SDO type URI in the config rather than the name of a single Type. Brent Index: src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java === --- src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java (revision 422736) +++ src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java (working copy) @@ -61,7 +61,19 @@ } +public void testUnregisteredTypes() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig(staticCustomer.xml), getConnection()); +Command readCustomers = das.createCommand(select * from CUSTOMER where ID = 1); +try { +readCustomers.executeQuery(); + +fail(Exception should be thrown); +} catch (RuntimeException ex) { +assertEquals(SDO Types have not been registered for URI http:///org.apache.tuscany.das.rdb.test/customer.xsd;, ex.getMessage()); +} +} + public void testMissingMapping() throws Exception { SDOUtil.registerStaticTypes(CustomerFactory.class); DAS das = DAS.FACTORY.createDAS(getConfig(staticCustomer.xml), getConnection()); Index: src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java === --- src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java (revision 422736) +++ src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java (working copy) @@ -48,7 +48,7 @@ t.setTypeName(Customer); mapping.getTable().add(t); - mapping.setDataObjectModel(org.apache.tuscany.das.rdb.test.customer.Customer); + mapping.setDataObjectModel(http:///org.apache.tuscany.das.rdb.test/customer.xsd;); } public ReadCustomersStaticTypesCommand() { Index: src/test/resources/staticCustomer.xml === --- src/test/resources/staticCustomer.xml (revision 422736) +++ src/test/resources/staticCustomer.xml (working copy) @@ -16,7 +16,7 @@ -- Config xsi:noNamespaceSchemaLocation=http:///org.apache.tuscany.das.rdb/config.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; -dataObjectModel=org.apache.tuscany.das.rdb.test.customer.Customer +dataObjectModel=http:///org.apache.tuscany.das.rdb.test/customer.xsd; /Config Index: src/test/resources/companyMappingWithConverters.xml === --- src/test/resources/companyMappingWithConverters.xml (revision 422736) +++ src/test/resources/companyMappingWithConverters.xml (working copy) @@ -15,7 +15,8 @@ limitations under the License. -- Config xsi:noNamespaceSchemaLocation=http:///org.apache.tuscany.das.rdb/config.xsd; -xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; dataObjectModel=org.apache.tuscany.das.rdb.test.company.CompanyType +xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; +dataObjectModel=org.apache.tuscany.das.rdb.test/company.xsd Table tableName=COMPANY typeName=CompanyType Column columnName=ID primaryKey=true/ Index: src/test/resources/staticCustomerOrder.xml === --- src/test/resources/staticCustomerOrder.xml (revision 422736) +++ src/test/resources/staticCustomerOrder.xml (working copy) @@ -16,7 +16,7 @@ -- Config xsi:noNamespaceSchemaLocation=http:///org.apache.tuscany.das.rdb/config.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; -dataObjectModel=org.apache.tuscany.das.rdb.test.customer.Customer +dataObjectModel=http:///org.apache.tuscany.das.rdb.test/customer.xsd; Command name=Customer and Orders SQL=SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ? kind=Select/ Index: src/test/resources/basicStaticCustomer.xml === --- src/test/resources/basicStaticCustomer.xml (revision 422736) +++ src/test/resources/basicStaticCustomer.xml (working copy) @@ -16,7 +16,7 @@ -- Config xsi:noNamespaceSchemaLocation=http:///org.apache.tuscany.das.rdb/config.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; -dataObjectModel=org.apache.tuscany.das.rdb.test.customer.Customer +dataObjectModel=http:///org.apache.tuscany.das.rdb.test/customer.xsd; Table tableName=CUSTOMER typeName=Customer Column columnName=ID primaryKey=true/ Index: src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java === ---
Re: [PATCH] Tuscany-543 DAS: Consider using a URI to identify Static SDO Types in config model
A couple of updates for this.. Required changes to bigbank were not included in the original patch. Also, a new test added in the patch needed to be updated because existing registered static types could cause it to fail. These two patches replace the patch file I sent earlier. Brent On 7/17/06, Brent Daniel [EMAIL PROTECTED] wrote: Attached is a patch to switch our runtime and existing static type tests over to using an SDO type URI in the config rather than the name of a single Type. Brent Index: src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java === --- src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java (revision 422736) +++ src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java (working copy) @@ -61,7 +61,19 @@ } +public void testUnregisteredTypes() throws Exception { + DAS das = DAS.FACTORY.createDAS(getConfig(staticInvalid.xml), getConnection()); +Command readCustomers = das.createCommand(select * from CUSTOMER where ID = 1); +try { +readCustomers.executeQuery(); + +fail(Exception should be thrown); +} catch (RuntimeException ex) { +assertEquals(SDO Types have not been registered for URI invalidURI, ex.getMessage()); +} +} + public void testMissingMapping() throws Exception { SDOUtil.registerStaticTypes(CustomerFactory.class); DAS das = DAS.FACTORY.createDAS(getConfig(staticCustomer.xml), getConnection()); Index: src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java === --- src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java (revision 422736) +++ src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java (working copy) @@ -48,7 +48,7 @@ t.setTypeName(Customer); mapping.getTable().add(t); - mapping.setDataObjectModel(org.apache.tuscany.das.rdb.test.customer.Customer); + mapping.setDataObjectModel(http:///org.apache.tuscany.das.rdb.test/customer.xsd;); } public ReadCustomersStaticTypesCommand() { Index: src/test/resources/staticInvalid.xml === --- /dev/null (revision 0) +++ src/test/resources/staticInvalid.xml(revision 0) @@ -0,0 +1,22 @@ +?xml version=1.0 encoding=ASCII? +!-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + Licensed under the Apache License, Version 2.0 (the License); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an AS IS BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + -- +Config xsi:noNamespaceSchemaLocation=http:///org.apache.tuscany.das.rdb/config.xsd; +xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; +dataObjectModel=invalidURI + + +/Config Index: src/test/resources/staticCustomer.xml === --- src/test/resources/staticCustomer.xml (revision 422736) +++ src/test/resources/staticCustomer.xml (working copy) @@ -16,7 +16,7 @@ -- Config xsi:noNamespaceSchemaLocation=http:///org.apache.tuscany.das.rdb/config.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; -dataObjectModel=org.apache.tuscany.das.rdb.test.customer.Customer +dataObjectModel=http:///org.apache.tuscany.das.rdb.test/customer.xsd; /Config Index: src/test/resources/companyMappingWithConverters.xml === --- src/test/resources/companyMappingWithConverters.xml (revision 422736) +++ src/test/resources/companyMappingWithConverters.xml (working copy) @@ -15,7 +15,8 @@ limitations under the License. -- Config xsi:noNamespaceSchemaLocation=http:///org.apache.tuscany.das.rdb/config.xsd; -xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; dataObjectModel=org.apache.tuscany.das.rdb.test.company.CompanyType +xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; +dataObjectModel=org.apache.tuscany.das.rdb.test/company.xsd Table tableName=COMPANY typeName=CompanyType Column columnName=ID primaryKey=true/ Index: src/test/resources/staticCustomerOrder.xml === --- src/test/resources/staticCustomerOrder.xml (revision 422736) +++