diff options
Diffstat (limited to 'tags/java-M1-20060522/java/das/rdb/src/test/java')
87 files changed, 0 insertions, 12386 deletions
diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java deleted file mode 100644 index 8099ddd38b..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.List; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.CommandGroup; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; -import org.apache.tuscany.das.rdb.test.data.DepEmpData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.data.EmployeeData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class BestPracticeTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - new EmployeeData(getAutoConnection()).refresh(); - new CompanyDeptData(getAutoConnection()).refresh(); - new DepEmpData(getAutoConnection()).refresh(); - - } - - //Read list of companies - public void testReadCompanies() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); - Command read = commandGroup.getCommand("all companies"); - DataObject root = read.executeQuery(); - assertEquals(3, root.getList("COMPANY").size()); - - } - - //Read list of companies - public void testReadCompaniesWithDepartments() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); - Command read = commandGroup.getCommand("all companies and departments"); - DataObject root = read.executeQuery(); - DataObject firstCompany = root.getDataObject("COMPANY[1]"); - List departments = firstCompany.getList("departments"); - assertEquals(0, departments.size()); - - } - - public void testddDepartmentToFirstCompany() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); - Command read = commandGroup.getCommand("all companies and departments"); - DataObject root = read.executeQuery(); - DataObject firstCustomer = root.getDataObject("COMPANY[1]"); - int deptCount = firstCustomer.getList("departments").size(); - - DataObject newDepartment = root.createDataObject("DEPARTMENT"); - firstCustomer.getList("departments").add(newDepartment); - - ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); - apply.execute(root); - - //verify - root = read.executeQuery(); - firstCustomer = root.getDataObject("COMPANY[1]"); - assertEquals (deptCount + 1, firstCustomer.getList("departments").size()); - } - - /** - * Test ability to correctly flush heirarchy of objects that have generated - * keys - */ - public void testFlushCreateHeirarchy() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); - Command select = commandGroup.getCommand("all companies and departments"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // Create a new Department - //Do not set ID or CompanyID since these are generated - DataObject department = root.createDataObject("DEPARTMENT"); - department.setString("NAME", "Do-rite Pest Control"); - department.setString("LOCATION", "The boonies"); - department.setString("NUMBER", "101"); - - // Associate the new department with the new company - company.getList("departments").add(department); - - // Get apply command - ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); - apply.setConnection(getConnection()); - - // Flush changes - apply.execute(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - - select = commandGroup.getCommand("company by id with departments"); - select.setParameterValue("ID", id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]") - .getString("NAME")); - - } - - /** - * Test ability to get an empty graph with the Types/Properties intact - */ - public void testGetEmptyGraph() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); - - Command select = commandGroup.getCommand("company by id with departments"); - Integer idOfNoExistingCompany = new Integer(-1); - select.setParameterValue("ID", idOfNoExistingCompany); - DataObject root = select.executeQuery(); - - //Will fail if there is no property named "COMPANY" - assertEquals(0, root.getList("COMPANY").size()); - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java deleted file mode 100644 index 35def7e677..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java +++ /dev/null @@ -1,124 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CUDGeneration extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - /** - * This tests provides invalid SQL and should fail on Apply.execute. If not - * then the engine is generating CUD and overlooking the provided - * statements. - */ - public void testCUDGeneration1() throws Exception { - - // Read customer with particular ID - Command select = Command.FACTORY - .createCommand("Select * from CUSTOMER where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Build apply changes command - ApplyChangesCommand apply = Command.FACTORY - .createApplyChangesCommand(getConfig("basicCustomerMappingWithInvalidCUD.xml")); - apply.setConnection(getConnection()); - - // Flush changes - try { - apply.execute(root); - fail("Should fail with invalid SQL. Provided CUD not used!!"); - } catch (RuntimeException e) { - // Everything OK - } - - } - - public void testInsertCUDGeneration() throws Exception { - Command select = Command.FACTORY - .createCommand("Select * from CUSTOMER where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject customer = root.createDataObject("CUSTOMER"); - customer.setInt("ID", 720); - customer.set("LASTNAME", "foobar"); - customer.set("ADDRESS", "asdfasdf"); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - apply.execute(root); - - select = Command.FACTORY - .createCommand("select * from CUSTOMER where ID = 720"); - select.setConnection(getConnection()); - root = select.executeQuery(); - - assertEquals(1, root.getList("CUSTOMER").size()); - } - - public void testReadModifyApply() throws Exception { - - // Build the select command to read a specific customer and related - // orders - Command select = Command.FACTORY - .createCommand( - "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", - getConfig("1xM_mapping_no_cud.xml")); - - // Parameterize the command - select.setConnection(getConnection()); - select.setParameterValue("ID", new Integer(1)); - - // Get the graph - DataObject root = select.executeQuery(); - - // Modify a customer - DataObject customer = (DataObject) root.get("Customer[1]"); - customer.set("LASTNAME", "Pavick"); - - // Modify an order - DataObject order = (DataObject) customer.get("orders[1]"); - order.setString("PRODUCT", "Kitchen Sink 001"); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("1xM_mapping_no_cud.xml")); - apply.setConnection(getConnection()); - - // Flush changes - apply.execute(root); - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java deleted file mode 100644 index dcadd27d2f..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * This test - * - */ - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.CommandGroup; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -/** - * - * This tests use of the XML Config file. Tests will utilize the - * customer-orders-orderdetails tables. The plan is for the config file to have - * a section that applies to all commands and another that applies to specific - * commands. - * - * The config file will be used to initialize a command factory that will then - * return named commands. - * - * There will be two read commands: - * - * 1) Return all customers 2) Return a specific customer (by ID) and related - * orders and order details - * - * A test will demonstrate the creation of the factory and then reuse of - * commands created from the same config data file - * - */ -public class CommandGroupTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read - */ - public void testRead() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomersOrdersConfig.xml")); - commandGroup.setConnection(getConnection()); - - Command read = commandGroup.getCommand("all customers"); - DataObject root = read.executeQuery(); - - assertEquals(5, root.getList("CUSTOMER").size()); - - } - - /** - * Read an order using parm marker - */ - public void testReadWithParmmarker() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml")); - - Command read = commandGroup.getCommand("order by id with ?"); - read.setParameterValue(1, new Integer(1)); - DataObject root = read.executeQuery(); - - assertEquals("recombobulator", root.getString("ANORDER[1]/PRODUCT")); - - } - - /** - * Specify connection properties in config - */ - public void testReadWithConnectionProperties() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml")); - - Command read = commandGroup.getCommand("all customers"); - DataObject root = read.executeQuery(); - - assertEquals(5, root.getList("CUSTOMER").size()); - - } - - /** - * Specify connection properties in config. Add explicit update command - */ - public void testUpdate() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml")); - - Command read = commandGroup.getCommand("all customers"); - DataObject root = read.executeQuery(); - // Verify precondition - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - int id = root.getInt("CUSTOMER[1]/ID"); - - Command update = commandGroup.getCommand("update customer"); - update.setParameterValue("ID", new Integer(id)); - update.execute(); - - // Verify update - reuse select command - root = read.executeQuery(); - assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME")); - - } - - /** - * Read all customers, select a specific customer. Then read that customer - * and related orders. Modify an order and flush changes back - */ - public void testRead2() throws Exception { - - // Create the group and set common connection - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomersOrdersConfig.xml")); - commandGroup.setConnection(getConnection()); - - // Read all customers and remember the first one - Command read = commandGroup.getCommand("all customers"); - DataObject root = read.executeQuery(); - Integer id = (Integer) root.get("CUSTOMER[1]/ID"); - - // Read the specific Customer from above and its related orders - Command custOrders = commandGroup.getCommand("customer and orders"); - custOrders.setParameterValue("ID", id); - root = custOrders.executeQuery(); - - // Modify the first order and flush this change back to the database - root.setString("CUSTOMER[1]/orders[1]/PRODUCT", "Defibrillator"); - Integer orderId = (Integer) root.get("CUSTOMER[1]/orders[1]/ID"); - ApplyChangesCommand flush = commandGroup.getApplyChangesCommand(); - flush.execute(root); - - // Verify - Command orderByID = commandGroup.getCommand("order by id"); - orderByID.setParameterValue("ID", orderId); - assertEquals("Defibrillator", root.getString("ANORDER[1]/PRODUCT")); - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java deleted file mode 100644 index 011f1791e9..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.company.CompanyFactory; -import org.apache.tuscany.das.rdb.test.company.CompanyType; -import org.apache.tuscany.das.rdb.test.company.DatagraphRoot; -import org.apache.tuscany.das.rdb.test.company.DepartmentType; -import org.apache.tuscany.das.rdb.test.company.EmployeeType; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; -import org.apache.tuscany.das.rdb.test.data.DepEmpData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.data.EmployeeData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.TypeHelper; - -public class CompanyTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - new EmployeeData(getAutoConnection()).refresh(); - new CompanyDeptData(getAutoConnection()).refresh(); - new DepEmpData(getAutoConnection()).refresh(); - - } - - public void testSimple() throws Exception { - - // Build the select command - Command selectCommand = Command.FACTORY.createCommand("select COMPANY.NAME, " - + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " - + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.NUMBER from COMPANY, DEPARTMENT, EMPLOYEE " - + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID", getConfig("companyMapping.xml")); - - // Parameterize the command - selectCommand.setConnection(getConnection()); - - // Get the graph - DataObject root = selectCommand.executeQuery(); - - // Get a company - DataObject company = (DataObject) root.getList("CompanyType").get(0); - assertEquals("MegaCorp", company.get("NAME")); - - // Get a department - DataObject department = (DataObject) company.getList("departments").get(0); - assertEquals("Advanced Technologies", department.get("NAME")); - - DataObject employee = (DataObject) department.getList("employees").get(0); - assertEquals("John Jones", employee.get("NAME")); - } - - public void testSimpleStatic() throws Exception { - - SDOUtil.registerStaticTypes(CompanyFactory.class); - // Build the select command - Command selectCommand = Command.FACTORY.createCommand("select COMPANY.NAME, " - + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " - + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.NUMBER from COMPANY, DEPARTMENT, EMPLOYEE " - + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID", getConfig("companyMappingWithConverters.xml")); - - // Parameterize the command - selectCommand.setConnection(getConnection()); - selectCommand.setDataObjectModel(TypeHelper.INSTANCE.getType(DatagraphRoot.class)); - - // Get the graph - DatagraphRoot root = (DatagraphRoot) selectCommand.executeQuery(); - - - CompanyType company = (CompanyType) root.getCompanies().get(0); - - assertEquals("MegaCorp", company.getName()); - - // Get a department - DepartmentType department = (DepartmentType) company.getDepartments().get(0); - assertEquals("Advanced Technologies", department.getName()); - - EmployeeType employee = (EmployeeType) department.getEmployees().get(0); - - assertEquals("John Jones", employee.getName()); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java deleted file mode 100644 index 7a3ae9b5ed..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.Key; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -/** - * Tests for Compound Keys - */ -public class CompoundKeyTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new OrderDetailsData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testRead() throws Exception { - - Command getOrderDetails = Command.FACTORY - .createCommand("Select * from ORDERDETAILS where ORDERID = :ORDERID AND PRODUCTID = :PRODUCTID"); - getOrderDetails.setConnection(getConnection()); - - getOrderDetails.setParameterValue("ORDERID", new Integer(1)); - getOrderDetails.setParameterValue("PRODUCTID", new Integer(1)); - - DataObject root = getOrderDetails.executeQuery(); - - DataObject orderDetail = (DataObject) root.get("ORDERDETAILS[1]"); - assertEquals(1.1f, orderDetail.getFloat("PRICE"), 0.01); - - } - - public void testReadModifyWrite2() throws Exception { - - Command getOrderDetails = Command.FACTORY - .createCommand("Select * from ORDERDETAILS where ORDERID = 1 AND PRODUCTID = 1"); - getOrderDetails.setConnection(getConnection()); - DataObject root = getOrderDetails.executeQuery(); - - DataObject orderDetails = (DataObject) root.get("ORDERDETAILS[1]"); - assertEquals(1.1f, orderDetails.getFloat("PRICE"), 0.01); - - // Modify - orderDetails.setFloat("PRICE", 0f); - - // Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("OrdersOrderDetailsConfig.xml")); - apply.setConnection(getConnection()); - - // Write - apply.execute(root); - - // Verify - root = getOrderDetails.executeQuery(); - orderDetails = root.getDataObject("ORDERDETAILS[1]"); - assertEquals(0f, orderDetails.getFloat("PRICE"), 0.01); - - } - - public void testReadOrdersAndDetails2() throws Exception { - - Command read = Command.FACTORY - .createCommand("SELECT * FROM ANORDER LEFT JOIN ORDERDETAILS ON ANORDER.ID = ORDERDETAILS.ORDERID ORDER BY ANORDER.ID", getConfig("OrdersOrderDetailsConfig.xml")); - read.setConnection(getConnection()); - - DataObject root = read.executeQuery(); - - DataObject firstOrder = root.getDataObject("ANORDER[1]"); - assertEquals(1, firstOrder.getInt("ID")); - assertEquals(2, firstOrder.getList("ORDERDETAILS").size()); - - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java deleted file mode 100644 index d0f94018cd..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ResultSetShape; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - - -import commonj.sdo.DataObject; -import commonj.sdo.Type; - -/** - * Tests the Converter framwork - */ -public class ConverterTests extends DasTest { - - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - - protected void tearDown() throws Exception { - super.tearDown(); - } - - private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); - - private static Date kbday; - private static Date tbday; - - static { - try { - kbday = myformat.parse("1957.09.27"); - tbday = myformat.parse("1966.12.20"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - - - /** - * This tests the use of an arbitrary converter. The column converted is a VARCAHAR. - * ResultSetShape is used to specify that the property will be a SDODataTypes.DATE. - * - * So this example uses a converter that transforms a string column into a date property - * and conversely, a date property back to a string for the underlying column. - * - * The converter returns 1957.09.27 if the column value is "Williams" and 1966.12.20 - * if the value is "Pavick" - * - * On write, the converter returns "Pavick" if the property value is 1966.12.20 - * and "Williams" if the property value is 1957.09.27 - * - */ - public void testArbitraryConverter() throws Exception { - - //Create and initialize command to read customers - Command read = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1", getConfig("CustomerConfigWithConverter.xml")); - read.setConnection(getConnection()); - - String[] columns = { "ID", "LASTNAME", "ADDRESS" }; - String[] tables = { "CUSTOMER", "CUSTOMER", "CUSTOMER" }; - Type[] types = { SDODataTypes.INTEGEROBJECT, SDODataTypes.DATE, SDODataTypes.STRING }; - ResultSetShape shape = new ResultSetShape(tables, columns, types); - read.setResultSetShape(shape); - - //Read - DataObject root = read.executeQuery(); - - //Verify - assertEquals(kbday, root.getDate("CUSTOMER[1]/LASTNAME")); - - //Modify - root.setDate("CUSTOMER[1]/LASTNAME", tbday); - - ApplyChangesCommand write = Command.FACTORY.createApplyChangesCommand(getConfig("CustomerConfigWithConverter.xml")); - write.setConnection(getConnection()); - write.execute(root); - - //Read - root = read.executeQuery(); - - //Verify - assertEquals(tbday, root.getDate("CUSTOMER[1]/LASTNAME")); - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java deleted file mode 100644 index c7aa9cbb6d..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java +++ /dev/null @@ -1,244 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * These tests attempt to duplicate customer reported errors and then to verify - * any necessary fix. - * - */ - -import java.util.Iterator; -import java.util.Random; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.CommandGroup; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CorrectedDefectTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - new CompanyDeptData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Dilton's bug for adding new child data object - */ - public void testAddNewOrder() throws Exception { - - // Read some customers and related orders - Command select = Command.FACTORY.createCommand( - "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID", - getConfig("CustomersOrdersConfig.xml")); - select.setConnection(getConnection()); - - DataObject root = select.executeQuery(); - - DataObject cust = root.getDataObject("CUSTOMER[1]"); - - // Save ID and Order Count - int custID = cust.getInt("ID"); - int custOrderCount = cust.getList("orders").size(); - - // Create a new Order and add to customer1 - DataObject order = root.createDataObject("ANORDER"); - - order.set("ID", new Integer(99)); - order.set("PRODUCT", "The 99th product"); - order.set("QUANTITY", new Integer(99)); - cust.getList("orders").add(order); - - assertEquals(custOrderCount + 1, cust.getList("orders").size()); - // Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("CustomersOrdersConfig.xml")); - apply.setConnection(getConnection()); - - // Flush changes - apply.execute(root); - - // verify cust1 relationship updates - select = Command.FACTORY - .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID",getConfig("CustomersOrdersConfig.xml")); - select.setConnection(getConnection()); - select.setParameterValue("ID", new Integer(custID)); - root = select.executeQuery(); - - assertEquals(custOrderCount + 1, root.getList("CUSTOMER[1]/orders").size()); - - } - - public void testDiltonsInsertWorkaround() throws Exception { - - // String sql = "insert into conmgt.serverstatus (statusid, - // managedserverid, timestamp) values (316405209, 316405209, '2005-11-23 - // 19:29:52.636')"; - // String sql = "insert into conmgt.serverstatus (managedserverid, - // timestamp) values (316405209, '2005-11-23 19:29:52.636')"; - String sql = "insert into conmgt.serverstatus (managedserverid, timestamp) values (:serverid, :timestamp)"; - - Command insert = Command.FACTORY.createCommand(sql); - insert.setParameterValue("serverid", new Integer(316405209)); - insert.setParameterValue("timestamp", "2005-11-23 19:29:52.636"); - insert.setConnection(getConnection()); - insert.execute(); - - // Verify - Command select = Command.FACTORY.createCommand("Select * from conmgt.serverstatus"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("SERVERSTATUS").size()); - - } - - public void testWASDefect330118() throws Exception { - - // Create the group and set common connection - CommandGroup commandGroup = CommandGroup.FACTORY - .createCommandGroup(getConfig("CustomersOrdersConfig.xml")); - commandGroup.setConnection(getConnection()); - - // Read all customers and add one - Command read = commandGroup.getCommand("all customers"); - DataObject root = read.executeQuery(); - int numCustomers = root.getList("CUSTOMER").size(); - - DataObject newCust = root.createDataObject("CUSTOMER"); - newCust.set("ID", new Integer(100)); - newCust.set("ADDRESS", "5528 Wells Fargo Drive"); - newCust.set("LASTNAME", "Gerkin"); - - // Now delete this new customer - newCust.delete(); - - ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); - apply.execute(root); - - // Verify - root = read.executeQuery(); - assertEquals(numCustomers, root.getList("CUSTOMER").size()); - - } - - /** - * Should be able to explicitly set a parameter to null. But, should require - * that the parameter type is set. - */ - public void testDiltonsNullParameterBug1() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); - insert.setConnection(getConnection()); - insert.setParameterValue("ID", new Integer(10)); - insert.setParameterValue("LASTNAME", null); - insert.setParameterType("LASTNAME", SDODataTypes.STRING); - insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); - insert.execute(); - - // Verify - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - /** - * Error by not setting a parameter - */ - public void testDiltonsNullParameterBug2() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); - insert.setConnection(getConnection()); - insert.setParameterValue("ID", new Integer(10)); - // insert.setParameterValue("LASTNAME", null); - insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); - - try { - insert.execute(); - fail(); - } catch (RuntimeException e) { - // Expected since "LASTNAME" parameter not set - } - } - - /** - * Set parameter to empty string - */ - public void testDiltonsNullParameterBug3() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); - insert.setConnection(getConnection()); - insert.setParameterValue("ID", new Integer(10)); - insert.setParameterValue("LASTNAME", ""); - insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); - insert.execute(); - - // Verify - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - public void testUpdateChildThatHasGeneratedKey() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); - - // Read a specific company based on the known ID - Command readCust = commandGroup.getCommand("all companies and departments"); - DataObject root = readCust.executeQuery(); - DataObject lastCustomer = root.getDataObject("COMPANY[3]"); - Iterator i = lastCustomer.getList("departments").iterator(); - Random generator = new Random(); - int random = generator.nextInt(1000) + 1; - DataObject department; - while (i.hasNext()) { - department = (DataObject) i.next(); - // System.out.println("Modifying department: " + - // department.getString("NAME")); - department.setString("NAME", "Dept-" + random); - random = random + 1; - } - - ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); - apply.execute(root); - - } - -}
\ No newline at end of file diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java deleted file mode 100644 index 7a82558de6..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java +++ /dev/null @@ -1,377 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * This provdes the simplest examples that make use of the change history. The assumptions are: - * - * Single type - * Change history utilized - * Dynamic DataObjects - * - * - */ - -import java.util.Iterator; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class CrudWithChangeHistory - extends DasTest -{ - - protected void setUp() - throws Exception - { - super.setUp(); - new CustomerData( getAutoConnection() ).refresh(); - new OrderDetailsData( getAutoConnection() ).refresh(); - } - - protected void tearDown() - throws Exception - { - super.tearDown(); - } - - /** - * Read and modify a customer. - * Provide needed Create/Update/Delete statements programatically - */ - public void testReadModifyApply() - throws Exception - { - - //Read customer 1 - Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = 1" ); - select.setConnection( getConnection() ); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get( "CUSTOMER[1]" ); - - //Modify customer - customer.set( "LASTNAME", "Pavick" ); - - //Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection( getConnection() ); - - //Manually create and add update command - Command update = Command.FACTORY.createCommand( "update CUSTOMER set LASTNAME = :LASTNAME where ID = :ID" ); - update.addParameter( "LASTNAME", SDODataTypes.STRING ); - update.addParameter( "ID", SDODataTypes.INTEGER ); - apply.addUpdateCommand( customer.getType(), update ); - - //Flush changes - apply.execute( root ); - - //Verify changes - root = select.executeQuery(); - assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) ); - - } - - /** - * Read and modify a customer. - * Provide needed Create/Update/Delete statements via xml file - */ - public void testReadModifyApply1() - throws Exception - { - - //Read customer 1 - Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = 1" ); - select.setConnection( getConnection() ); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get( "CUSTOMER[1]" ); - - //Modify customer - customer.set( "LASTNAME", "Pavick" ); - - //Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerMappingWithCUD.xml")); - apply.setConnection( getConnection() ); - - //Flush changes - apply.execute( root ); - - //Verify changes - root = select.executeQuery(); - assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) ); - - } - - /** - * Same as previous but: - * Utilizes generated CUD statements - * Key info provided programatically - */ - public void testReadModifyApply2() - throws Exception - { - - //Read customer with particular ID - Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = 1" ); - select.setConnection( getConnection() ); - DataObject root = select.executeQuery(); - - DataObject customer = root.getDataObject( "CUSTOMER[1]" ); - - //Modify customer - customer.set( "LASTNAME", "Pavick" ); - - //Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection( getConnection() ); - - //Flush changes - apply.execute( root ); - - //Verify the change - root = select.executeQuery(); - assertEquals( "Pavick", root.getDataObject( "CUSTOMER[1]" ).getString( "LASTNAME" ) ); - - } - - /** - * Builds on previous but: - * 1. Key info provided via XML file - */ - public void testReadModifyApply3() - throws Exception - { - - //Read customer with particular ID - Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = 1" ); - select.setConnection( getConnection() ); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get( "CUSTOMER[1]" ); - - //Modify customer - customer.set( "LASTNAME", "Pavick" ); - - //Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerMapping.xml")); - apply.setConnection( getConnection() ); - - //Flush changes - apply.execute( root ); - - //Verify the change - root = select.executeQuery(); - assertEquals( "Pavick", root.getDataObject( "CUSTOMER[1]" ).getString( "LASTNAME" ) ); - - } - - /** - * Test ability to handle multiple changes to the graph including Creates/Updates/Deletes - * Employs generated CUD - */ - public void testReadModifyDeleteInsertApply() - throws Exception - { - - //Read some customers - Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where LASTNAME = 'Williams'" ); - select.setConnection( getConnection() ); - DataObject root = select.executeQuery(); - - DataObject cust1 = (DataObject) root.getList( "CUSTOMER" ).get( 0 ); - DataObject cust2 = (DataObject) root.getList( "CUSTOMER" ).get( 1 ); - DataObject cust3 = (DataObject) root.getList( "CUSTOMER" ).get( 2 ); - - //Modify a customer - cust1.set( "LASTNAME", "Pavick" ); - int cust1ID = cust1.getInt( "ID" ); - - //Save IDs before delete - int cust2ID = cust2.getInt( "ID" ); - int cust3ID = cust3.getInt( "ID" ); - //Delete a couple - cust2.delete(); - cust3.delete(); - - //Create a new customer - DataObject cust4 = root.createDataObject( "CUSTOMER" ); - cust4.set( "ID", new Integer( 100 ) ); - cust4.set( "ADDRESS", "5528 Wells Fargo Drive" ); - cust4.set( "LASTNAME", "Gerkin" ); - - //Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerMapping.xml")); - apply.setConnection( getConnection() ); - - //Flush changes - apply.execute( root ); - - //Verify deletes - select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = :ID" ); - select.setConnection( getConnection() ); - select.setParameterValue( "ID", new Integer( cust2ID ) ); - root = select.executeQuery(); - assertTrue( root.getList( "CUSTOMER" ).isEmpty() ); - //reparameterize same command - select.setParameterValue( "ID", new Integer( cust3ID ) ); - root = select.executeQuery(); - assertTrue( root.getList( "CUSTOMER" ).isEmpty() ); - - //verify insert - select.setParameterValue( "ID", new Integer( 100 ) ); - root = select.executeQuery(); - assertEquals( 1, root.getList( "CUSTOMER" ).size() ); - assertEquals( "5528 Wells Fargo Drive", root.getString( "CUSTOMER[1]/ADDRESS" ) ); - assertEquals( "Gerkin", root.getString( "CUSTOMER[1]/LASTNAME" ) ); - - //verify update - select.setParameterValue( "ID", new Integer( cust1ID ) ); - root = select.executeQuery(); - assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) ); - - } - - - public void testReadModifyApplyWithAssumedID() throws Exception { - - //Read customer with particular ID - Command select = Command.FACTORY - .createCommand("Select * from CUSTOMER"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject customer = root.getDataObject("CUSTOMER[1]"); - - //Modify customer - customer.set("LASTNAME", "Pavick"); - - DataObject customerForDelete = root.getDataObject("CUSTOMER[2]"); - String deletedLastName = customerForDelete.getString("LASTNAME"); - customerForDelete.delete(); - - DataObject newCustomer = root.createDataObject("CUSTOMER"); - newCustomer.set("LASTNAME", "NewCustomer"); - newCustomer.setInt("ID", 9000); - - //Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - - //Flush changes - apply.execute(root); - - //Verify the change - root = select.executeQuery(); - assertEquals("Pavick", getCustomerByLastName(root, "Pavick").getString("LASTNAME")); - assertEquals("NewCustomer", getCustomerByLastName(root, "NewCustomer").getString("LASTNAME")); - assertNull(getCustomerByLastName(root, deletedLastName)); - - } - - - public void testReadModifyApplyWithAssumedIDFailure() throws Exception { - - Command select = Command.FACTORY - .createCommand("Select * from ORDERDETAILS"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject od = root.getDataObject("ORDERDETAILS[1]"); - - //Modify customer - od.setInt("PRODUCTID", 72); - - //Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - - //Flush changes -- This should fail because Order Details does not have a column that - // we can assume to be an ID - try { - apply.execute(root); - } catch (RuntimeException ex) { - assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config")); - } - - } - - public void testReadModifyApplyWithAssumedIDFailure2() throws Exception { - - Command select = Command.FACTORY - .createCommand("Select * from ORDERDETAILS"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject od = root.getDataObject("ORDERDETAILS[1]"); - od.delete(); - - //Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - - //Flush changes -- This should fail because Order Details does not have a column that - // we can assume to be an ID - try { - apply.execute(root); - } catch (RuntimeException ex) { - assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config")); - } - - } - public void testReadModifyApplyWithAssumedIDFailure3() throws Exception { - - Command select = Command.FACTORY - .createCommand("Select * from ORDERDETAILS"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject od = root.createDataObject("ORDERDETAILS"); - - //Modify customer - od.setInt("PRODUCTID", 72); - od.setInt("ORDERID", 500); - - //Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - - //Flush changes -- This should fail because Order Details does not have a column that - // we can assume to be an ID - try { - apply.execute(root); - } catch (RuntimeException ex) { - assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config")); - } - - } - private DataObject getCustomerByLastName(DataObject root, String name) { - Iterator i = root.getList("CUSTOMER").iterator(); - while ( i. hasNext()) { - DataObject obj = (DataObject)i.next(); - if (name.equals(obj.getString("LASTNAME"))) - return obj; - } - return null; - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java deleted file mode 100644 index 1a2516aa02..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java +++ /dev/null @@ -1,303 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * These tests attempt to duplicate customer reported errors and then to verify - * any necessary fix. - * - */ - -import java.util.Iterator; -import java.util.Random; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.CommandGroup; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.DepEmpData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.data.EmployeeData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class DefectTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - new EmployeeData(getAutoConnection()).refresh(); - new CompanyDeptData(getAutoConnection()).refresh(); - new DepEmpData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read a specific customer - */ - public void testDiltonsInsert() throws Exception { - - // String sql = "insert into conmgt.serverstatus (statusid, - // managedserverid, timestamp) values (316405209, 316405209, '2005-11-23 - // 19:29:52.636')"; - String sql = "insert into conmgt.serverstatus (managedserverid, timestamp) values (316405209, '2005-11-23 19:29:52.636')"; - - Command insert = Command.FACTORY.createCommand(sql); - insert.setConnection(getConnection()); - insert.execute(); - - // Verify - Command select = Command.FACTORY - .createCommand("Select * from conmgt.serverstatus where statusid = 316405209"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("conmgt.serverstatus").size()); - - } - - - - public void testDiltonsInsertWorkaround() throws Exception { - - // String sql = "insert into conmgt.serverstatus (statusid, - // managedserverid, timestamp) values (316405209, 316405209, '2005-11-23 - // 19:29:52.636')"; - // String sql = "insert into conmgt.serverstatus (managedserverid, - // timestamp) values (316405209, '2005-11-23 19:29:52.636')"; - String sql = "insert into conmgt.serverstatus (managedserverid, timestamp) values (:serverid, :timestamp)"; - - Command insert = Command.FACTORY.createCommand(sql); - insert.setParameterValue("serverid", new Integer(316405209)); - insert.setParameterValue("timestamp", "2005-11-23 19:29:52.636"); - insert.setConnection(getConnection()); - insert.execute(); - - // Verify - Command select = Command.FACTORY.createCommand("Select * from conmgt.serverstatus"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("SERVERSTATUS").size()); - - } - - public void testWASDefect330118() throws Exception { - - // Create the group and set common connection - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomersOrdersConfig.xml")); - commandGroup.setConnection(getConnection()); - - // Read all customers and add one - Command read = commandGroup.getCommand("all customers"); - DataObject root = read.executeQuery(); - int numCustomers = root.getList("CUSTOMER").size(); - - DataObject newCust = root.createDataObject("CUSTOMER"); - newCust.set("ID", new Integer(100)); - newCust.set("ADDRESS", "5528 Wells Fargo Drive"); - newCust.set("LASTNAME", "Gerkin"); - - // Now delete this new customer - newCust.delete(); - - ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); - apply.execute(root); - - // Verify - root = read.executeQuery(); - assertEquals(numCustomers, root.getList("CUSTOMER").size()); - - } - - /** - * Yin Chen reports ... "In the class Statement, method: public int - * executeUpdate(Parameters parameters) - its tossing out RuntimeException - * when the value of the parameter is null. " - * - * His example build a update statement and sets one parameter value to be - * null. I will try to duplicate with an insert since that is simpler - * - */ - public void testYingChen12162005() throws Exception { - - Command insert = Command.FACTORY - .createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); - insert.setConnection(getConnection()); - insert.setParameterValue("ID", new Integer(10)); - insert.setParameterValue("LASTNAME", "Williams"); - insert.setParameterValue("ADDRESS", null); - insert.execute(); - - // Verify - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - /** - * Try a workaround using CommandGroup - */ - public void testYingChen12162005Workaraound() throws Exception { - - // Create the group and set common connection - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomerConfig.xml")); - commandGroup.setConnection(getConnection()); - - Command insert = commandGroup.getCommand("insert customer"); - insert.setParameterValue("ID", new Integer(10)); - insert.setParameterValue("LASTNAME", "Williams"); - insert.setParameterValue("ADDRESS", null); - insert.execute(); - - // Verify - Command select = commandGroup.getCommand("read customer 10"); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - - - - /** - * Should be able to explicitly set a parameter to null. But, should require - * that the parameter type is set. - */ - public void testDiltonsNullParameterBug1() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); - insert.setConnection(getConnection()); - insert.setParameterValue("ID", new Integer(10)); - insert.setParameterValue("LASTNAME", null); - insert.setParameterType("LASTNAME", SDODataTypes.STRING); - insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); - insert.execute(); - - //Verify - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - - /** - * Error by not setting a parameter - */ - public void testDiltonsNullParameterBug2() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); - insert.setConnection(getConnection()); - insert.setParameterValue("ID", new Integer(10)); -// insert.setParameterValue("LASTNAME", null); - insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); - - try { - insert.execute(); - fail(); - } - catch (RuntimeException e) { - //Expected since "LASTNAME" parameter not set - } - } - - /** - * Set parameter to empty string - */ - public void testDiltonsNullParameterBug3() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); - insert.setConnection(getConnection()); - insert.setParameterValue("ID", new Integer(10)); - insert.setParameterValue("LASTNAME", ""); - insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); - insert.execute(); - - //Verify - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - public void testUpdateChildThatHasGeneratedKey() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); - - //Read a specific company based on the known ID - Command readCust = commandGroup.getCommand("all companies and departments"); - DataObject root = readCust.executeQuery(); - DataObject lastCustomer = root.getDataObject("COMPANY[3]"); - Iterator i = lastCustomer.getList("departments").iterator(); - Random generator = new Random(); - int random = generator.nextInt(1000) + 1; - DataObject department; - while (i.hasNext()) { - department = (DataObject)i.next(); - System.out.println("Modifying department: " + department.getString("NAME")); - department.setString("NAME", "Dept-" + random); - random = random + 1; - } - - ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); - apply.execute(root); - - } - - - - /** - * Test problem with Random - */ - public void testRandomNumber() throws Exception { - - Random generator = new Random(); - int number = generator.nextInt(1000) + 1; - assertTrue(number > 0 & number <= 1000); - - } - - - public void testTablePropertyName() throws Exception { - - } - - - - - -}
\ No newline at end of file diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java deleted file mode 100644 index d52a34c265..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.CommandGroup; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.test.company.CompanyFactory; -import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; -import org.apache.tuscany.das.rdb.test.data.BookData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.TypeHelper; - -public class ExceptionTests extends DasTest { - - public ExceptionTests() { - super(); - } - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - new BookData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testMissingConnection() throws Exception { - Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); - try { - readCustomers.executeQuery(); - fail("RuntimeException should be thrown"); - } catch (RuntimeException ex) { - assertEquals("A DASConnection object must be specified before executing the query.", ex.getMessage()); - } - - } - - public void testMissingMapping() throws Exception { - Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); - readCustomers.setConnection(getConnection()); - SDOUtil.registerStaticTypes(CompanyFactory.class); - readCustomers.setDataObjectModel(TypeHelper.INSTANCE.getType(DataGraphRoot.class)); - - try { - readCustomers.executeQuery(); - fail("Exception should be thrown"); - } catch (RuntimeException ex) { - assertEquals("An SDO Type with name CUSTOMER was not found", ex.getMessage()); - } - - } - - /** - * Test ability to describe problem when a user passes an empty stream - */ - public void testEmptyStream() throws Exception { - try { - Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1", getConfig("NonExistingFile.xml")); - fail("Error should be thrown"); - } catch (Error e) { - assertEquals( - "Cannot load configuration from a null InputStream. Possibly caused by an incorrect config xml file name", - e.getMessage()); - } - } - - /** - * Test ability to describe problem when a user passes an empty stream - */ - public void testEmptyStream2() throws Exception { - try { - CommandGroup.FACTORY.createCommandGroup(getConfig("NonExistingFile.xml")); - fail("Error should be thrown"); - } catch (Error e) { - assertEquals( - "Cannot load configuration from a null InputStream. Possibly caused by an incorrect config xml file name", - e.getMessage()); - } - } - - - /** - * Test nice error message when Conofig does not use Aliased name - * Alis is defined for BOOK -> Book but PK config uses BOOK.BOOK_ID - * - * In this test case, the create is silently never performed!!! - * - * TODO - Uncomment out - */ - public void test_4() throws Exception { - - String statement = "SELECT * FROM BOOK WHERE BOOK.BOOK_ID = :ID"; - - // Create Table config programmatically - ConfigHelper helper = new ConfigHelper(); - helper.addTable("BOOK", "Book"); - helper.addPrimaryKey("BOOK.BOOK_ID"); - - Command select = Command.FACTORY.createCommand(statement, helper.getConfig()); - select.setConnection(getConnection()); - select.setParameterValue("ID", new Integer(1)); - - DataObject root = select.executeQuery(); - - DataObject newBook = root.createDataObject("Book"); - newBook.setString("NAME", "Ant Colonies of the Old World"); - newBook.setInt("BOOK_ID", 1001); - root.getList("Book").add(newBook); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig()); - apply.setConnection(getConnection()); - apply.execute(root); - - //Verify - select.setParameterValue("ID", new Integer(1001)); - root = select.executeQuery(); - //TODO - Uncomment to test TUSCANY-250 -// assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME")); - - } - - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java deleted file mode 100644 index 3cc6b823c0..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.List; - -import org.apache.tuscany.das.rdb.test.commands.ReadCustomersByLastnameCommand; -import org.apache.tuscany.das.rdb.test.commands.ReadCustomersCommand; -import org.apache.tuscany.das.rdb.test.commands.ReadCustomersStaticTypesCommand; -import org.apache.tuscany.das.rdb.test.commands.ReadCustomersWithShapeCommand; -import org.apache.tuscany.das.rdb.test.commands.SimpleReadCustomersWithShapeCommand; -import org.apache.tuscany.das.rdb.test.customer.Customer; -import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class GeneratedCommandTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testReadCustomers() throws Exception { - ReadCustomersCommand cmd = new ReadCustomersCommand(); - cmd.setConnection(getConnection()); - - DataObject root = cmd.executeQuery(); - assertEquals(5, root.getList("CUSTOMER").size()); - } - - public void testReadSomeCustomers() throws Exception { - ReadCustomersByLastnameCommand cmd = new ReadCustomersByLastnameCommand(); - cmd.setConnection(getConnection()); - cmd.setParameterValue("LASTNAME", "Williams"); - - DataObject root = cmd.executeQuery(); - assertEquals(4, root.getList("CUSTOMER").size()); - - } - - public void testReadCustomersStaticTypes() throws Exception { - ReadCustomersStaticTypesCommand cmd = new ReadCustomersStaticTypesCommand(); - cmd.setConnection(getConnection()); - cmd.setParameterValue("LASTNAME", "Williams"); - - DataGraphRoot root = (DataGraphRoot) cmd.executeQuery(); - - List customers = root.getCustomers(); - assertEquals(4, customers.size()); - - Customer cust1 = (Customer) customers.get(0); - assertEquals("Williams", cust1.getLastName()); - - } - - public void testSimpleReadCustomersWithShape() throws Exception { - SimpleReadCustomersWithShapeCommand cmd = new SimpleReadCustomersWithShapeCommand(); - cmd.setConnection(getConnection()); - DataObject root = cmd.executeQuery(); - assertEquals(5, root.getList("CUSTOMER").size()); - } - - public void testReadCustomersOrdersWithShape() throws Exception { - ReadCustomersWithShapeCommand cmd = new ReadCustomersWithShapeCommand(); - cmd.setConnection(getConnection()); - - DataObject root = cmd.executeQuery(); - assertEquals(5, root.getList("CUSTOMER").size()); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java deleted file mode 100644 index 28b9a2f1d8..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java +++ /dev/null @@ -1,294 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * Generated IDs - * - * - */ - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.DepartmentData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class GeneratedId extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CompanyData(getAutoConnection()).refresh(); - new DepartmentData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - // Test insert into row with generated ID - public void testInsert() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into COMPANY (NAME) values (:NAME)"); - insert.setConnection(getConnection()); - insert.setParameterValue("NAME", "AAA Rental"); - insert.execute(); - - // Verify insert - // Verify - Command select = Command.FACTORY.createCommand("Select ID, NAME from COMPANY"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - assertEquals(4, root.getList("COMPANY").size()); - assertTrue(root.getInt("COMPANY[1]/ID") > 0); - - } - - // Test back to back insertions with the same command - public void testInsert2() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into COMPANY (NAME) values (:NAME)"); - insert.setConnection(getConnection()); - insert.setParameterValue("NAME", "AAA Rental"); - insert.execute(); - - // insert another using same command - insert.setParameterValue("NAME", "BBB Rental"); - insert.execute(); - - // Verify insert - // Verify - Command select = Command.FACTORY.createCommand("Select ID, NAME from COMPANY"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - assertEquals(5, root.getList("COMPANY").size()); - - } - - // Test ability to retrieve and utilize the generated key - public void testInsert3() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into COMPANY (NAME) values (:NAME)"); - insert.setConnection(getConnection()); - insert.setParameterValue("NAME", "AAA Rental"); - insert.execute(); - Integer key = (Integer) insert.getParameterValue("generated_key"); - - // Verify insert - Command select = Command.FACTORY.createCommand("Select ID, NAME from COMPANY where ID = :ID"); - select.setConnection(getConnection()); - select.setParameterValue("ID", key); - DataObject root = select.executeQuery(); - assertEquals(key, root.get("COMPANY[1]/ID")); - - } - - // Test ability to propogate generated values back to owning data objects - public void testPropagateIds() throws Exception { - - Command select = Command.FACTORY.createCommand("Select * from COMPANY"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // Create apply command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("CompanyConfig.xml")); - apply.setConnection(getConnection()); - - // verify pre-condition (id is not there until after flush) - assertNull(company.get("ID")); - - // Flush changes - apply.execute(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - select = Command.FACTORY.createCommand("Select * from COMPANY where ID = :ID"); - select.setConnection(getConnection()); - select.setParameterValue("ID", id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME")); - - } - - /** - * Same as above but metadata provided by XML config file - */ - public void testPropagateIdsXML() throws Exception { - - Command select = Command.FACTORY.createCommand("Select * from COMPANY", - getConfig("basicCompanyMapping.xml")); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // Create apply command - ApplyChangesCommand apply = Command.FACTORY - .createApplyChangesCommand(getConfig("basicCompanyMapping.xml")); - apply.setConnection(getConnection()); - - // verify pre-condition (id is not there until after flush) - assertNull(company.get("ID")); - - // Flush changes - apply.execute(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - select = Command.FACTORY.createCommand("Select * from COMPANY where ID = :ID"); - select.setConnection(getConnection()); - select.setParameterValue("ID", id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME")); - - } - - /** - * Test ability to correctly flush heirarchy of objects that have generated - * keys - */ - public void testFlushCreateHeirarchy() throws Exception { - - String selectCompanys = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID"; - - Command select = Command.FACTORY.createCommand(selectCompanys, - getConfig("basicCompanyDepartmentMapping.xml")); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // Create a new Department - // Do not set ID or CompanyID since these are generated - // ID INT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), - // COMPANYID INT, EOTM INT - DataObject department = root.createDataObject("DEPARTMENT"); - department.setString("NAME", "Do-rite Pest Control"); - department.setString("LOCATION", "The boonies"); - department.setString("NUMBER", "101"); - - // Associate the new department with the new company - company.getList("departments").add(department); - - // Create apply command - ApplyChangesCommand apply = Command.FACTORY - .createApplyChangesCommand(getConfig("basicCompanyDepartmentMapping.xml")); - apply.setConnection(getConnection()); - - // Flush changes - apply.execute(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - String selectString = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID WHERE COMPANY.ID = :ID"; - - select = Command.FACTORY.createCommand(selectString); - select.setConnection(getConnection()); - select.setParameterValue("ID", id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME")); - - } - - /** - * Test ability to correctly flush heirarchy of objects that have generated - * keys even when a created object has legal but NULL property values - */ - public void testFlushCreateHeirarchy2() throws Exception { - - String selectCompanys = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID"; - - Command select = Command.FACTORY.createCommand(selectCompanys, - getConfig("basicCompanyDepartmentMapping.xml")); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - // Create a new Company - DataObject company = root.createDataObject("COMPANY"); - company.setString("NAME", "Do-rite Pest Control"); - - // Create a new Department - // Do not set ID or CompanyID since these are generated - // ID INT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), - // COMPANYID INT, EOTM INT - DataObject department = root.createDataObject("DEPARTMENT"); - department.setString("NAME", "Do-rite Pest Control"); - // Do not set this property to force storing NULL to DB - // department.setString("LOCATION", "The boonies"); - department.setString("NUMBER", "101"); - - // Associate the new department with the new company - company.getList("departments").add(department); - - // Create apply command - ApplyChangesCommand apply = Command.FACTORY - .createApplyChangesCommand(getConfig("basicCompanyDepartmentMapping.xml")); - apply.setConnection(getConnection()); - - // Flush changes - apply.execute(root); - - // Save the id - Integer id = (Integer) company.get("ID"); - - // Verify the change - String selectString = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID WHERE COMPANY.ID = :ID"; - - select = Command.FACTORY.createCommand(selectString); - select.setConnection(getConnection()); - select.setParameterValue("ID", id); - root = select.executeQuery(); - assertEquals("Do-rite Pest Control", root.getDataObject("COMPANY[1]").getString("NAME")); - - } - - // Test that error is thrown when no key has been generated (as in a select) - public void testRead() throws Exception { - - Command select = Command.FACTORY.createCommand("Select * from COMPANY"); - select.setConnection(getConnection()); - select.executeQuery(); - - try { - select.getParameterValue("generated_id"); - fail("Should throw Error"); - } catch (RuntimeException e) { - // OK - } - } - -}
\ No newline at end of file diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java deleted file mode 100644 index 1c8faf802f..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.ArrayList; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.merge.impl.GraphMerger; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - - -import commonj.sdo.DataObject; - -public class GraphMergeTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - } - - - public void testSingleTableMerge() throws Exception { - - Command select = Command.FACTORY - .createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where ID <= :ID"); - select.setConnection(getConnection()); - select.setParameterValue("ID", "3"); - DataObject graph1 = select.executeQuery(); - assertEquals(3, graph1.getList("CUSTOMER").size()); - - select.setParameterValue("ID", "5"); - DataObject graph2 = select.executeQuery(); - assertEquals(5, graph2.getList("CUSTOMER").size()); - - GraphMerger merger = new GraphMerger(); - merger.addPrimaryKey("CUSTOMER.ID"); - DataObject mergedGraph = merger.merge(graph1, graph2); - - assertEquals(5, mergedGraph.getList("CUSTOMER").size()); - } - - public void testSingleTableMergeThreeGraphs() throws Exception { - - Command select = Command.FACTORY - .createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where ID <= :ID"); - select.setConnection(getConnection()); - select.setParameterValue("ID", "3"); - DataObject graph1 = select.executeQuery(); - assertEquals(3, graph1.getList("CUSTOMER").size()); - - select.setParameterValue("ID", "4"); - DataObject graph2 = select.executeQuery(); - assertEquals(4, graph2.getList("CUSTOMER").size()); - - select.setParameterValue("ID", "5"); - DataObject graph3 = select.executeQuery(); - assertEquals(5, graph3.getList("CUSTOMER").size()); - - GraphMerger merger = new GraphMerger(); - merger.addPrimaryKey("CUSTOMER.ID"); - ArrayList graphs = new ArrayList(); - graphs.add(graph1); - graphs.add(graph2); - graphs.add(graph3); - DataObject mergedGraph = merger.merge(graphs); - - assertEquals(5, mergedGraph.getList("CUSTOMER").size()); - - } - - - public void testMultiTableMerge2() throws Exception { - //Read some customers and related orders - Command select = Command.FACTORY.createCommand( - "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", getConfig("CustomersOrdersConfig.xml")); - select.setConnection(getConnection()); - - select.setConnection(getConnection()); - select.setParameterValue("ID", new Integer(1)); - DataObject graph1 = select.executeQuery(); - - DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0); - assertEquals(2, customer.getList("orders").size()); - - select.setParameterValue("ID", new Integer(2)); - DataObject graph2 = select.executeQuery(); - DataObject customer2 = (DataObject)graph2.getList("CUSTOMER").get(0); - assertEquals(1, graph2.getList("CUSTOMER").size()); - assertEquals(1, customer2.getList("orders").size()); - assertEquals(2, customer2.getInt("ID")); - - GraphMerger merger = new GraphMerger(); - merger.addPrimaryKey("CUSTOMER.ID"); - merger.addPrimaryKey("ANORDER.ID"); - DataObject mergedGraph = merger.merge(graph1, graph2); - - assertEquals(3, mergedGraph.getList("ANORDER").size()); - assertEquals(2, mergedGraph.getList("CUSTOMER").size()); - - DataObject mergedCustomer = (DataObject) mergedGraph.getList("CUSTOMER").get(1); - assertEquals(2, mergedCustomer.getInt("ID")); - assertEquals(1, mergedCustomer.getList("orders").size()); - DataObject mergedOrder = (DataObject) mergedCustomer.getList("orders").get(0); - assertEquals(4, mergedOrder.getInt("ID")); - - } - - public void testMultiTableAppendSingleTable2() throws Exception { - //Read some customers and related orders - Command select = Command.FACTORY.createCommand( - "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", getConfig("CustomersOrdersConfig.xml")); - select.setConnection(getConnection()); - - select.setConnection(getConnection()); - select.setParameterValue("ID", new Integer(1)); - DataObject graph1 = select.executeQuery(); - - DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0); - assertEquals(2, customer.getList("orders").size()); - - Command select2 = Command.FACTORY.createCommand("select * from ANORDER"); - select2.setConnection(getConnection()); - DataObject graph2 = select2.executeQuery(); - assertEquals(4, graph2.getList("ANORDER").size()); - - GraphMerger merger = new GraphMerger(); - merger.addPrimaryKey("CUSTOMER.ID"); - merger.addPrimaryKey("ANORDER.ID"); - DataObject mergedGraph = merger.merge(graph1, graph2); - assertEquals(4, mergedGraph.getList("ANORDER").size()); - assertEquals(1, mergedGraph.getList("CUSTOMER").size()); - } - - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java deleted file mode 100644 index 7b127e5768..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - - -public class NameMappingTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Test ability to assign DataObject type and propertyaliases with xml file - */ - public void testRead() throws Exception { - - // Read a customer - Command select = Command.FACTORY.createCommand( - "SELECT * FROM CUSTOMER WHERE CUSTOMER.ID = 1", getConfig("customerMapping.xml")); - select.setConnection(getConnection()); - - DataObject root = select.executeQuery(); - DataObject customer = root.getDataObject("Customer[1]"); - assertEquals(1, customer.getInt("id")); - assertEquals("1212 foobar lane", customer.getString("address")); - assertEquals("Williams", customer.getString("lastname")); - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java deleted file mode 100644 index 450e78ded2..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.data.BookData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - - -import commonj.sdo.DataObject; - -public class OCCTests extends DasTest { - protected void setUp() throws Exception { - super.setUp(); - - new BookData(getAutoConnection()).refresh(); - } - - - public void testSimpleOCC() throws Exception { - - //Read a book instance - Command select = Command.FACTORY.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - DataObject book = root.getDataObject("BOOK[1]"); - //Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - // Explicitly change OCC column in database to force collision - Command update = Command.FACTORY - .createCommand("update BOOK set OCC = :OCC where BOOK_ID = 1"); - update.setConnection(getConnection()); - update.setParameterValue("OCC", new Integer(100)); - update.execute(); - - //Try to flush the change - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("BooksConfig.xml")); - apply.setConnection(getConnection()); - - try { - apply.execute(root); - fail("An OCCException should be thrown"); - } catch (RuntimeException ex) { - if ( !ex.getMessage().equals("OCC Exception") ) - throw ex; - } - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java deleted file mode 100644 index 050671e077..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.CommandGroup; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CompanyEmpData; -import org.apache.tuscany.das.rdb.test.data.EmployeeData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class OneToOneRelationshipTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CompanyData(getAutoConnection()).refresh(); - new EmployeeData(getAutoConnection()).refresh(); - new CompanyEmpData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - - /** - * Read Company and traverse to EOTM - */ - public void test1() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY - .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); - - Command read = commandGroup.getCommand("get companies with employee of the month"); - DataObject root = read.executeQuery(); - DataObject employee = root.getDataObject("COMPANY[1]/company->employee_opposite"); - - assertEquals("Mary Smith", employee.getString("NAME")); - } - - - /** - * Read Employee and traverse to Company - */ - public void test2() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY - .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); - - Command read = commandGroup.getCommand("get named employee with company"); - read.setParameterValue("NAME", "Mary Smith"); - DataObject root = read.executeQuery(); - DataObject company = root.getDataObject("EMPLOYEE[1]/company->employee"); - - assertEquals("ACME Publishing", company.getString("NAME")); - } - - - /** - * Un-assign employee O' month - */ - public void test3() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY - .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); - - Command read = commandGroup.getCommand("get companies with employee of the month"); - DataObject root = read.executeQuery(); - DataObject company = root.getDataObject("COMPANY[1]"); - company.setDataObject("company->employee_opposite", null); - assertNull(company.getDataObject("company->employee_opposite")); - - //Flush changes - commandGroup.getApplyChangesCommand().execute(root); - - //Verify - root = read.executeQuery(); - company = root.getDataObject("COMPANY[1]"); - assertNull(company.getDataObject("company->employee_opposite")); - } - - /** - * Delete employee O' month - */ - public void test4() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY - .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); - - Command read = commandGroup.getCommand("get companies with employee of the month"); - DataObject root = read.executeQuery(); - DataObject company = root.getDataObject("COMPANY[1]"); - DataObject employee = company.getDataObject("company->employee_opposite"); - employee.delete(); - assertNull(company.getDataObject("company->employee_opposite")); - - //Flush changes - commandGroup.getApplyChangesCommand().execute(root); - - //Verify - root = read.executeQuery(); - company = root.getDataObject("COMPANY[1]"); - assertNull(company.getDataObject("company->employee_opposite")); - } - - /** - * Add new employee O' month - */ - public void test5() throws Exception { - - CommandGroup commandGroup = CommandGroup.FACTORY - .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); - - Command read = commandGroup.getCommand("get companies with employee of the month"); - DataObject root = read.executeQuery(); - DataObject company = root.getDataObject("COMPANY[1]"); - - //Create a new employee - DataObject employee = root.createDataObject("EMPLOYEE"); - employee.setString ("NAME", "Joe Hotshot"); - - //Assigne a EOTM - //Strangely this statement results in "Could not find relationships" error - //although "company.setDataObject("company->employee_opposite", null);" dos not - company.setDataObject("company->employee_opposite", employee); - - //Flush changes - commandGroup.getApplyChangesCommand().execute(root); - - //Verify - root = read.executeQuery(); - company = root.getDataObject("COMPANY[1]"); - - employee = root.getDataObject("COMPANY[1]/company->employee_opposite"); - - assertEquals("Joe Hotshot", employee.getString("NAME")); - - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java deleted file mode 100644 index 1207c769e5..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.data.CityData; -import org.apache.tuscany.das.rdb.test.data.StateData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class OperationOrderingTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - CityData city = new CityData(getAutoConnection()); - StateData state = new StateData(getAutoConnection()); - - city.doDeletes(); - state.doDeletes(); - state.doInserts(); - city.doInserts(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public OperationOrderingTests() { - super(); - } - - public void testInsert() throws Exception { - Command select = Command.FACTORY - .createCommand( - "Select * from STATES inner join CITIES on STATES.ID = CITIES.STATE_ID", - getConfig("cityStates.xml")); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - int numberOfStates = root.getList("STATES").size(); - int numberOfCities = root.getList("CITIES").size(); - - DataObject atlanta = root.createDataObject("CITIES"); - atlanta.setString("NAME", "Atlanta"); - atlanta.setInt("ID", 6); - - // Create a new Company - DataObject georgia = root.createDataObject("STATES"); - georgia.setInt("ID", 4); - georgia.setString("NAME", "GA"); - - georgia.getList("cities").add(atlanta); - - // Create apply command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("cityStates.xml")); - apply.setConnection(getConnection()); - - // Flush changes - apply.execute(root); - - select.setConnection(getConnection()); - root = select.executeQuery(); - assertEquals(numberOfCities + 1, root.getList("CITIES").size()); - assertEquals(numberOfStates + 1, root.getList("STATES").size()); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java deleted file mode 100644 index 250e7673d7..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - - -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.Pager; -import org.apache.tuscany.das.rdb.impl.PagerImpl; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - - -import commonj.sdo.DataObject; - - - -public class Paging extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - public void testPaging() throws SQLException { - - //Build command to read all customers - Command custCommand = Command.FACTORY.createCommand("select * from CUSTOMER order by ID"); - custCommand.setConnection(getConnection()); - - //Create a pager with the command - Pager pager = new PagerImpl(custCommand, 2); - - //Get and work with first page - DataObject root = pager.next(); - DataObject customer1 = root.getDataObject("CUSTOMER[1]"); - DataObject customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - - //Get and work with the second page - root = pager.next(); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(3, customer1.getInt("ID")); - assertEquals(4, customer2.getInt("ID")); - - // First page again - root = pager.previous(); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - - } - - - public void testRandomPage() throws SQLException { - //Build the select command - Command select = Command.FACTORY - .createCommand("select * from CUSTOMER order by ID"); - - //Parameterize the command - select.setConnection(getConnection()); - - //Create a pager - Pager pager = new PagerImpl(select, 2); - - //Get the first page - DataObject root = pager.getPage(1); - DataObject customer1 = root.getDataObject("CUSTOMER[1]"); - DataObject customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - - //Get the second page - root = pager.getPage(2); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(3, customer1.getInt("ID")); - assertEquals(4, customer2.getInt("ID")); - - - // Get the first page again - root = pager.getPage(1); - customer1 = root.getDataObject("CUSTOMER[1]"); - customer2 = root.getDataObject("CUSTOMER[2]"); - assertEquals(1, customer1.getInt("ID")); - assertEquals(2, customer2.getInt("ID")); - } - - -}
\ No newline at end of file diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java deleted file mode 100644 index b24dad33d9..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class PartialUpdateTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public PartialUpdateTests() { - super(); - } - - public void testPartialUpdate() throws SQLException { - Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); - readCustomers.setConnection(getConnection()); - - // Read - DataObject root = readCustomers.executeQuery(); - - DataObject customer = root.getDataObject("CUSTOMER[1]"); - // Verify - assertEquals(1, customer.getInt("ID")); - - Command update = Command.FACTORY.createCommand("update CUSTOMER set LASTNAME = 'modified' where ID = 1"); - update.setConnection(getConnection()); - update.execute(); - - customer.setString("ADDRESS", "main street"); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - apply.execute(root); - - root = readCustomers.executeQuery(); - - // If partial update was not used, LASTNAME would not be 'modified' - customer = root.getDataObject("CUSTOMER[1]"); - assertEquals(1, customer.getInt("ID")); - assertEquals("modified", customer.getString("LASTNAME")); - assertEquals("main street", customer.getString("ADDRESS")); - } - - public void testPartialInsert() throws SQLException { - Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); - readCustomers.setConnection(getConnection()); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Create a new customer - DataObject newCust = root.createDataObject("CUSTOMER"); - newCust.set("ID", new Integer(100)); - newCust.set("ADDRESS", "5528 Wells Fargo Drive"); - // Purposely do not set lastname to let it default to 'Garfugengheist' - // newCust.set("LASTNAME", "Gerkin" ); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - apply.execute(root); - - Command readNewCust = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 100"); - readNewCust.setConnection(getConnection()); - root = readNewCust.executeQuery(); - - // If partial insert was not used, LASTNAME would not be - // 'Garfugengheist' - newCust = root.getDataObject("CUSTOMER[1]"); - assertEquals(100, newCust.getInt("ID")); - assertEquals("Garfugengheist", newCust.getString("LASTNAME")); - assertEquals("5528 Wells Fargo Drive", newCust.getString("ADDRESS")); - - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java deleted file mode 100644 index b38b117787..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * Test capability to participate in an extenrlly managed transaction. The - * client is managing the transaction boundary so the DAS will not issue - * commit/rollback - * - */ - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -public class PassiveConnectionTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read and modify a customer. Uses a "passive" connection - */ - public void testReadModifyApply() throws Exception { - - // Create and initialize a DAS connection and initialize for externally - // managed transaction boundaries - java.sql.Connection c = getConnection(); - - try { - - // Read customer 1 - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 1"); - select.setConnection(c); - DataObject root = select.executeQuery(); - - DataObject customer = (DataObject) root.get("CUSTOMER[1]"); - - // Modify customer - customer.set("LASTNAME", "Pavick"); - - // Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(c, false); - - // Flush changes - apply.execute(root); - - // Verify changes - root = select.executeQuery(); - assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); - - // Since the DAS is not managing tx boundaries, I must - } catch (Exception e) { - c.rollback(); - } finally { - c.commit(); - } - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java deleted file mode 100644 index d12e1f297b..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ConfigHelper; -import org.apache.tuscany.das.rdb.test.data.BookData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - -/** - * Tests the Converter framwork - */ -public class ProgrammaticConfigTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new BookData(getAutoConnection()).refresh(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Simple read followed by a write. This should fail since there is no - * config associaed with the applychanges command - */ - public void test_1() throws Exception { - - // Read a book instance - Command select = Command.FACTORY.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - // Flush the change - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - - try { - apply.execute(root); - fail("An exception should be thrown since here is no config to identify the primary key"); - } catch (RuntimeException ex) { - // Expected - } - } - - /** - * Simple read followed by a write. Config instance is generated - * programmatically using the ConfigHelper. - */ - public void test_2() throws Exception { - - // Read a book instance - Command select = Command.FACTORY.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - DataObject book = root.getDataObject("BOOK[1]"); - // Change a field to mark the instance 'dirty' - book.setInt("QUANTITY", 2); - - // Flush the change - // Create config programmatically - ConfigHelper helper = new ConfigHelper(); - helper.addPrimaryKey("BOOK.BOOK_ID"); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig()); - apply.setConnection(getConnection()); - - apply.execute(root); - - // Verify - root = select.executeQuery(); - book = root.getDataObject("BOOK[1]"); - assertEquals(2, book.getInt("QUANTITY")); - } - - - /** - * Test ability to read a compound graph - */ - public void test_3() throws Exception { - - String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1"; - - // Read some customers and related orders - // Create relationship config programmatically - ConfigHelper helper = new ConfigHelper(); - helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID"); - - Command select = Command.FACTORY.createCommand(statement, helper.getConfig()); - select.setConnection(getConnection()); - - DataObject root = select.executeQuery(); - DataObject customer = root.getDataObject("CUSTOMER[1]"); - - assertEquals(2, customer.getList("ANORDER").size()); - - } - - /** - * Programatically create table config with "property" name - */ - public void test_4() throws Exception { - - String statement = "SELECT * FROM BOOK WHERE BOOK.BOOK_ID = :ID"; - - // Create Table config programmatically - ConfigHelper helper = new ConfigHelper(); - helper.addTable("BOOK", "Book"); - helper.addPrimaryKey("Book.BOOK_ID"); - - Command select = Command.FACTORY.createCommand(statement, helper.getConfig()); - select.setConnection(getConnection()); - select.setParameterValue("ID", new Integer(1)); - - DataObject root = select.executeQuery(); - - DataObject newBook = root.createDataObject("Book"); - newBook.setString("NAME", "Ant Colonies of the Old World"); - newBook.setInt("BOOK_ID", 1001); - root.getList("Book").add(newBook); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig()); - apply.setConnection(getConnection()); - apply.execute(root); - - //Verify - select.setParameterValue("ID", new Integer(1001)); - root = select.executeQuery(); - assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME")); - - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java deleted file mode 100644 index 7a74372551..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * Test the ability to query Database schema(metadata) information using regular DAS APIs - * This is speciic to DB2 - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - - -public class ReadDBSchemaTests extends DasTest { - - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - - - public void testReadTableInfo() throws Exception { - - Command select = Command.FACTORY.createCommand("SELECT * from SYSIBM.SYSTABLES WHERE TYPE = 'T'"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject table = (DataObject)root.get("SYSTABLES[1]"); - - assertEquals('T', table.getChar("TYPE")); - - } - - - - //Utilities - - - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java deleted file mode 100644 index f67001b8b5..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.util.Iterator; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ResultSetShape; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; -import org.apache.tuscany.das.rdb.test.data.PartData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; -import commonj.sdo.Type; - -public class RecursiveTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new PartData(getAutoConnection()).refresh(); - } - - public void testReadEngineParts() throws Exception { - - //Table definition - //CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT ); - - String threeLevelPartsSQL = "SELECT P1.*, P2.*, P3.* FROM PART AS P1 LEFT JOIN PART AS P2 ON P1.ID = P2.PARENT_ID " - + "LEFT JOIN PART AS P3 on P2.ID = P3.PARENT_ID WHERE P1.ID = 1"; - Command select = Command.FACTORY.createCommand(threeLevelPartsSQL, getConfig("PartsConfig.xml")); - select.setConnection(getConnection()); - - String[] columns = {"ID", "NAME", "QUANTITY", "PARENT_ID", "ID", "NAME", "QUANTITY", "PARENT_ID", "ID", "NAME", "QUANTITY", "PARENT_ID"}; - String[] tables = {"PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART"}; - Type[] types = {SDODataTypes.INTEGEROBJECT, SDODataTypes.STRING, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT, SDODataTypes.STRING, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT, SDODataTypes.STRING, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT}; - ResultSetShape shape = new ResultSetShape(tables, columns, types); - - //Hack until we provide a nicer API - ((ReadCommandImpl)select).setResultSetShape(shape); - - // Need to set the key explicitly. The aggregate of columns not working - // because of null values - DataObject root = select.executeQuery(); - - assertEquals(5, root.getList("PART").size()); - // printList(root.getList("PART")); - DataObject engine = root.getDataObject("PART.0"); - assertEquals("Engine", engine.getString("NAME")); - - assertEquals(3, engine.getList("subparts").size()); - - DataObject piston = null; - Iterator i = engine.getList("subparts").iterator(); - while ( i.hasNext() ) { - DataObject obj = (DataObject)i.next(); - if ( obj.getString("NAME").equals("Piston")) - piston = obj; - } - - assertEquals("Piston", piston.getString("NAME")); - assertEquals(1, piston.getList("subparts").size()); - assertEquals("Piston Ring", piston.getDataObject("subparts.0").getString("NAME")); - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java deleted file mode 100644 index aadcef13f3..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * - * - */ - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - - -public class RelationshipTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Test ability to read a compound graph - */ - public void testRead() throws Exception { - - String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1"; - - // Read some customers and related orders - Command select = Command.FACTORY.createCommand(statement, getConfig("customerOrderRelationshipMapping.xml")); - select.setConnection(getConnection()); - - DataObject root = select.executeQuery(); - DataObject customer = root.getDataObject("CUSTOMER[1]"); - - assertEquals(2, customer.getList("orders").size()); - - } - - /** - * Same as above except uses xml file for relationhip and key information. - * Employs CUD generation. - */ - public void testRelationshipModification2() throws Exception { - - // Read some customers and related orders - Command select = Command.FACTORY - .createCommand( - "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID", getConfig("basicCustomerOrderMapping.xml")); - select.setConnection(getConnection()); - - DataObject root = select.executeQuery(); - - DataObject cust1 = root.getDataObject("CUSTOMER[1]"); - DataObject cust2 = root.getDataObject("CUSTOMER[2]"); - - // Save IDs - Integer cust1ID = (Integer) cust1.get("ID"); - Integer cust2ID = (Integer) cust2.get("ID"); - // save order count - Integer cust1OrderCount = new Integer(cust1.getList("orders").size()); - Integer cust2OrderCount = new Integer(cust2.getList("orders").size()); - - // Move an order to cust1 from cust2 - DataObject order = (DataObject) cust2.getList("orders").get(0); - cust1.getList("orders").add(order); - - // Build apply changes command - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerOrderMapping.xml")); - apply.setConnection(getConnection()); - - // Flush changes - apply.execute(root); - - // verify cust1 relationship updates - select = Command.FACTORY - .createCommand( - "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", - getConfig("basicCustomerOrderMapping.xml")); - select.setConnection(getConnection()); - select.setParameterValue("ID", cust1ID); - - root = select.executeQuery(); - assertEquals(cust1OrderCount.intValue() + 1, root.getList( - "CUSTOMER[1]/orders").size()); - - // verify cust2 relationship updates - select.setParameterValue("ID", cust2ID); - root = select.executeQuery(); - assertEquals(cust2OrderCount.intValue() - 1, root.getList( - "CUSTOMER[1]/orders").size()); - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java deleted file mode 100644 index e8bcfa9720..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.ResultSetShape; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; -import commonj.sdo.Type; - -/** - * Test ability to specify format(shape) of the ResultSet. This is necessary - * when the JDBC driver in use does not provide adequate support for - * ResultSetMetadata. Also, we expect that specifying the result set shape will - * increase performance. - * - */ -public class ResultSetShapeTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read a specific customer - */ - public void testReadSingle() throws Exception { - - // Using literals in the select forces invalid resultset metadata - String sqlString = "Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer"; - String[] columns = { "ID", "LASTNAME", "ADDRESS" }; - String[] tables = { "CUSTOMER", "CUSTOMER", "CUSTOMER" }; - Type[] types = { SDODataTypes.LONG, SDODataTypes.STRING, SDODataTypes.STRING }; - - ResultSetShape shape = new ResultSetShape(tables, columns, types); - - // Create and initialize command to read customers - Command readCustomers = Command.FACTORY.createCommand(sqlString, - getConfig("CustomerConfigWithIDConverter.xml")); - // Specify result shape - readCustomers.setResultSetShape(shape); - - readCustomers.setConnection(getConnection()); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Verify - assertEquals(5, root.getList("CUSTOMER").size()); - assertEquals(99, root.getInt("CUSTOMER[1]/ID")); - assertEquals("Roosevelt", root.getString("CUSTOMER[1]/LASTNAME")); - assertEquals("1600 Pennsylvania Avenue", root.getString("CUSTOMER[1]/ADDRESS")); - - } - - /** - * Read a specific customer This duplicates the previous tests but does not - * provide the shape info. Since the select will not return valid metadata, - * this test is expected to fail - */ - public void testReadSingleVerifyShapeUse() throws Exception { - - // Using literals in the select forces invalid resultset metadata - String sqlString = "Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer"; - - // Create and initialize command to read customers - Command readCustomers = Command.FACTORY.createCommand(sqlString); - readCustomers.setConnection(getConnection()); - - // Read - DataObject root = readCustomers.executeQuery(); - - // Verify - try { - assertEquals(5, root.getList("CUSTOMER").size()); - fail("Should fail since there will be no feature named CUSTOMER"); - } catch (IllegalArgumentException e) { - // OK - } - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java deleted file mode 100644 index 0089e6b569..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * This class provides tests for all supported "types". The current plan is to - * use the Data type definitions provided in the SDO 2 specification. We must - * test the ability to use all of these types as well as different mapping from - * thse types to types used in the database. For example, a SDO Data Type - * "STRING", might be staored as a "TIMESTAMP" in DB2. - * - */ - -import org.apache.tuscany.das.rdb.test.data.TypesData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -public class SerializationTests extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new TypesData(getAutoConnection()).refresh(); - } - - /** - * Read various types. - */ - - -public void testReadandSerialize() throws Exception { - /** Currently failing because of TUSCANY-22 - Command select = Command.FACTORY - .createCommand("Select * from TYPETEST where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject obj = root.getDataObject("TYPETEST[1]"); - - assertTrue(obj.isSet("ID")); - assertTrue(obj.isSet("ATIMESTAMP")); - assertTrue(obj.isSet("ADECIMAL")); - assertTrue(obj.isSet("AFLOAT")); - - //Java serilaization to file - FileOutputStream fos = null; - ObjectOutputStream out = null; - try { - fos = new FileOutputStream("serializedGraph.xml"); - out = new ObjectOutputStream(fos); - out.writeObject(root); - out.flush(); - } finally { - out.close(); - fos.close(); - } - - //Reconstruct the graph - FileInputStream fis = null; - ObjectInputStream in = null; - DataObject root2; - try { - fis = new FileInputStream("serializedGraph.xml"); - in = new ObjectInputStream(fis); - root2 = (DataObject) in.readObject(); - } finally { - in.close(); - fis.close(); - } - - assertEquals(1, root.getInt("TYPETEST[1]/ID")); - assertEquals(TypesData.getTimestamp(), (java.sql.Timestamp)root.get("TYPETEST[1]/ATIMESTAMP")); - assertEquals(1234567.89f, root2.getFloat("TYPETEST[1]/ADECIMAL"), .001); - assertEquals(1234567.89f, root2.getFloat("TYPETEST[1]/AFLOAT"), .001); - - */ - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java deleted file mode 100644 index 11ef87c8bc..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java +++ /dev/null @@ -1,256 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * These are the simplest possible uses of the JDBC DAS. In this mode, the - * programming model is not much more than JDBC - * - * The assumptions for these tests are: - * - * Single type - * Client explicitly Read/Create/Update/Delete commands - * No O/R mapping metadata - * SDO change history is not used - * Dynamic DataObjects - * No specified graph model - * - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - - -public class SimplestCrud extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Read a specific customer - */ - public void testReadSingle() throws Exception { - - //Create and initialize command to read customers - Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); - readCustomers.setConnection(getConnection()); - - //Read - DataObject root = readCustomers.executeQuery(); - - //Verify - assertEquals(1, root.getInt("CUSTOMER[1]/ID")); - } - - /** - * Read a specific customer - */ - public void testReadSingle2() throws Exception { - - //Create and initialize command to read customers - Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); - readCustomers.setConnection(getConnection()); - - //Read - DataObject root = readCustomers.executeQuery(); - - DataObject cust = root.getDataObject("CUSTOMER[1]"); - -// int n = (cust.getType().getProperties()).size(); -// for (int i=0; i<n; i++) { -// System.out.println(cust.get(i)); -// } - - - //Verify - assertEquals(1, root.getInt("CUSTOMER[1]/ID")); - } - - /** - * Read a specific customer - * Same as above but tests tolerance of white space in provided SQL - */ - public void testReadSingleWithWhiteSpace() throws Exception { - - //Create and initialize command to read customers - Command readCustomers = Command.FACTORY.createCommand(" select * from CUSTOMER where ID = 1"); - readCustomers.setConnection(getConnection()); - - //Read - DataObject root = readCustomers.executeQuery(); - - //Verify - assertEquals(1, root.getInt("CUSTOMER[1]/ID")); - } - - /** - * Read all customers with a specific last name - */ - public void testReadMultiple() throws Exception { - - //Create and initialize command to read customers - Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where LASTNAME = 'Williams'"); - readCustomers.setConnection(getConnection()); - - //Read - DataObject root = readCustomers.executeQuery(); - - //Verify - assertEquals(4, root.getList("CUSTOMER").size()); - } - - /** - * Read all customers with a specific last name - * LASTNAME value is provided via a parameter - */ - public void testReadMultipleWithParameters() throws Exception { - - //Create and initialize command to read customers - Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where LASTNAME = :LASTNAME"); - readCustomers.setConnection(getConnection()); - - //Parameterize the command - readCustomers.setParameterValue("LASTNAME", "Williams"); - DataObject root = readCustomers.executeQuery(); - - //Verify - assertEquals(4, root.getList("CUSTOMER").size()); - } - - public void testInsert() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (10, 'Williams', '5528 Wells Fargo Dr')"); - insert.setConnection(getConnection()); - insert.execute(); - - //Verify - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - public void testInsertWithParameters() throws Exception { - - Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); - insert.setConnection(getConnection()); - insert.setParameterValue("ID", new Integer(10)); - insert.setParameterValue("LASTNAME", "Williams"); - insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); - insert.execute(); - - //Verify - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); - - } - - - public void testDelete() throws Exception { - - //Verify pre-condition - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertEquals(1, root.getList("CUSTOMER").size()); - - //Create and execute the delete command - Command delete = Command.FACTORY.createCommand("delete from CUSTOMER where ID = 1"); - delete.setConnection(getConnection()); - delete.execute(); - - //Verify delete by reusing the original select command - root = select.executeQuery(); - assertEquals(0, root.getList("CUSTOMER").size()); - - } - - - public void testUpdate() throws Exception { - - //Verify pre-condition - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - Command update = Command.FACTORY.createCommand("update CUSTOMER set LASTNAME = 'Pavick' where ID = 1"); - update.setConnection(getConnection()); - update.execute(); - - //Verify update - reuse select command - root = select.executeQuery(); - assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME")); - - } - - public void testUpdateWithParameters() throws Exception { - - //Verify pre-condition - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - Command update = Command.FACTORY.createCommand("update CUSTOMER set LASTNAME = :LASTNAME where ID = :ID"); - update.setConnection(getConnection()); - update.setParameterValue("LASTNAME", "Pavick"); - update.setParameterValue("ID", new Integer(1)); - update.execute(); - - //Verify update - reuse select command - root = select.executeQuery(); - assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME")); - - } - - public void testUpdateWithParmarkers() throws Exception { - - //Verify pre-condition - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertFalse(root.get("CUSTOMER[1]/LASTNAME").equals("Pavick")); - - Command update = Command.FACTORY.createCommand("update CUSTOMER set LASTNAME = ? where ID = ?"); - update.setConnection(getConnection()); - update.setParameterValue(1, "Pavick"); - update.setParameterValue(2, new Integer(1)); - update.execute(); - - //Verify update - reuse select command - root = select.executeQuery(); - assertEquals("Pavick", root.get("CUSTOMER[1]/LASTNAME")); - - } - -}
\ No newline at end of file diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java deleted file mode 100644 index ec72e02b73..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java +++ /dev/null @@ -1,194 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.Parameter; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.test.data.CompanyData; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - -import commonj.sdo.DataObject; - - -public class StoredProcs extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CompanyData(getAutoConnection()).refresh(); - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - // Call a simple stored proc to read all companies - public void testGetCompanies() throws Exception { - - Command read = Command.FACTORY.createCommand("{call GETALLCOMPANIES()}"); - read.setConnection(getConnection()); - DataObject root = read.executeQuery(); - - //Verify - assertEquals(3, root.getList("COMPANY").size()); - assertTrue(root.getInt("COMPANY[1]/ID") > 0); - - } - - public void testGetNamedCompany() throws Exception { - - Command read = Command.FACTORY.createCommand("{call GETNAMEDCOMPANY(?)}"); - - read.setConnection(getConnection()); - read.setParameterValue(1, "MegaCorp"); - DataObject root = read.executeQuery(); - - assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME")); - - } - - public void testGetNamedCompanyByName() throws Exception { - Command read = Command.FACTORY - .createCommand("{call GETNAMEDCOMPANY(:NAME)}"); - - read.setConnection(getConnection()); - read.setParameterValue("NAME", "MegaCorp"); - DataObject root = read.executeQuery(); - - assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME")); - } - - - // Retreive heirarchy using a stored proc ... new programming model - public void testGetCustomersAndOrder() throws Exception { - - Command read = Command.FACTORY.createCommand("{call getCustomerAndOrders(?)}", getConfig("CustomersOrdersConfig.xml")); - read.setConnection(getConnection()); - read.setParameterValue(1, new Integer(1)); - - DataObject root = read.executeQuery(); - - DataObject customer = (DataObject) root.getList("CUSTOMER").get(0); - assertEquals(2, customer.getList("orders").size()); - - } - - /** - * Call a stored proc requiring an in parameter and producing an out - * parameter and a resultset - * - * This stored proc takes a lastname argument and returns a graph of - * customers with that last name. The number of read customers is returned - * in the out parameter - */ - public void testGetNamedCustomers() throws Exception { - - Command read = Command.FACTORY.createCommand("{call GETNAMEDCUSTOMERS(?,?)}"); - read.setConnection(getConnection()); - read.setParameterValue(1, "Williams"); - read.addParameter(2, Parameter.OUT, SDODataTypes.INTEGER); - DataObject root = read.executeQuery(); - - Integer customersRead = (Integer) read.getParameterValue(2); - - assertEquals(4, customersRead.intValue()); - assertEquals(customersRead.intValue(), root.getList("CUSTOMER").size()); - - } - - //TODO - Resolve issue with programmatic creation of GETNAMEDCUSTOMERS on DB2 and - //re-enable this test - - - // Simplest possible SP write - public void testDelete() throws Exception { - - Command delete = Command.FACTORY.createCommand("{call DELETECUSTOMER(?)}"); - delete.setConnection(getConnection()); - delete.setParameterValue(1, new Integer(1)); - delete.execute(); - - // Verify DELETE - Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - assertTrue(root.getList("CUSTOMER").isEmpty()); - - } - -/* // For debug - public void testRawCall() throws Exception { - - Connection c = getConnection(); - CallableStatement cs = c.prepareCall("{call GETNAMEDCUSTOMERS(?,?)}"); - ParameterMetaData pm = cs.getParameterMetaData(); - int count = pm.getParameterCount(); - for (int i = 1; i <= count; i++) { - int mode = pm.getParameterMode(i); - if (mode == ParameterMetaData.parameterModeOut - || mode == ParameterMetaData.parameterModeInOut) - cs.registerOutParameter(i, pm.getParameterType(i)); - } - cs.setString(1, "Williams"); - // cs.registerOutParameter(2,java.sql.Types.INTEGER); - boolean isResultSet = cs.execute(); - System.out.println("Has a result set => " + isResultSet); - ResultSet rs = cs.getResultSet(); - - if (isResultSet) { - System.out.println("Results are: "); - while (rs.next()) { - System.out.println(rs.getObject(2)); - } - } - System.out.println("Count is =>" + cs.getObject(2)); - c.commit(); - } - - // For debug - public void testRawCall2() throws Exception { - - Connection c = getConnection(); - CallableStatement cs = c.prepareCall("{call getCustomerAndOrders(?)}"); - cs.setObject(1, new Integer(1)); - boolean isResultSet = cs.execute(); - System.out.println("call getCustomerAndOrders(?) has a result set => " - + isResultSet); - ResultSet rs = cs.getResultSet(); - - write(rs); - c.commit(); - } - - public void testGetAllOrders() throws Exception { - - System.out.println("all orders"); - Connection c = getConnection(); - PreparedStatement s = c.prepareStatement("select * from anorder"); - write (s.executeQuery()); - c.commit(); - - }*/ - -}
\ No newline at end of file diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java deleted file mode 100644 index 7829e69e07..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -import java.io.IOException; -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.customer.AnOrder; -import org.apache.tuscany.das.rdb.test.customer.Customer; -import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; -import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.data.OrderData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.TypeHelper; - -public class TopDown extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - - new CustomerData(getAutoConnection()).refresh(); - new OrderData(getAutoConnection()).refresh(); - - } - - // Uses dynamic SDOs but user provides the model - public void testUserProvidedModelDynamic() throws SQLException, IOException { - - // Build the select command - Command select = Command.FACTORY - .createCommand( - "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", - getConfig("1xM_mapping_no_cud.xml")); - - SDOUtil.registerStaticTypes(CustomerFactory.class); - -// Set the object model - select.setDataObjectModel(TypeHelper.INSTANCE.getType(DataGraphRoot.class)); - - - // Parameterize the command - select.setConnection(getConnection()); - select.setParameterValue("ID", new Integer(1)); - - // Get the graph - DataGraphRoot is from the typed package - DataGraphRoot root = (DataGraphRoot) select.executeQuery(); - - // Modify a customer - Customer customer = (Customer) root.getCustomers().get(0); - customer.setLastName("Pavick"); - - // Modify an order - AnOrder order = (AnOrder) customer.getOrders().get(0); - order.setProduct("Kitchen Sink 001"); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("1xM_mapping_no_cud.xml")); - apply.setConnection(getConnection()); - - // Flush changes - apply.execute((DataObject) root); - - } - - -}
\ No newline at end of file diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java deleted file mode 100644 index e49c5f7630..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * This class provides tests for all supported "types". The current plan is to use the Data - * type definitions provided in the SDO 2 specification. We must test the ability to use - * all of these types as well as different mapping from thse types to types used in the - * database. For example, a SDO Data Type "STRING", might be staored as a "TIMESTAMP" in DB2. - * - */ - -import java.sql.Timestamp; -import java.util.Date; - -import org.apache.tuscany.das.rdb.ApplyChangesCommand; -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.data.TypesData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; - - -import commonj.sdo.DataObject; - - -public class TypeTests extends DasTest { - - - protected void setUp() throws Exception { - super.setUp(); - new TypesData(getAutoConnection()).refresh(); - } - - /** - * Read various types. - */ - public void testRead() throws Exception { - - //Read customer 1 - Command select = Command.FACTORY.createCommand("Select * from TYPETEST where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject types = (DataObject)root.get("TYPETEST[1]"); - - java.sql.Timestamp ts = (java.sql.Timestamp)types.get("ATIMESTAMP"); - assertEquals(ts, TypesData.getTimestamp()); - - float decimal = types.getFloat("ADECIMAL"); - assertEquals(1234567.89f, decimal, .0001); - - } - - - /** - * Write various types. - * TODO - Need to rethink the Timestamp write. My current thinking id that writes of non-SDO2 defined types - * require a converter - */ -/* public void testWrite() throws Exception { - - //Read customer 1 - Command select = Command.FACTORY.createCommand("Select * from TYPETEST where ID = 1"); - select.setConnection(getConnection()); - DataObject root = select.executeQuery(); - - DataObject types = (DataObject)root.get("TYPETEST[1]"); - Date now = new Date(); - types.set("ATIMESTAMP", now); - - ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); - apply.setConnection(getConnection()); - apply.addPrimaryKey("TYPETEST.ID"); - apply.execute(root); - - //Verify - root = select.executeQuery(); - java.sql.Timestamp ts = (java.sql.Timestamp)types.get("ATIMESTAMP"); - assertEquals(now, ts); - - }*/ - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java deleted file mode 100644 index 09a6147118..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.commands; - -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; - - -public class ReadCustomersByLastnameCommand extends ReadCommandImpl { - - private static final String sqlString = "select * from CUSTOMER where LASTNAME = :LASTNAME"; - private static final Config mapping; - - static { - ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; - mapping = factory.createConfig(); - Table t = factory.createTable(); - Column id = factory.createColumn(); - id.setName("ID"); - id.setPrimaryKey(true); - Column lastname = factory.createColumn(); - lastname.setName("LASTNAME"); - Column address = factory.createColumn(); - address.setName("ADDRESS"); - - t.getColumn().add(id); - t.getColumn().add(lastname); - t.getColumn().add(address); - t.setName("CUSTOMER"); - mapping.getTable().add(t); - } - - public ReadCustomersByLastnameCommand() { - super(sqlString, mapping); - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java deleted file mode 100644 index 615ef12dab..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java +++ /dev/null @@ -1,55 +0,0 @@ -/** -* -* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.apache.tuscany.das.rdb.test.commands; - -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; - - -public class ReadCustomersCommand extends ReadCommandImpl { - - private static final String sqlString = "select * from CUSTOMER"; - private static final Config mapping; - - static { - ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; - mapping = factory.createConfig(); - Table t = factory.createTable(); - Column id = factory.createColumn(); - id.setName("ID"); - id.setPrimaryKey(true); - Column lastname = factory.createColumn(); - lastname.setName("LASTNAME"); - Column address = factory.createColumn(); - address.setName("ADDRESS"); - - t.getColumn().add(id); - t.getColumn().add(lastname); - t.getColumn().add(address); - t.setName("CUSTOMER"); - mapping.getTable().add(t); - } - - public ReadCustomersCommand() { - super(sqlString, mapping); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java deleted file mode 100644 index c8dcdebb68..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java +++ /dev/null @@ -1,62 +0,0 @@ -/** -* -* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.apache.tuscany.das.rdb.test.commands; - -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; -import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; - -import commonj.sdo.helper.TypeHelper; - - -public class ReadCustomersStaticTypesCommand extends ReadCommandImpl { - - private static final String sqlString = "Select ID, LASTNAME, ADDRESS from CUSTOMER where LASTNAME = :LASTNAME"; - private static final Config mapping; - - static { - ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; - mapping = factory.createConfig(); - Table t = factory.createTable(); - Column id = factory.createColumn(); - id.setName("ID"); - id.setPrimaryKey(true); - Column lastname = factory.createColumn(); - lastname.setName("LASTNAME"); - Column address = factory.createColumn(); - address.setName("ADDRESS"); - - t.getColumn().add(id); - t.getColumn().add(lastname); - t.getColumn().add(address); - t.setName("CUSTOMER"); - t.setPropertyName("Customer"); - mapping.getTable().add(t); - } - - public ReadCustomersStaticTypesCommand() { - super(sqlString, mapping); - setDataObjectModel(TypeHelper.INSTANCE.getType(DataGraphRoot.class)); - } - - - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java deleted file mode 100644 index 82d8cefbc2..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.commands; - -import org.apache.tuscany.das.rdb.ResultSetShape; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; - -import commonj.sdo.Type; - -public class ReadCustomersWithShapeCommand extends ReadCommandImpl { - - // This sql string ensures that we won't have resultset metadata - private static final String sqlString = "Select * from customer union select * from customer"; - - private static final String[] columns = {"ID", "LASTNAME", "ADDRESS"}; - private static final String[] tables = {"CUSTOMER", "CUSTOMER", "CUSTOMER"}; - private static final Type[] types = {SDODataTypes.INT, SDODataTypes.STRING, SDODataTypes.STRING}; - - public ReadCustomersWithShapeCommand() { - super(sqlString); - ResultSetShape shape = new ResultSetShape(tables, columns, types); - setResultSetShape(shape); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java deleted file mode 100644 index 1f45ba317f..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java +++ /dev/null @@ -1,66 +0,0 @@ -/** -* -* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package org.apache.tuscany.das.rdb.test.commands; - -import org.apache.tuscany.das.rdb.ResultSetShape; -import org.apache.tuscany.das.rdb.SDODataTypes; -import org.apache.tuscany.das.rdb.config.Column; -import org.apache.tuscany.das.rdb.config.Config; -import org.apache.tuscany.das.rdb.config.ConfigFactory; -import org.apache.tuscany.das.rdb.config.Table; -import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; -import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; - -import commonj.sdo.Type; - -public class SimpleReadCustomersWithShapeCommand extends ReadCommandImpl { - - // This sql string ensures that we won't have resultset metadata - private static final String sqlString = "Select * from customer union select * from customer"; - - private static final String[] columns = {"ID", "LASTNAME", "ADDRESS"}; - private static final String[] tables = {"CUSTOMER", "CUSTOMER", "CUSTOMER"}; - private static final Type[] types = {SDODataTypes.INT, SDODataTypes.STRING, SDODataTypes.STRING}; - - private static final Config mapping; - - static { - ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; - mapping = factory.createConfig(); - Table t = factory.createTable(); - Column id = factory.createColumn(); - id.setName("ID"); - id.setPrimaryKey(true); - Column lastname = factory.createColumn(); - lastname.setName("LASTNAME"); - Column address = factory.createColumn(); - address.setName("ADDRESS"); - - t.getColumn().add(id); - t.getColumn().add(lastname); - t.getColumn().add(address); - t.setName("CUSTOMER"); - mapping.getTable().add(t); - } - - public SimpleReadCustomersWithShapeCommand() { - super(sqlString, mapping); - ResultSetShape shape = new ResultSetShape(tables, columns, types); - setResultSetShape(shape); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyFactory.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyFactory.java deleted file mode 100644 index a30b607b24..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyFactory.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company; - - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @generated - */ -public interface CompanyFactory -{ - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CompanyFactory INSTANCE = org.apache.tuscany.das.rdb.test.company.impl.CompanyFactoryImpl.eINSTANCE; - - /** - * Returns a new object of class '<em>Type</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Type</em>'. - * @generated - */ - CompanyType createCompanyType(); - - /** - * Returns a new object of class '<em>Datagraph Root</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Datagraph Root</em>'. - * @generated - */ - DatagraphRoot createDatagraphRoot(); - - /** - * Returns a new object of class '<em>Department Type</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Department Type</em>'. - * @generated - */ - DepartmentType createDepartmentType(); - - /** - * Returns a new object of class '<em>Employee Type</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Employee Type</em>'. - * @generated - */ - EmployeeType createEmployeeType(); - -} //CompanyFactory diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyType.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyType.java deleted file mode 100644 index bba21c0661..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyType.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company; - -import java.util.List; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Type</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getDepartments <em>Departments</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getEmployeeOfTheMonth <em>Employee Of The Month</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getName <em>Name</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public interface CompanyType -{ - /** - * Returns the value of the '<em><b>Departments</b></em>' containment reference list. - * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.DepartmentType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Departments</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Departments</em>' containment reference list. - * @generated - */ - List getDepartments(); - - /** - * Returns the value of the '<em><b>Employee Of The Month</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Employee Of The Month</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Employee Of The Month</em>' attribute. - * @see #setEmployeeOfTheMonth(String) - * @generated - */ - String getEmployeeOfTheMonth(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getEmployeeOfTheMonth <em>Employee Of The Month</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Employee Of The Month</em>' attribute. - * @see #getEmployeeOfTheMonth() - * @generated - */ - void setEmployeeOfTheMonth(String value); - - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - -} // CompanyType diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DatagraphRoot.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DatagraphRoot.java deleted file mode 100644 index 81ae283bbe..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DatagraphRoot.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company; - -import java.util.List; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Datagraph Root</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getCompanies <em>Companies</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getDepartments <em>Departments</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getEmployees <em>Employees</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public interface DatagraphRoot -{ - /** - * Returns the value of the '<em><b>Companies</b></em>' containment reference list. - * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.CompanyType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Companies</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Companies</em>' containment reference list. - * @generated - */ - List getCompanies(); - - /** - * Returns the value of the '<em><b>Departments</b></em>' containment reference list. - * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.DepartmentType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Departments</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Departments</em>' containment reference list. - * @generated - */ - List getDepartments(); - - /** - * Returns the value of the '<em><b>Employees</b></em>' containment reference list. - * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.EmployeeType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Employees</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Employees</em>' containment reference list. - * @generated - */ - List getEmployees(); - -} // DatagraphRoot diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DepartmentType.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DepartmentType.java deleted file mode 100644 index 522779b51d..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DepartmentType.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company; - -import java.util.List; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Department Type</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getEmployees <em>Employees</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getLocation <em>Location</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getName <em>Name</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber <em>Number</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public interface DepartmentType -{ - /** - * Returns the value of the '<em><b>Employees</b></em>' containment reference list. - * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.EmployeeType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Employees</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Employees</em>' containment reference list. - * @generated - */ - List getEmployees(); - - /** - * Returns the value of the '<em><b>Location</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Location</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Location</em>' attribute. - * @see #setLocation(String) - * @generated - */ - String getLocation(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getLocation <em>Location</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Location</em>' attribute. - * @see #getLocation() - * @generated - */ - void setLocation(String value); - - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - - /** - * Returns the value of the '<em><b>Number</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Number</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Number</em>' attribute. - * @see #isSetNumber() - * @see #unsetNumber() - * @see #setNumber(int) - * @generated - */ - int getNumber(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber <em>Number</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Number</em>' attribute. - * @see #isSetNumber() - * @see #unsetNumber() - * @see #getNumber() - * @generated - */ - void setNumber(int value); - - /** - * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber <em>Number</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSetNumber() - * @see #getNumber() - * @see #setNumber(int) - * @generated - */ - void unsetNumber(); - - /** - * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber <em>Number</em>}' attribute is set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return whether the value of the '<em>Number</em>' attribute is set. - * @see #unsetNumber() - * @see #getNumber() - * @see #setNumber(int) - * @generated - */ - boolean isSetNumber(); - -} // DepartmentType diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/EmployeeType.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/EmployeeType.java deleted file mode 100644 index 0e7a18034c..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/EmployeeType.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Employee Type</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager <em>Manager</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getName <em>Name</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getSN <em>SN</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public interface EmployeeType -{ - /** - * Returns the value of the '<em><b>Manager</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Manager</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Manager</em>' attribute. - * @see #isSetManager() - * @see #unsetManager() - * @see #setManager(boolean) - * @generated - */ - boolean isManager(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager <em>Manager</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Manager</em>' attribute. - * @see #isSetManager() - * @see #unsetManager() - * @see #isManager() - * @generated - */ - void setManager(boolean value); - - /** - * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager <em>Manager</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSetManager() - * @see #isManager() - * @see #setManager(boolean) - * @generated - */ - void unsetManager(); - - /** - * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager <em>Manager</em>}' attribute is set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return whether the value of the '<em>Manager</em>' attribute is set. - * @see #unsetManager() - * @see #isManager() - * @see #setManager(boolean) - * @generated - */ - boolean isSetManager(); - - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - - /** - * Returns the value of the '<em><b>SN</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>SN</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>SN</em>' attribute. - * @see #setSN(String) - * @generated - */ - String getSN(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getSN <em>SN</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>SN</em>' attribute. - * @see #getSN() - * @generated - */ - void setSN(String value); - -} // EmployeeType diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyFactoryImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyFactoryImpl.java deleted file mode 100644 index 55812441d8..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyFactoryImpl.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company.impl; - -import org.apache.tuscany.das.rdb.test.company.*; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class CompanyFactoryImpl extends EFactoryImpl implements CompanyFactory -{ - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final CompanyFactoryImpl eINSTANCE = init(); - - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static CompanyFactoryImpl init() - { - try - { - CompanyFactoryImpl theCompanyFactory = (CompanyFactoryImpl)EPackage.Registry.INSTANCE.getEFactory("org.apache.tuscany.das.rdb.test/company.xsd"); - if (theCompanyFactory != null) - { - return theCompanyFactory; - } - } - catch (Exception exception) - { - EcorePlugin.INSTANCE.log(exception); - } - return new CompanyFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CompanyFactoryImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) - { - switch (eClass.getClassifierID()) - { - case CompanyPackageImpl.COMPANY_TYPE: return (EObject)createCompanyType(); - case CompanyPackageImpl.DATAGRAPH_ROOT: return (EObject)createDatagraphRoot(); - case CompanyPackageImpl.DEPARTMENT_TYPE: return (EObject)createDepartmentType(); - case CompanyPackageImpl.DOCUMENT_ROOT: return (EObject)createDocumentRoot(); - case CompanyPackageImpl.EMPLOYEE_TYPE: return (EObject)createEmployeeType(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CompanyType createCompanyType() - { - CompanyTypeImpl companyType = new CompanyTypeImpl(); - return companyType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DatagraphRoot createDatagraphRoot() - { - DatagraphRootImpl datagraphRoot = new DatagraphRootImpl(); - return datagraphRoot; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DepartmentType createDepartmentType() - { - DepartmentTypeImpl departmentType = new DepartmentTypeImpl(); - return departmentType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject createDocumentRoot() - { - EObject documentRoot = super.create(CompanyPackageImpl.Literals.DOCUMENT_ROOT); - return documentRoot; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EmployeeType createEmployeeType() - { - EmployeeTypeImpl employeeType = new EmployeeTypeImpl(); - return employeeType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CompanyPackageImpl getCompanyPackageImpl() - { - return (CompanyPackageImpl)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - public static CompanyPackageImpl getPackage() - { - return CompanyPackageImpl.eINSTANCE; - } - -} //CompanyFactoryImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyPackageImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyPackageImpl.java deleted file mode 100644 index 9a079816fd..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyPackageImpl.java +++ /dev/null @@ -1,1258 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company.impl; - -import org.apache.tuscany.das.rdb.test.company.CompanyFactory; -import org.apache.tuscany.das.rdb.test.company.CompanyType; -import org.apache.tuscany.das.rdb.test.company.DatagraphRoot; -import org.apache.tuscany.das.rdb.test.company.DepartmentType; -import org.apache.tuscany.das.rdb.test.company.EmployeeType; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.ecore.xml.type.XMLTypePackage; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.CompanyFactory - * @generated - */ -public class CompanyPackageImpl extends EPackageImpl -{ - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String eNAME = "company"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String eNS_URI = "org.apache.tuscany.das.rdb.test/company.xsd"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String eNS_PREFIX = "company"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final CompanyPackageImpl eINSTANCE = org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl.init(); - - /** - * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl <em>Type</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getCompanyType() - * @generated - */ - public static final int COMPANY_TYPE = 0; - - /** - * The feature id for the '<em><b>Departments</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int COMPANY_TYPE__DEPARTMENTS = 0; - - /** - * The feature id for the '<em><b>Employee Of The Month</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH = 1; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int COMPANY_TYPE__NAME = 2; - - /** - * The number of structural features of the '<em>Type</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int COMPANY_TYPE_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl <em>Datagraph Root</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDatagraphRoot() - * @generated - */ - public static final int DATAGRAPH_ROOT = 1; - - /** - * The feature id for the '<em><b>Companies</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DATAGRAPH_ROOT__COMPANIES = 0; - - /** - * The feature id for the '<em><b>Departments</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DATAGRAPH_ROOT__DEPARTMENTS = 1; - - /** - * The feature id for the '<em><b>Employees</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DATAGRAPH_ROOT__EMPLOYEES = 2; - - /** - * The number of structural features of the '<em>Datagraph Root</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DATAGRAPH_ROOT_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl <em>Department Type</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDepartmentType() - * @generated - */ - public static final int DEPARTMENT_TYPE = 2; - - /** - * The feature id for the '<em><b>Employees</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DEPARTMENT_TYPE__EMPLOYEES = 0; - - /** - * The feature id for the '<em><b>Location</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DEPARTMENT_TYPE__LOCATION = 1; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DEPARTMENT_TYPE__NAME = 2; - - /** - * The feature id for the '<em><b>Number</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DEPARTMENT_TYPE__NUMBER = 3; - - /** - * The number of structural features of the '<em>Department Type</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DEPARTMENT_TYPE_FEATURE_COUNT = 4; - - /** - * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DocumentRootImpl <em>Document Root</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.DocumentRootImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDocumentRoot() - * @generated - */ - public static final int DOCUMENT_ROOT = 3; - - /** - * The feature id for the '<em><b>Mixed</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DOCUMENT_ROOT__MIXED = 0; - - /** - * The feature id for the '<em><b>XMLNS Prefix Map</b></em>' map. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1; - - /** - * The feature id for the '<em><b>XSI Schema Location</b></em>' map. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2; - - /** - * The feature id for the '<em><b>Company</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DOCUMENT_ROOT__COMPANY = 3; - - /** - * The number of structural features of the '<em>Document Root</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DOCUMENT_ROOT_FEATURE_COUNT = 4; - - /** - * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl <em>Employee Type</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getEmployeeType() - * @generated - */ - public static final int EMPLOYEE_TYPE = 4; - - /** - * The feature id for the '<em><b>Manager</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int EMPLOYEE_TYPE__MANAGER = 0; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int EMPLOYEE_TYPE__NAME = 1; - - /** - * The feature id for the '<em><b>SN</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int EMPLOYEE_TYPE__SN = 2; - - /** - * The number of structural features of the '<em>Employee Type</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int EMPLOYEE_TYPE_FEATURE_COUNT = 3; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass companyTypeEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass datagraphRootEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass departmentTypeEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass documentRootEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass employeeTypeEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#eNS_URI - * @see #init() - * @generated - */ - private CompanyPackageImpl() - { - super(eNS_URI, ((EFactory)CompanyFactory.INSTANCE)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - * <p>Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - * <p>Invocation of this method will not affect any packages that have - * already been initialized. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static CompanyPackageImpl init() - { - if (isInited) return (CompanyPackageImpl)EPackage.Registry.INSTANCE.getEPackage(CompanyPackageImpl.eNS_URI); - - // Obtain or create and register package - CompanyPackageImpl theCompanyPackageImpl = (CompanyPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof CompanyPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new CompanyPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - XMLTypePackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theCompanyPackageImpl.createPackageContents(); - - // Initialize created meta-data - theCompanyPackageImpl.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theCompanyPackageImpl.freeze(); - - return theCompanyPackageImpl; - } - - - /** - * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.company.CompanyType <em>Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Type</em>'. - * @see org.apache.tuscany.das.rdb.test.company.CompanyType - * @generated - */ - public EClass getCompanyType() - { - return companyTypeEClass; - } - - /** - * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getDepartments <em>Departments</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Departments</em>'. - * @see org.apache.tuscany.das.rdb.test.company.CompanyType#getDepartments() - * @see #getCompanyType() - * @generated - */ - public EReference getCompanyType_Departments() - { - return (EReference)companyTypeEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getEmployeeOfTheMonth <em>Employee Of The Month</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Employee Of The Month</em>'. - * @see org.apache.tuscany.das.rdb.test.company.CompanyType#getEmployeeOfTheMonth() - * @see #getCompanyType() - * @generated - */ - public EAttribute getCompanyType_EmployeeOfTheMonth() - { - return (EAttribute)companyTypeEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getName <em>Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Name</em>'. - * @see org.apache.tuscany.das.rdb.test.company.CompanyType#getName() - * @see #getCompanyType() - * @generated - */ - public EAttribute getCompanyType_Name() - { - return (EAttribute)companyTypeEClass.getEStructuralFeatures().get(2); - } - - /** - * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot <em>Datagraph Root</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Datagraph Root</em>'. - * @see org.apache.tuscany.das.rdb.test.company.DatagraphRoot - * @generated - */ - public EClass getDatagraphRoot() - { - return datagraphRootEClass; - } - - /** - * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getCompanies <em>Companies</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Companies</em>'. - * @see org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getCompanies() - * @see #getDatagraphRoot() - * @generated - */ - public EReference getDatagraphRoot_Companies() - { - return (EReference)datagraphRootEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getDepartments <em>Departments</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Departments</em>'. - * @see org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getDepartments() - * @see #getDatagraphRoot() - * @generated - */ - public EReference getDatagraphRoot_Departments() - { - return (EReference)datagraphRootEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getEmployees <em>Employees</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Employees</em>'. - * @see org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getEmployees() - * @see #getDatagraphRoot() - * @generated - */ - public EReference getDatagraphRoot_Employees() - { - return (EReference)datagraphRootEClass.getEStructuralFeatures().get(2); - } - - /** - * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType <em>Department Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Department Type</em>'. - * @see org.apache.tuscany.das.rdb.test.company.DepartmentType - * @generated - */ - public EClass getDepartmentType() - { - return departmentTypeEClass; - } - - /** - * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getEmployees <em>Employees</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Employees</em>'. - * @see org.apache.tuscany.das.rdb.test.company.DepartmentType#getEmployees() - * @see #getDepartmentType() - * @generated - */ - public EReference getDepartmentType_Employees() - { - return (EReference)departmentTypeEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getLocation <em>Location</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Location</em>'. - * @see org.apache.tuscany.das.rdb.test.company.DepartmentType#getLocation() - * @see #getDepartmentType() - * @generated - */ - public EAttribute getDepartmentType_Location() - { - return (EAttribute)departmentTypeEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getName <em>Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Name</em>'. - * @see org.apache.tuscany.das.rdb.test.company.DepartmentType#getName() - * @see #getDepartmentType() - * @generated - */ - public EAttribute getDepartmentType_Name() - { - return (EAttribute)departmentTypeEClass.getEStructuralFeatures().get(2); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber <em>Number</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Number</em>'. - * @see org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber() - * @see #getDepartmentType() - * @generated - */ - public EAttribute getDepartmentType_Number() - { - return (EAttribute)departmentTypeEClass.getEStructuralFeatures().get(3); - } - - /** - * Returns the meta object for class '{@link org.eclipse.emf.ecore.EObject <em>Document Root</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Document Root</em>'. - * @see org.eclipse.emf.ecore.EObject - * @generated - */ - public EClass getDocumentRoot() - { - return documentRootEClass; - } - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.emf.ecore.EObject#getMixed <em>Mixed</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Mixed</em>'. - * @see org.eclipse.emf.ecore.EObject#getMixed() - * @see #getDocumentRoot() - * @generated - */ - public EAttribute getDocumentRoot_Mixed() - { - return (EAttribute)documentRootEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap <em>XMLNS Prefix Map</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the map '<em>XMLNS Prefix Map</em>'. - * @see org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap() - * @see #getDocumentRoot() - * @generated - */ - public EReference getDocumentRoot_XMLNSPrefixMap() - { - return (EReference)documentRootEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXSISchemaLocation <em>XSI Schema Location</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the map '<em>XSI Schema Location</em>'. - * @see org.eclipse.emf.ecore.EObject#getXSISchemaLocation() - * @see #getDocumentRoot() - * @generated - */ - public EReference getDocumentRoot_XSISchemaLocation() - { - return (EReference)documentRootEClass.getEStructuralFeatures().get(2); - } - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.emf.ecore.EObject#getCompany <em>Company</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Company</em>'. - * @see org.eclipse.emf.ecore.EObject#getCompany() - * @see #getDocumentRoot() - * @generated - */ - public EReference getDocumentRoot_Company() - { - return (EReference)documentRootEClass.getEStructuralFeatures().get(3); - } - - /** - * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType <em>Employee Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Employee Type</em>'. - * @see org.apache.tuscany.das.rdb.test.company.EmployeeType - * @generated - */ - public EClass getEmployeeType() - { - return employeeTypeEClass; - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager <em>Manager</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Manager</em>'. - * @see org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager() - * @see #getEmployeeType() - * @generated - */ - public EAttribute getEmployeeType_Manager() - { - return (EAttribute)employeeTypeEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getName <em>Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Name</em>'. - * @see org.apache.tuscany.das.rdb.test.company.EmployeeType#getName() - * @see #getEmployeeType() - * @generated - */ - public EAttribute getEmployeeType_Name() - { - return (EAttribute)employeeTypeEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getSN <em>SN</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>SN</em>'. - * @see org.apache.tuscany.das.rdb.test.company.EmployeeType#getSN() - * @see #getEmployeeType() - * @generated - */ - public EAttribute getEmployeeType_SN() - { - return (EAttribute)employeeTypeEClass.getEStructuralFeatures().get(2); - } - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - public CompanyFactory getCompanyFactory() - { - return (CompanyFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() - { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - companyTypeEClass = createEClass(COMPANY_TYPE); - createEReference(companyTypeEClass, COMPANY_TYPE__DEPARTMENTS); - createEAttribute(companyTypeEClass, COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH); - createEAttribute(companyTypeEClass, COMPANY_TYPE__NAME); - - datagraphRootEClass = createEClass(DATAGRAPH_ROOT); - createEReference(datagraphRootEClass, DATAGRAPH_ROOT__COMPANIES); - createEReference(datagraphRootEClass, DATAGRAPH_ROOT__DEPARTMENTS); - createEReference(datagraphRootEClass, DATAGRAPH_ROOT__EMPLOYEES); - - departmentTypeEClass = createEClass(DEPARTMENT_TYPE); - createEReference(departmentTypeEClass, DEPARTMENT_TYPE__EMPLOYEES); - createEAttribute(departmentTypeEClass, DEPARTMENT_TYPE__LOCATION); - createEAttribute(departmentTypeEClass, DEPARTMENT_TYPE__NAME); - createEAttribute(departmentTypeEClass, DEPARTMENT_TYPE__NUMBER); - - documentRootEClass = createEClass(DOCUMENT_ROOT); - createEAttribute(documentRootEClass, DOCUMENT_ROOT__MIXED); - createEReference(documentRootEClass, DOCUMENT_ROOT__XMLNS_PREFIX_MAP); - createEReference(documentRootEClass, DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); - createEReference(documentRootEClass, DOCUMENT_ROOT__COMPANY); - - employeeTypeEClass = createEClass(EMPLOYEE_TYPE); - createEAttribute(employeeTypeEClass, EMPLOYEE_TYPE__MANAGER); - createEAttribute(employeeTypeEClass, EMPLOYEE_TYPE__NAME); - createEAttribute(employeeTypeEClass, EMPLOYEE_TYPE__SN); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() - { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); - - // Add supertypes to classes - - // Initialize classes and features; add operations and parameters - initEClass(companyTypeEClass, CompanyType.class, "CompanyType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getCompanyType_Departments(), this.getDepartmentType(), null, "departments", null, 1, -1, CompanyType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getCompanyType_EmployeeOfTheMonth(), theXMLTypePackage.getIDREF(), "employeeOfTheMonth", null, 0, 1, CompanyType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getCompanyType_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, CompanyType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(datagraphRootEClass, DatagraphRoot.class, "DatagraphRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getDatagraphRoot_Companies(), this.getCompanyType(), null, "companies", null, 0, -1, DatagraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getDatagraphRoot_Departments(), this.getDepartmentType(), null, "departments", null, 0, -1, DatagraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getDatagraphRoot_Employees(), this.getEmployeeType(), null, "employees", null, 0, -1, DatagraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(departmentTypeEClass, DepartmentType.class, "DepartmentType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getDepartmentType_Employees(), this.getEmployeeType(), null, "employees", null, 1, -1, DepartmentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getDepartmentType_Location(), theXMLTypePackage.getString(), "location", null, 0, 1, DepartmentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getDepartmentType_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, DepartmentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getDepartmentType_Number(), theXMLTypePackage.getInt(), "number", null, 0, 1, DepartmentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(documentRootEClass, null, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getDocumentRoot_Company(), this.getCompanyType(), null, "company", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); - - initEClass(employeeTypeEClass, EmployeeType.class, "EmployeeType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getEmployeeType_Manager(), theXMLTypePackage.getBoolean(), "manager", null, 0, 1, EmployeeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getEmployeeType_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, EmployeeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getEmployeeType_SN(), theXMLTypePackage.getID(), "sN", null, 0, 1, EmployeeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http:///org/eclipse/emf/ecore/util/ExtendedMetaData - createExtendedMetaDataAnnotations(); - } - - /** - * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createExtendedMetaDataAnnotations() - { - String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; - addAnnotation - (companyTypeEClass, - source, - new String[] - { - "name", "CompanyType", - "kind", "elementOnly" - }); - addAnnotation - (getCompanyType_Departments(), - source, - new String[] - { - "kind", "element", - "name", "departments" - }); - addAnnotation - (getCompanyType_EmployeeOfTheMonth(), - source, - new String[] - { - "kind", "attribute", - "name", "employeeOfTheMonth" - }); - addAnnotation - (getCompanyType_Name(), - source, - new String[] - { - "kind", "attribute", - "name", "name" - }); - addAnnotation - (datagraphRootEClass, - source, - new String[] - { - "name", "DatagraphRoot", - "kind", "elementOnly" - }); - addAnnotation - (getDatagraphRoot_Companies(), - source, - new String[] - { - "kind", "element", - "name", "companies" - }); - addAnnotation - (getDatagraphRoot_Departments(), - source, - new String[] - { - "kind", "element", - "name", "departments" - }); - addAnnotation - (getDatagraphRoot_Employees(), - source, - new String[] - { - "kind", "element", - "name", "employees" - }); - addAnnotation - (departmentTypeEClass, - source, - new String[] - { - "name", "DepartmentType", - "kind", "elementOnly" - }); - addAnnotation - (getDepartmentType_Employees(), - source, - new String[] - { - "kind", "element", - "name", "employees" - }); - addAnnotation - (getDepartmentType_Location(), - source, - new String[] - { - "kind", "attribute", - "name", "location" - }); - addAnnotation - (getDepartmentType_Name(), - source, - new String[] - { - "kind", "attribute", - "name", "name" - }); - addAnnotation - (getDepartmentType_Number(), - source, - new String[] - { - "kind", "attribute", - "name", "number" - }); - addAnnotation - (documentRootEClass, - source, - new String[] - { - "name", "", - "kind", "mixed" - }); - addAnnotation - (getDocumentRoot_Mixed(), - source, - new String[] - { - "kind", "elementWildcard", - "name", ":mixed" - }); - addAnnotation - (getDocumentRoot_XMLNSPrefixMap(), - source, - new String[] - { - "kind", "attribute", - "name", "xmlns:prefix" - }); - addAnnotation - (getDocumentRoot_XSISchemaLocation(), - source, - new String[] - { - "kind", "attribute", - "name", "xsi:schemaLocation" - }); - addAnnotation - (getDocumentRoot_Company(), - source, - new String[] - { - "kind", "element", - "name", "company", - "namespace", "##targetNamespace" - }); - addAnnotation - (employeeTypeEClass, - source, - new String[] - { - "name", "EmployeeType", - "kind", "empty" - }); - addAnnotation - (getEmployeeType_Manager(), - source, - new String[] - { - "kind", "attribute", - "name", "manager" - }); - addAnnotation - (getEmployeeType_Name(), - source, - new String[] - { - "kind", "attribute", - "name", "name" - }); - addAnnotation - (getEmployeeType_SN(), - source, - new String[] - { - "kind", "attribute", - "name", "SN" - }); - } - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - public interface Literals - { - /** - * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl <em>Type</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getCompanyType() - * @generated - */ - public static final EClass COMPANY_TYPE = eINSTANCE.getCompanyType(); - - /** - * The meta object literal for the '<em><b>Departments</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference COMPANY_TYPE__DEPARTMENTS = eINSTANCE.getCompanyType_Departments(); - - /** - * The meta object literal for the '<em><b>Employee Of The Month</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH = eINSTANCE.getCompanyType_EmployeeOfTheMonth(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute COMPANY_TYPE__NAME = eINSTANCE.getCompanyType_Name(); - - /** - * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl <em>Datagraph Root</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDatagraphRoot() - * @generated - */ - public static final EClass DATAGRAPH_ROOT = eINSTANCE.getDatagraphRoot(); - - /** - * The meta object literal for the '<em><b>Companies</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference DATAGRAPH_ROOT__COMPANIES = eINSTANCE.getDatagraphRoot_Companies(); - - /** - * The meta object literal for the '<em><b>Departments</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference DATAGRAPH_ROOT__DEPARTMENTS = eINSTANCE.getDatagraphRoot_Departments(); - - /** - * The meta object literal for the '<em><b>Employees</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference DATAGRAPH_ROOT__EMPLOYEES = eINSTANCE.getDatagraphRoot_Employees(); - - /** - * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl <em>Department Type</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDepartmentType() - * @generated - */ - public static final EClass DEPARTMENT_TYPE = eINSTANCE.getDepartmentType(); - - /** - * The meta object literal for the '<em><b>Employees</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference DEPARTMENT_TYPE__EMPLOYEES = eINSTANCE.getDepartmentType_Employees(); - - /** - * The meta object literal for the '<em><b>Location</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute DEPARTMENT_TYPE__LOCATION = eINSTANCE.getDepartmentType_Location(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute DEPARTMENT_TYPE__NAME = eINSTANCE.getDepartmentType_Name(); - - /** - * The meta object literal for the '<em><b>Number</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute DEPARTMENT_TYPE__NUMBER = eINSTANCE.getDepartmentType_Number(); - - /** - * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DocumentRootImpl <em>Document Root</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.DocumentRootImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDocumentRoot() - * @generated - */ - public static final EClass DOCUMENT_ROOT = eINSTANCE.getDocumentRoot(); - - /** - * The meta object literal for the '<em><b>Mixed</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute DOCUMENT_ROOT__MIXED = eINSTANCE.getDocumentRoot_Mixed(); - - /** - * The meta object literal for the '<em><b>XMLNS Prefix Map</b></em>' map feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference DOCUMENT_ROOT__XMLNS_PREFIX_MAP = eINSTANCE.getDocumentRoot_XMLNSPrefixMap(); - - /** - * The meta object literal for the '<em><b>XSI Schema Location</b></em>' map feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = eINSTANCE.getDocumentRoot_XSISchemaLocation(); - - /** - * The meta object literal for the '<em><b>Company</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference DOCUMENT_ROOT__COMPANY = eINSTANCE.getDocumentRoot_Company(); - - /** - * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl <em>Employee Type</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl - * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getEmployeeType() - * @generated - */ - public static final EClass EMPLOYEE_TYPE = eINSTANCE.getEmployeeType(); - - /** - * The meta object literal for the '<em><b>Manager</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute EMPLOYEE_TYPE__MANAGER = eINSTANCE.getEmployeeType_Manager(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute EMPLOYEE_TYPE__NAME = eINSTANCE.getEmployeeType_Name(); - - /** - * The meta object literal for the '<em><b>SN</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute EMPLOYEE_TYPE__SN = eINSTANCE.getEmployeeType_SN(); - - } - -} //CompanyPackageImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyTypeImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyTypeImpl.java deleted file mode 100644 index 76caa0bcdc..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyTypeImpl.java +++ /dev/null @@ -1,303 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company.impl; - -import java.util.Collection; -import java.util.List; - -import org.apache.tuscany.das.rdb.test.company.CompanyType; -import org.apache.tuscany.das.rdb.test.company.DepartmentType; - -import org.apache.tuscany.sdo.impl.DataObjectImpl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Type</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl#getDepartments <em>Departments</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl#getEmployeeOfTheMonth <em>Employee Of The Month</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl#getName <em>Name</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class CompanyTypeImpl extends DataObjectImpl implements CompanyType -{ - /** - * The cached value of the '{@link #getDepartments() <em>Departments</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDepartments() - * @generated - * @ordered - */ - protected EList departments = null; - - /** - * The default value of the '{@link #getEmployeeOfTheMonth() <em>Employee Of The Month</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEmployeeOfTheMonth() - * @generated - * @ordered - */ - protected static final String EMPLOYEE_OF_THE_MONTH_EDEFAULT = null; - - /** - * The cached value of the '{@link #getEmployeeOfTheMonth() <em>Employee Of The Month</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEmployeeOfTheMonth() - * @generated - * @ordered - */ - protected String employeeOfTheMonth = EMPLOYEE_OF_THE_MONTH_EDEFAULT; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected String name = NAME_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CompanyTypeImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() - { - return CompanyPackageImpl.Literals.COMPANY_TYPE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getDepartments() - { - if (departments == null) - { - departments = new EObjectContainmentEList(DepartmentType.class, this, CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS); - } - return departments; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getEmployeeOfTheMonth() - { - return employeeOfTheMonth; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setEmployeeOfTheMonth(String newEmployeeOfTheMonth) - { - String oldEmployeeOfTheMonth = employeeOfTheMonth; - employeeOfTheMonth = newEmployeeOfTheMonth; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH, oldEmployeeOfTheMonth, employeeOfTheMonth)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() - { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) - { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.COMPANY_TYPE__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: - return ((InternalEList)getDepartments()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: - return getDepartments(); - case CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH: - return getEmployeeOfTheMonth(); - case CompanyPackageImpl.COMPANY_TYPE__NAME: - return getName(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: - getDepartments().clear(); - getDepartments().addAll((Collection)newValue); - return; - case CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH: - setEmployeeOfTheMonth((String)newValue); - return; - case CompanyPackageImpl.COMPANY_TYPE__NAME: - setName((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) - { - switch (featureID) - { - case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: - getDepartments().clear(); - return; - case CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH: - setEmployeeOfTheMonth(EMPLOYEE_OF_THE_MONTH_EDEFAULT); - return; - case CompanyPackageImpl.COMPANY_TYPE__NAME: - setName(NAME_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: - return departments != null && !departments.isEmpty(); - case CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH: - return EMPLOYEE_OF_THE_MONTH_EDEFAULT == null ? employeeOfTheMonth != null : !EMPLOYEE_OF_THE_MONTH_EDEFAULT.equals(employeeOfTheMonth); - case CompanyPackageImpl.COMPANY_TYPE__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (employeeOfTheMonth: "); - result.append(employeeOfTheMonth); - result.append(", name: "); - result.append(name); - result.append(')'); - return result.toString(); - } - -} //CompanyTypeImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DatagraphRootImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DatagraphRootImpl.java deleted file mode 100644 index cde59e98ed..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DatagraphRootImpl.java +++ /dev/null @@ -1,252 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company.impl; - -import java.util.Collection; -import java.util.List; - -import org.apache.tuscany.das.rdb.test.company.CompanyType; -import org.apache.tuscany.das.rdb.test.company.DatagraphRoot; -import org.apache.tuscany.das.rdb.test.company.DepartmentType; -import org.apache.tuscany.das.rdb.test.company.EmployeeType; - -import org.apache.tuscany.sdo.impl.DataObjectImpl; - -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Datagraph Root</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl#getCompanies <em>Companies</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl#getDepartments <em>Departments</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl#getEmployees <em>Employees</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class DatagraphRootImpl extends DataObjectImpl implements DatagraphRoot -{ - /** - * The cached value of the '{@link #getCompanies() <em>Companies</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCompanies() - * @generated - * @ordered - */ - protected EList companies = null; - - /** - * The cached value of the '{@link #getDepartments() <em>Departments</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDepartments() - * @generated - * @ordered - */ - protected EList departments = null; - - /** - * The cached value of the '{@link #getEmployees() <em>Employees</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEmployees() - * @generated - * @ordered - */ - protected EList employees = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected DatagraphRootImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() - { - return CompanyPackageImpl.Literals.DATAGRAPH_ROOT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getCompanies() - { - if (companies == null) - { - companies = new EObjectContainmentEList(CompanyType.class, this, CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES); - } - return companies; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getDepartments() - { - if (departments == null) - { - departments = new EObjectContainmentEList(DepartmentType.class, this, CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS); - } - return departments; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getEmployees() - { - if (employees == null) - { - employees = new EObjectContainmentEList(EmployeeType.class, this, CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES); - } - return employees; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: - return ((InternalEList)getCompanies()).basicRemove(otherEnd, msgs); - case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: - return ((InternalEList)getDepartments()).basicRemove(otherEnd, msgs); - case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: - return ((InternalEList)getEmployees()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: - return getCompanies(); - case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: - return getDepartments(); - case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: - return getEmployees(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: - getCompanies().clear(); - getCompanies().addAll((Collection)newValue); - return; - case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: - getDepartments().clear(); - getDepartments().addAll((Collection)newValue); - return; - case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: - getEmployees().clear(); - getEmployees().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) - { - switch (featureID) - { - case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: - getCompanies().clear(); - return; - case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: - getDepartments().clear(); - return; - case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: - getEmployees().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: - return companies != null && !companies.isEmpty(); - case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: - return departments != null && !departments.isEmpty(); - case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: - return employees != null && !employees.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //DatagraphRootImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DepartmentTypeImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DepartmentTypeImpl.java deleted file mode 100644 index 9ceb2d8da7..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DepartmentTypeImpl.java +++ /dev/null @@ -1,395 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company.impl; - -import java.util.Collection; -import java.util.List; - -import org.apache.tuscany.das.rdb.test.company.DepartmentType; -import org.apache.tuscany.das.rdb.test.company.EmployeeType; - -import org.apache.tuscany.sdo.impl.DataObjectImpl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Department Type</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl#getEmployees <em>Employees</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl#getLocation <em>Location</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl#getName <em>Name</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl#getNumber <em>Number</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class DepartmentTypeImpl extends DataObjectImpl implements DepartmentType -{ - /** - * The cached value of the '{@link #getEmployees() <em>Employees</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEmployees() - * @generated - * @ordered - */ - protected EList employees = null; - - /** - * The default value of the '{@link #getLocation() <em>Location</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getLocation() - * @generated - * @ordered - */ - protected static final String LOCATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getLocation() <em>Location</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getLocation() - * @generated - * @ordered - */ - protected String location = LOCATION_EDEFAULT; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected String name = NAME_EDEFAULT; - - /** - * The default value of the '{@link #getNumber() <em>Number</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getNumber() - * @generated - * @ordered - */ - protected static final int NUMBER_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getNumber() <em>Number</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getNumber() - * @generated - * @ordered - */ - protected int number = NUMBER_EDEFAULT; - - /** - * This is true if the Number attribute has been set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - protected boolean numberESet = false; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected DepartmentTypeImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() - { - return CompanyPackageImpl.Literals.DEPARTMENT_TYPE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getEmployees() - { - if (employees == null) - { - employees = new EObjectContainmentEList(EmployeeType.class, this, CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES); - } - return employees; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getLocation() - { - return location; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setLocation(String newLocation) - { - String oldLocation = location; - location = newLocation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION, oldLocation, location)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() - { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) - { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.DEPARTMENT_TYPE__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getNumber() - { - return number; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setNumber(int newNumber) - { - int oldNumber = number; - number = newNumber; - boolean oldNumberESet = numberESet; - numberESet = true; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER, oldNumber, number, !oldNumberESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void unsetNumber() - { - int oldNumber = number; - boolean oldNumberESet = numberESet; - number = NUMBER_EDEFAULT; - numberESet = false; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.UNSET, CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER, oldNumber, NUMBER_EDEFAULT, oldNumberESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSetNumber() - { - return numberESet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: - return ((InternalEList)getEmployees()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: - return getEmployees(); - case CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION: - return getLocation(); - case CompanyPackageImpl.DEPARTMENT_TYPE__NAME: - return getName(); - case CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER: - return new Integer(getNumber()); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: - getEmployees().clear(); - getEmployees().addAll((Collection)newValue); - return; - case CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION: - setLocation((String)newValue); - return; - case CompanyPackageImpl.DEPARTMENT_TYPE__NAME: - setName((String)newValue); - return; - case CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER: - setNumber(((Integer)newValue).intValue()); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) - { - switch (featureID) - { - case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: - getEmployees().clear(); - return; - case CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION: - setLocation(LOCATION_EDEFAULT); - return; - case CompanyPackageImpl.DEPARTMENT_TYPE__NAME: - setName(NAME_EDEFAULT); - return; - case CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER: - unsetNumber(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: - return employees != null && !employees.isEmpty(); - case CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION: - return LOCATION_EDEFAULT == null ? location != null : !LOCATION_EDEFAULT.equals(location); - case CompanyPackageImpl.DEPARTMENT_TYPE__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER: - return isSetNumber(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (location: "); - result.append(location); - result.append(", name: "); - result.append(name); - result.append(", number: "); - if (numberESet) result.append(number); else result.append("<unset>"); - result.append(')'); - return result.toString(); - } - -} //DepartmentTypeImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/EmployeeTypeImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/EmployeeTypeImpl.java deleted file mode 100644 index 39d0e6b876..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/EmployeeTypeImpl.java +++ /dev/null @@ -1,333 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.company.impl; - -import org.apache.tuscany.das.rdb.test.company.EmployeeType; - -import org.apache.tuscany.sdo.impl.DataObjectImpl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Employee Type</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl#isManager <em>Manager</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl#getName <em>Name</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl#getSN <em>SN</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class EmployeeTypeImpl extends DataObjectImpl implements EmployeeType -{ - /** - * The default value of the '{@link #isManager() <em>Manager</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isManager() - * @generated - * @ordered - */ - protected static final boolean MANAGER_EDEFAULT = false; - - /** - * The cached value of the '{@link #isManager() <em>Manager</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isManager() - * @generated - * @ordered - */ - protected boolean manager = MANAGER_EDEFAULT; - - /** - * This is true if the Manager attribute has been set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - protected boolean managerESet = false; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected String name = NAME_EDEFAULT; - - /** - * The default value of the '{@link #getSN() <em>SN</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSN() - * @generated - * @ordered - */ - protected static final String SN_EDEFAULT = null; - - /** - * The cached value of the '{@link #getSN() <em>SN</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSN() - * @generated - * @ordered - */ - protected String sN = SN_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EmployeeTypeImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() - { - return CompanyPackageImpl.Literals.EMPLOYEE_TYPE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isManager() - { - return manager; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setManager(boolean newManager) - { - boolean oldManager = manager; - manager = newManager; - boolean oldManagerESet = managerESet; - managerESet = true; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER, oldManager, manager, !oldManagerESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void unsetManager() - { - boolean oldManager = manager; - boolean oldManagerESet = managerESet; - manager = MANAGER_EDEFAULT; - managerESet = false; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.UNSET, CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER, oldManager, MANAGER_EDEFAULT, oldManagerESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSetManager() - { - return managerESet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() - { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) - { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.EMPLOYEE_TYPE__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getSN() - { - return sN; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSN(String newSN) - { - String oldSN = sN; - sN = newSN; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.EMPLOYEE_TYPE__SN, oldSN, sN)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER: - return isManager() ? Boolean.TRUE : Boolean.FALSE; - case CompanyPackageImpl.EMPLOYEE_TYPE__NAME: - return getName(); - case CompanyPackageImpl.EMPLOYEE_TYPE__SN: - return getSN(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER: - setManager(((Boolean)newValue).booleanValue()); - return; - case CompanyPackageImpl.EMPLOYEE_TYPE__NAME: - setName((String)newValue); - return; - case CompanyPackageImpl.EMPLOYEE_TYPE__SN: - setSN((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) - { - switch (featureID) - { - case CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER: - unsetManager(); - return; - case CompanyPackageImpl.EMPLOYEE_TYPE__NAME: - setName(NAME_EDEFAULT); - return; - case CompanyPackageImpl.EMPLOYEE_TYPE__SN: - setSN(SN_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER: - return isSetManager(); - case CompanyPackageImpl.EMPLOYEE_TYPE__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case CompanyPackageImpl.EMPLOYEE_TYPE__SN: - return SN_EDEFAULT == null ? sN != null : !SN_EDEFAULT.equals(sN); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (manager: "); - if (managerESet) result.append(manager); else result.append("<unset>"); - result.append(", name: "); - result.append(name); - result.append(", sN: "); - result.append(sN); - result.append(')'); - return result.toString(); - } - -} //EmployeeTypeImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/AnOrder.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/AnOrder.java deleted file mode 100644 index 1cbc53c1ab..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/AnOrder.java +++ /dev/null @@ -1,216 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.customer; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>An Order</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID <em>ID</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getProduct <em>Product</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity <em>Quantity</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID <em>Customer ID</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public interface AnOrder -{ - /** - * Returns the value of the '<em><b>ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>ID</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>ID</em>' attribute. - * @see #isSetID() - * @see #unsetID() - * @see #setID(int) - * @generated - */ - int getID(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>ID</em>' attribute. - * @see #isSetID() - * @see #unsetID() - * @see #getID() - * @generated - */ - void setID(int value); - - /** - * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSetID() - * @see #getID() - * @see #setID(int) - * @generated - */ - void unsetID(); - - /** - * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID <em>ID</em>}' attribute is set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return whether the value of the '<em>ID</em>' attribute is set. - * @see #unsetID() - * @see #getID() - * @see #setID(int) - * @generated - */ - boolean isSetID(); - - /** - * Returns the value of the '<em><b>Product</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Product</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Product</em>' attribute. - * @see #setProduct(String) - * @generated - */ - String getProduct(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getProduct <em>Product</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Product</em>' attribute. - * @see #getProduct() - * @generated - */ - void setProduct(String value); - - /** - * Returns the value of the '<em><b>Quantity</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Quantity</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Quantity</em>' attribute. - * @see #isSetQuantity() - * @see #unsetQuantity() - * @see #setQuantity(int) - * @generated - */ - int getQuantity(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity <em>Quantity</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Quantity</em>' attribute. - * @see #isSetQuantity() - * @see #unsetQuantity() - * @see #getQuantity() - * @generated - */ - void setQuantity(int value); - - /** - * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity <em>Quantity</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSetQuantity() - * @see #getQuantity() - * @see #setQuantity(int) - * @generated - */ - void unsetQuantity(); - - /** - * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity <em>Quantity</em>}' attribute is set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return whether the value of the '<em>Quantity</em>' attribute is set. - * @see #unsetQuantity() - * @see #getQuantity() - * @see #setQuantity(int) - * @generated - */ - boolean isSetQuantity(); - - /** - * Returns the value of the '<em><b>Customer ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Customer ID</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Customer ID</em>' attribute. - * @see #isSetCustomerID() - * @see #unsetCustomerID() - * @see #setCustomerID(int) - * @generated - */ - int getCustomerID(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID <em>Customer ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Customer ID</em>' attribute. - * @see #isSetCustomerID() - * @see #unsetCustomerID() - * @see #getCustomerID() - * @generated - */ - void setCustomerID(int value); - - /** - * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID <em>Customer ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSetCustomerID() - * @see #getCustomerID() - * @see #setCustomerID(int) - * @generated - */ - void unsetCustomerID(); - - /** - * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID <em>Customer ID</em>}' attribute is set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return whether the value of the '<em>Customer ID</em>' attribute is set. - * @see #unsetCustomerID() - * @see #getCustomerID() - * @see #setCustomerID(int) - * @generated - */ - boolean isSetCustomerID(); - -} // AnOrder diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/Customer.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/Customer.java deleted file mode 100644 index 5f6e71f153..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/Customer.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.customer; - -import java.util.List; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Customer</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.Customer#getID <em>ID</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.Customer#getLastName <em>Last Name</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.Customer#getAddress <em>Address</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.Customer#getOrders <em>Orders</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public interface Customer -{ - /** - * Returns the value of the '<em><b>ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>ID</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>ID</em>' attribute. - * @see #isSetID() - * @see #unsetID() - * @see #setID(int) - * @generated - */ - int getID(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getID <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>ID</em>' attribute. - * @see #isSetID() - * @see #unsetID() - * @see #getID() - * @generated - */ - void setID(int value); - - /** - * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getID <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSetID() - * @see #getID() - * @see #setID(int) - * @generated - */ - void unsetID(); - - /** - * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getID <em>ID</em>}' attribute is set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return whether the value of the '<em>ID</em>' attribute is set. - * @see #unsetID() - * @see #getID() - * @see #setID(int) - * @generated - */ - boolean isSetID(); - - /** - * Returns the value of the '<em><b>Last Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Last Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Last Name</em>' attribute. - * @see #setLastName(String) - * @generated - */ - String getLastName(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getLastName <em>Last Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Last Name</em>' attribute. - * @see #getLastName() - * @generated - */ - void setLastName(String value); - - /** - * Returns the value of the '<em><b>Address</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Address</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Address</em>' attribute. - * @see #setAddress(String) - * @generated - */ - String getAddress(); - - /** - * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getAddress <em>Address</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Address</em>' attribute. - * @see #getAddress() - * @generated - */ - void setAddress(String value); - - /** - * Returns the value of the '<em><b>Orders</b></em>' containment reference list. - * The list contents are of type {@link org.apache.tuscany.das.rdb.test.customer.AnOrder}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Orders</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Orders</em>' containment reference list. - * @generated - */ - List getOrders(); - -} // Customer diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/CustomerFactory.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/CustomerFactory.java deleted file mode 100644 index 67f8c2eca6..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/CustomerFactory.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.customer; - - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @generated - */ -public interface CustomerFactory -{ - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CustomerFactory INSTANCE = org.apache.tuscany.das.rdb.test.customer.impl.CustomerFactoryImpl.eINSTANCE; - - /** - * Returns a new object of class '<em>An Order</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>An Order</em>'. - * @generated - */ - AnOrder createAnOrder(); - - /** - * Returns a new object of class '<em>Customer</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Customer</em>'. - * @generated - */ - Customer createCustomer(); - - /** - * Returns a new object of class '<em>Data Graph Root</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Data Graph Root</em>'. - * @generated - */ - DataGraphRoot createDataGraphRoot(); - -} //CustomerFactory diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/DataGraphRoot.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/DataGraphRoot.java deleted file mode 100644 index eeb9d8a9bb..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/DataGraphRoot.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.customer; - -import java.util.List; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Data Graph Root</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getCustomers <em>Customers</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getOrders <em>Orders</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public interface DataGraphRoot -{ - /** - * Returns the value of the '<em><b>Customers</b></em>' containment reference list. - * The list contents are of type {@link org.apache.tuscany.das.rdb.test.customer.Customer}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Customers</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Customers</em>' containment reference list. - * @generated - */ - List getCustomers(); - - /** - * Returns the value of the '<em><b>Orders</b></em>' containment reference list. - * The list contents are of type {@link org.apache.tuscany.das.rdb.test.customer.AnOrder}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Orders</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Orders</em>' containment reference list. - * @generated - */ - List getOrders(); - -} // DataGraphRoot diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/AnOrderImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/AnOrderImpl.java deleted file mode 100644 index c4117be1c7..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/AnOrderImpl.java +++ /dev/null @@ -1,461 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.customer.impl; - -import org.apache.tuscany.das.rdb.test.customer.AnOrder; - -import org.apache.tuscany.sdo.impl.DataObjectImpl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>An Order</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl#getID <em>ID</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl#getProduct <em>Product</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl#getQuantity <em>Quantity</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl#getCustomerID <em>Customer ID</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class AnOrderImpl extends DataObjectImpl implements AnOrder -{ - /** - * The default value of the '{@link #getID() <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getID() - * @generated - * @ordered - */ - protected static final int ID_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getID() <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getID() - * @generated - * @ordered - */ - protected int iD = ID_EDEFAULT; - - /** - * This is true if the ID attribute has been set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - protected boolean iDESet = false; - - /** - * The default value of the '{@link #getProduct() <em>Product</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getProduct() - * @generated - * @ordered - */ - protected static final String PRODUCT_EDEFAULT = null; - - /** - * The cached value of the '{@link #getProduct() <em>Product</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getProduct() - * @generated - * @ordered - */ - protected String product = PRODUCT_EDEFAULT; - - /** - * The default value of the '{@link #getQuantity() <em>Quantity</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getQuantity() - * @generated - * @ordered - */ - protected static final int QUANTITY_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getQuantity() <em>Quantity</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getQuantity() - * @generated - * @ordered - */ - protected int quantity = QUANTITY_EDEFAULT; - - /** - * This is true if the Quantity attribute has been set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - protected boolean quantityESet = false; - - /** - * The default value of the '{@link #getCustomerID() <em>Customer ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomerID() - * @generated - * @ordered - */ - protected static final int CUSTOMER_ID_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getCustomerID() <em>Customer ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomerID() - * @generated - * @ordered - */ - protected int customerID = CUSTOMER_ID_EDEFAULT; - - /** - * This is true if the Customer ID attribute has been set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - protected boolean customerIDESet = false; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AnOrderImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() - { - return CustomerPackageImpl.Literals.AN_ORDER; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getID() - { - return iD; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setID(int newID) - { - int oldID = iD; - iD = newID; - boolean oldIDESet = iDESet; - iDESet = true; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.AN_ORDER__ID, oldID, iD, !oldIDESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void unsetID() - { - int oldID = iD; - boolean oldIDESet = iDESet; - iD = ID_EDEFAULT; - iDESet = false; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.UNSET, CustomerPackageImpl.AN_ORDER__ID, oldID, ID_EDEFAULT, oldIDESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSetID() - { - return iDESet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getProduct() - { - return product; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setProduct(String newProduct) - { - String oldProduct = product; - product = newProduct; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.AN_ORDER__PRODUCT, oldProduct, product)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getQuantity() - { - return quantity; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setQuantity(int newQuantity) - { - int oldQuantity = quantity; - quantity = newQuantity; - boolean oldQuantityESet = quantityESet; - quantityESet = true; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.AN_ORDER__QUANTITY, oldQuantity, quantity, !oldQuantityESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void unsetQuantity() - { - int oldQuantity = quantity; - boolean oldQuantityESet = quantityESet; - quantity = QUANTITY_EDEFAULT; - quantityESet = false; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.UNSET, CustomerPackageImpl.AN_ORDER__QUANTITY, oldQuantity, QUANTITY_EDEFAULT, oldQuantityESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSetQuantity() - { - return quantityESet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getCustomerID() - { - return customerID; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCustomerID(int newCustomerID) - { - int oldCustomerID = customerID; - customerID = newCustomerID; - boolean oldCustomerIDESet = customerIDESet; - customerIDESet = true; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.AN_ORDER__CUSTOMER_ID, oldCustomerID, customerID, !oldCustomerIDESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void unsetCustomerID() - { - int oldCustomerID = customerID; - boolean oldCustomerIDESet = customerIDESet; - customerID = CUSTOMER_ID_EDEFAULT; - customerIDESet = false; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.UNSET, CustomerPackageImpl.AN_ORDER__CUSTOMER_ID, oldCustomerID, CUSTOMER_ID_EDEFAULT, oldCustomerIDESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSetCustomerID() - { - return customerIDESet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case CustomerPackageImpl.AN_ORDER__ID: - return new Integer(getID()); - case CustomerPackageImpl.AN_ORDER__PRODUCT: - return getProduct(); - case CustomerPackageImpl.AN_ORDER__QUANTITY: - return new Integer(getQuantity()); - case CustomerPackageImpl.AN_ORDER__CUSTOMER_ID: - return new Integer(getCustomerID()); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case CustomerPackageImpl.AN_ORDER__ID: - setID(((Integer)newValue).intValue()); - return; - case CustomerPackageImpl.AN_ORDER__PRODUCT: - setProduct((String)newValue); - return; - case CustomerPackageImpl.AN_ORDER__QUANTITY: - setQuantity(((Integer)newValue).intValue()); - return; - case CustomerPackageImpl.AN_ORDER__CUSTOMER_ID: - setCustomerID(((Integer)newValue).intValue()); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) - { - switch (featureID) - { - case CustomerPackageImpl.AN_ORDER__ID: - unsetID(); - return; - case CustomerPackageImpl.AN_ORDER__PRODUCT: - setProduct(PRODUCT_EDEFAULT); - return; - case CustomerPackageImpl.AN_ORDER__QUANTITY: - unsetQuantity(); - return; - case CustomerPackageImpl.AN_ORDER__CUSTOMER_ID: - unsetCustomerID(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case CustomerPackageImpl.AN_ORDER__ID: - return isSetID(); - case CustomerPackageImpl.AN_ORDER__PRODUCT: - return PRODUCT_EDEFAULT == null ? product != null : !PRODUCT_EDEFAULT.equals(product); - case CustomerPackageImpl.AN_ORDER__QUANTITY: - return isSetQuantity(); - case CustomerPackageImpl.AN_ORDER__CUSTOMER_ID: - return isSetCustomerID(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (iD: "); - if (iDESet) result.append(iD); else result.append("<unset>"); - result.append(", product: "); - result.append(product); - result.append(", quantity: "); - if (quantityESet) result.append(quantity); else result.append("<unset>"); - result.append(", customerID: "); - if (customerIDESet) result.append(customerID); else result.append("<unset>"); - result.append(')'); - return result.toString(); - } - -} //AnOrderImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerFactoryImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerFactoryImpl.java deleted file mode 100644 index 00b1ede09c..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerFactoryImpl.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.customer.impl; - -import org.apache.tuscany.das.rdb.test.customer.*; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class CustomerFactoryImpl extends EFactoryImpl implements CustomerFactory -{ - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final CustomerFactoryImpl eINSTANCE = init(); - - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static CustomerFactoryImpl init() - { - try - { - CustomerFactoryImpl theCustomerFactory = (CustomerFactoryImpl)EPackage.Registry.INSTANCE.getEFactory("http:///org.apache.tuscany.das.rdb.test/customer.xsd"); - if (theCustomerFactory != null) - { - return theCustomerFactory; - } - } - catch (Exception exception) - { - EcorePlugin.INSTANCE.log(exception); - } - return new CustomerFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomerFactoryImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) - { - switch (eClass.getClassifierID()) - { - case CustomerPackageImpl.AN_ORDER: return (EObject)createAnOrder(); - case CustomerPackageImpl.CUSTOMER: return (EObject)createCustomer(); - case CustomerPackageImpl.DATA_GRAPH_ROOT: return (EObject)createDataGraphRoot(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AnOrder createAnOrder() - { - AnOrderImpl anOrder = new AnOrderImpl(); - return anOrder; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Customer createCustomer() - { - CustomerImpl customer = new CustomerImpl(); - return customer; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DataGraphRoot createDataGraphRoot() - { - DataGraphRootImpl dataGraphRoot = new DataGraphRootImpl(); - return dataGraphRoot; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomerPackageImpl getCustomerPackageImpl() - { - return (CustomerPackageImpl)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - public static CustomerPackageImpl getPackage() - { - return CustomerPackageImpl.eINSTANCE; - } - -} //CustomerFactoryImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerImpl.java deleted file mode 100644 index 02be07ac41..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerImpl.java +++ /dev/null @@ -1,395 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.customer.impl; - -import java.util.Collection; -import java.util.List; - -import org.apache.tuscany.das.rdb.test.customer.AnOrder; -import org.apache.tuscany.das.rdb.test.customer.Customer; - -import org.apache.tuscany.sdo.impl.DataObjectImpl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Customer</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl#getID <em>ID</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl#getLastName <em>Last Name</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl#getAddress <em>Address</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl#getOrders <em>Orders</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class CustomerImpl extends DataObjectImpl implements Customer -{ - /** - * The default value of the '{@link #getID() <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getID() - * @generated - * @ordered - */ - protected static final int ID_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getID() <em>ID</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getID() - * @generated - * @ordered - */ - protected int iD = ID_EDEFAULT; - - /** - * This is true if the ID attribute has been set. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - protected boolean iDESet = false; - - /** - * The default value of the '{@link #getLastName() <em>Last Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getLastName() - * @generated - * @ordered - */ - protected static final String LAST_NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getLastName() <em>Last Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getLastName() - * @generated - * @ordered - */ - protected String lastName = LAST_NAME_EDEFAULT; - - /** - * The default value of the '{@link #getAddress() <em>Address</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getAddress() - * @generated - * @ordered - */ - protected static final String ADDRESS_EDEFAULT = null; - - /** - * The cached value of the '{@link #getAddress() <em>Address</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getAddress() - * @generated - * @ordered - */ - protected String address = ADDRESS_EDEFAULT; - - /** - * The cached value of the '{@link #getOrders() <em>Orders</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOrders() - * @generated - * @ordered - */ - protected EList orders = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CustomerImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() - { - return CustomerPackageImpl.Literals.CUSTOMER; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getID() - { - return iD; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setID(int newID) - { - int oldID = iD; - iD = newID; - boolean oldIDESet = iDESet; - iDESet = true; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.CUSTOMER__ID, oldID, iD, !oldIDESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void unsetID() - { - int oldID = iD; - boolean oldIDESet = iDESet; - iD = ID_EDEFAULT; - iDESet = false; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.UNSET, CustomerPackageImpl.CUSTOMER__ID, oldID, ID_EDEFAULT, oldIDESet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSetID() - { - return iDESet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getLastName() - { - return lastName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setLastName(String newLastName) - { - String oldLastName = lastName; - lastName = newLastName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.CUSTOMER__LAST_NAME, oldLastName, lastName)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getAddress() - { - return address; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setAddress(String newAddress) - { - String oldAddress = address; - address = newAddress; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.CUSTOMER__ADDRESS, oldAddress, address)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getOrders() - { - if (orders == null) - { - orders = new EObjectContainmentEList(AnOrder.class, this, CustomerPackageImpl.CUSTOMER__ORDERS); - } - return orders; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case CustomerPackageImpl.CUSTOMER__ORDERS: - return ((InternalEList)getOrders()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case CustomerPackageImpl.CUSTOMER__ID: - return new Integer(getID()); - case CustomerPackageImpl.CUSTOMER__LAST_NAME: - return getLastName(); - case CustomerPackageImpl.CUSTOMER__ADDRESS: - return getAddress(); - case CustomerPackageImpl.CUSTOMER__ORDERS: - return getOrders(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case CustomerPackageImpl.CUSTOMER__ID: - setID(((Integer)newValue).intValue()); - return; - case CustomerPackageImpl.CUSTOMER__LAST_NAME: - setLastName((String)newValue); - return; - case CustomerPackageImpl.CUSTOMER__ADDRESS: - setAddress((String)newValue); - return; - case CustomerPackageImpl.CUSTOMER__ORDERS: - getOrders().clear(); - getOrders().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) - { - switch (featureID) - { - case CustomerPackageImpl.CUSTOMER__ID: - unsetID(); - return; - case CustomerPackageImpl.CUSTOMER__LAST_NAME: - setLastName(LAST_NAME_EDEFAULT); - return; - case CustomerPackageImpl.CUSTOMER__ADDRESS: - setAddress(ADDRESS_EDEFAULT); - return; - case CustomerPackageImpl.CUSTOMER__ORDERS: - getOrders().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case CustomerPackageImpl.CUSTOMER__ID: - return isSetID(); - case CustomerPackageImpl.CUSTOMER__LAST_NAME: - return LAST_NAME_EDEFAULT == null ? lastName != null : !LAST_NAME_EDEFAULT.equals(lastName); - case CustomerPackageImpl.CUSTOMER__ADDRESS: - return ADDRESS_EDEFAULT == null ? address != null : !ADDRESS_EDEFAULT.equals(address); - case CustomerPackageImpl.CUSTOMER__ORDERS: - return orders != null && !orders.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (iD: "); - if (iDESet) result.append(iD); else result.append("<unset>"); - result.append(", lastName: "); - result.append(lastName); - result.append(", address: "); - result.append(address); - result.append(')'); - return result.toString(); - } - -} //CustomerImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerPackageImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerPackageImpl.java deleted file mode 100644 index ca33c06814..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerPackageImpl.java +++ /dev/null @@ -1,847 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.customer.impl; - -import org.apache.tuscany.das.rdb.test.customer.AnOrder; -import org.apache.tuscany.das.rdb.test.customer.Customer; -import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; -import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.ecore.xml.type.XMLTypePackage; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.customer.CustomerFactory - * @generated - */ -public class CustomerPackageImpl extends EPackageImpl -{ - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String eNAME = "customer"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String eNS_URI = "http:///org.apache.tuscany.das.rdb.test/customer.xsd"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String eNS_PREFIX = "customer"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final CustomerPackageImpl eINSTANCE = org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl.init(); - - /** - * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl <em>An Order</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl - * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getAnOrder() - * @generated - */ - public static final int AN_ORDER = 0; - - /** - * The feature id for the '<em><b>ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int AN_ORDER__ID = 0; - - /** - * The feature id for the '<em><b>Product</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int AN_ORDER__PRODUCT = 1; - - /** - * The feature id for the '<em><b>Quantity</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int AN_ORDER__QUANTITY = 2; - - /** - * The feature id for the '<em><b>Customer ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int AN_ORDER__CUSTOMER_ID = 3; - - /** - * The number of structural features of the '<em>An Order</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int AN_ORDER_FEATURE_COUNT = 4; - - /** - * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl <em>Customer</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl - * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getCustomer() - * @generated - */ - public static final int CUSTOMER = 1; - - /** - * The feature id for the '<em><b>ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int CUSTOMER__ID = 0; - - /** - * The feature id for the '<em><b>Last Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int CUSTOMER__LAST_NAME = 1; - - /** - * The feature id for the '<em><b>Address</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int CUSTOMER__ADDRESS = 2; - - /** - * The feature id for the '<em><b>Orders</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int CUSTOMER__ORDERS = 3; - - /** - * The number of structural features of the '<em>Customer</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int CUSTOMER_FEATURE_COUNT = 4; - - /** - * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl <em>Data Graph Root</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl - * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getDataGraphRoot() - * @generated - */ - public static final int DATA_GRAPH_ROOT = 2; - - /** - * The feature id for the '<em><b>Customers</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DATA_GRAPH_ROOT__CUSTOMERS = 0; - - /** - * The feature id for the '<em><b>Orders</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DATA_GRAPH_ROOT__ORDERS = 1; - - /** - * The number of structural features of the '<em>Data Graph Root</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - public static final int DATA_GRAPH_ROOT_FEATURE_COUNT = 2; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass anOrderEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass customerEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass dataGraphRootEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#eNS_URI - * @see #init() - * @generated - */ - private CustomerPackageImpl() - { - super(eNS_URI, ((EFactory)CustomerFactory.INSTANCE)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - * <p>Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - * <p>Invocation of this method will not affect any packages that have - * already been initialized. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static CustomerPackageImpl init() - { - if (isInited) return (CustomerPackageImpl)EPackage.Registry.INSTANCE.getEPackage(CustomerPackageImpl.eNS_URI); - - // Obtain or create and register package - CustomerPackageImpl theCustomerPackageImpl = (CustomerPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof CustomerPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new CustomerPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - XMLTypePackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theCustomerPackageImpl.createPackageContents(); - - // Initialize created meta-data - theCustomerPackageImpl.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theCustomerPackageImpl.freeze(); - - return theCustomerPackageImpl; - } - - - /** - * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder <em>An Order</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>An Order</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.AnOrder - * @generated - */ - public EClass getAnOrder() - { - return anOrderEClass; - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID <em>ID</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>ID</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.AnOrder#getID() - * @see #getAnOrder() - * @generated - */ - public EAttribute getAnOrder_ID() - { - return (EAttribute)anOrderEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getProduct <em>Product</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Product</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.AnOrder#getProduct() - * @see #getAnOrder() - * @generated - */ - public EAttribute getAnOrder_Product() - { - return (EAttribute)anOrderEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity <em>Quantity</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Quantity</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity() - * @see #getAnOrder() - * @generated - */ - public EAttribute getAnOrder_Quantity() - { - return (EAttribute)anOrderEClass.getEStructuralFeatures().get(2); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID <em>Customer ID</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Customer ID</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID() - * @see #getAnOrder() - * @generated - */ - public EAttribute getAnOrder_CustomerID() - { - return (EAttribute)anOrderEClass.getEStructuralFeatures().get(3); - } - - /** - * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.customer.Customer <em>Customer</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Customer</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.Customer - * @generated - */ - public EClass getCustomer() - { - return customerEClass; - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getID <em>ID</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>ID</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.Customer#getID() - * @see #getCustomer() - * @generated - */ - public EAttribute getCustomer_ID() - { - return (EAttribute)customerEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getLastName <em>Last Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Last Name</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.Customer#getLastName() - * @see #getCustomer() - * @generated - */ - public EAttribute getCustomer_LastName() - { - return (EAttribute)customerEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getAddress <em>Address</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Address</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.Customer#getAddress() - * @see #getCustomer() - * @generated - */ - public EAttribute getCustomer_Address() - { - return (EAttribute)customerEClass.getEStructuralFeatures().get(2); - } - - /** - * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getOrders <em>Orders</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Orders</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.Customer#getOrders() - * @see #getCustomer() - * @generated - */ - public EReference getCustomer_Orders() - { - return (EReference)customerEClass.getEStructuralFeatures().get(3); - } - - /** - * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot <em>Data Graph Root</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Data Graph Root</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.DataGraphRoot - * @generated - */ - public EClass getDataGraphRoot() - { - return dataGraphRootEClass; - } - - /** - * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getCustomers <em>Customers</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Customers</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getCustomers() - * @see #getDataGraphRoot() - * @generated - */ - public EReference getDataGraphRoot_Customers() - { - return (EReference)dataGraphRootEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getOrders <em>Orders</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Orders</em>'. - * @see org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getOrders() - * @see #getDataGraphRoot() - * @generated - */ - public EReference getDataGraphRoot_Orders() - { - return (EReference)dataGraphRootEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - public CustomerFactory getCustomerFactory() - { - return (CustomerFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() - { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - anOrderEClass = createEClass(AN_ORDER); - createEAttribute(anOrderEClass, AN_ORDER__ID); - createEAttribute(anOrderEClass, AN_ORDER__PRODUCT); - createEAttribute(anOrderEClass, AN_ORDER__QUANTITY); - createEAttribute(anOrderEClass, AN_ORDER__CUSTOMER_ID); - - customerEClass = createEClass(CUSTOMER); - createEAttribute(customerEClass, CUSTOMER__ID); - createEAttribute(customerEClass, CUSTOMER__LAST_NAME); - createEAttribute(customerEClass, CUSTOMER__ADDRESS); - createEReference(customerEClass, CUSTOMER__ORDERS); - - dataGraphRootEClass = createEClass(DATA_GRAPH_ROOT); - createEReference(dataGraphRootEClass, DATA_GRAPH_ROOT__CUSTOMERS); - createEReference(dataGraphRootEClass, DATA_GRAPH_ROOT__ORDERS); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() - { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); - - // Add supertypes to classes - - // Initialize classes and features; add operations and parameters - initEClass(anOrderEClass, AnOrder.class, "AnOrder", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getAnOrder_ID(), theXMLTypePackage.getInt(), "iD", null, 1, 1, AnOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getAnOrder_Product(), theXMLTypePackage.getString(), "product", null, 1, 1, AnOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getAnOrder_Quantity(), theXMLTypePackage.getInt(), "quantity", null, 1, 1, AnOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getAnOrder_CustomerID(), theXMLTypePackage.getInt(), "customerID", null, 1, 1, AnOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(customerEClass, Customer.class, "Customer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getCustomer_ID(), theXMLTypePackage.getInt(), "iD", null, 1, 1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getCustomer_LastName(), theXMLTypePackage.getString(), "lastName", null, 1, 1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getCustomer_Address(), theXMLTypePackage.getString(), "address", null, 1, 1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getCustomer_Orders(), this.getAnOrder(), null, "orders", null, 1, -1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(dataGraphRootEClass, DataGraphRoot.class, "DataGraphRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getDataGraphRoot_Customers(), this.getCustomer(), null, "customers", null, 0, -1, DataGraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getDataGraphRoot_Orders(), this.getAnOrder(), null, "orders", null, 0, -1, DataGraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http:///org/eclipse/emf/ecore/util/ExtendedMetaData - createExtendedMetaDataAnnotations(); - } - - /** - * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createExtendedMetaDataAnnotations() - { - String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; - addAnnotation - (anOrderEClass, - source, - new String[] - { - "name", "AnOrder", - "kind", "elementOnly" - }); - addAnnotation - (getAnOrder_ID(), - source, - new String[] - { - "kind", "element", - "name", "ID" - }); - addAnnotation - (getAnOrder_Product(), - source, - new String[] - { - "kind", "element", - "name", "Product" - }); - addAnnotation - (getAnOrder_Quantity(), - source, - new String[] - { - "kind", "element", - "name", "Quantity" - }); - addAnnotation - (getAnOrder_CustomerID(), - source, - new String[] - { - "kind", "element", - "name", "Customer_ID" - }); - addAnnotation - (customerEClass, - source, - new String[] - { - "name", "Customer", - "kind", "elementOnly" - }); - addAnnotation - (getCustomer_ID(), - source, - new String[] - { - "kind", "element", - "name", "ID" - }); - addAnnotation - (getCustomer_LastName(), - source, - new String[] - { - "kind", "element", - "name", "lastName" - }); - addAnnotation - (getCustomer_Address(), - source, - new String[] - { - "kind", "element", - "name", "address" - }); - addAnnotation - (getCustomer_Orders(), - source, - new String[] - { - "kind", "element", - "name", "orders" - }); - addAnnotation - (dataGraphRootEClass, - source, - new String[] - { - "name", "DataGraphRoot", - "kind", "elementOnly" - }); - addAnnotation - (getDataGraphRoot_Customers(), - source, - new String[] - { - "kind", "element", - "name", "customers" - }); - addAnnotation - (getDataGraphRoot_Orders(), - source, - new String[] - { - "kind", "element", - "name", "orders" - }); - } - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - public interface Literals - { - /** - * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl <em>An Order</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl - * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getAnOrder() - * @generated - */ - public static final EClass AN_ORDER = eINSTANCE.getAnOrder(); - - /** - * The meta object literal for the '<em><b>ID</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute AN_ORDER__ID = eINSTANCE.getAnOrder_ID(); - - /** - * The meta object literal for the '<em><b>Product</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute AN_ORDER__PRODUCT = eINSTANCE.getAnOrder_Product(); - - /** - * The meta object literal for the '<em><b>Quantity</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute AN_ORDER__QUANTITY = eINSTANCE.getAnOrder_Quantity(); - - /** - * The meta object literal for the '<em><b>Customer ID</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute AN_ORDER__CUSTOMER_ID = eINSTANCE.getAnOrder_CustomerID(); - - /** - * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl <em>Customer</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl - * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getCustomer() - * @generated - */ - public static final EClass CUSTOMER = eINSTANCE.getCustomer(); - - /** - * The meta object literal for the '<em><b>ID</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute CUSTOMER__ID = eINSTANCE.getCustomer_ID(); - - /** - * The meta object literal for the '<em><b>Last Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute CUSTOMER__LAST_NAME = eINSTANCE.getCustomer_LastName(); - - /** - * The meta object literal for the '<em><b>Address</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EAttribute CUSTOMER__ADDRESS = eINSTANCE.getCustomer_Address(); - - /** - * The meta object literal for the '<em><b>Orders</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference CUSTOMER__ORDERS = eINSTANCE.getCustomer_Orders(); - - /** - * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl <em>Data Graph Root</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl - * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getDataGraphRoot() - * @generated - */ - public static final EClass DATA_GRAPH_ROOT = eINSTANCE.getDataGraphRoot(); - - /** - * The meta object literal for the '<em><b>Customers</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference DATA_GRAPH_ROOT__CUSTOMERS = eINSTANCE.getDataGraphRoot_Customers(); - - /** - * The meta object literal for the '<em><b>Orders</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final EReference DATA_GRAPH_ROOT__ORDERS = eINSTANCE.getDataGraphRoot_Orders(); - - } - -} //CustomerPackageImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/DataGraphRootImpl.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/DataGraphRootImpl.java deleted file mode 100644 index 30fc8181a2..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/DataGraphRootImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.customer.impl; - -import java.util.Collection; -import java.util.List; - -import org.apache.tuscany.das.rdb.test.customer.AnOrder; -import org.apache.tuscany.das.rdb.test.customer.Customer; -import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; - -import org.apache.tuscany.sdo.impl.DataObjectImpl; - -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Data Graph Root</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl#getCustomers <em>Customers</em>}</li> - * <li>{@link org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl#getOrders <em>Orders</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class DataGraphRootImpl extends DataObjectImpl implements DataGraphRoot -{ - /** - * The cached value of the '{@link #getCustomers() <em>Customers</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomers() - * @generated - * @ordered - */ - protected EList customers = null; - - /** - * The cached value of the '{@link #getOrders() <em>Orders</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOrders() - * @generated - * @ordered - */ - protected EList orders = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected DataGraphRootImpl() - { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() - { - return CustomerPackageImpl.Literals.DATA_GRAPH_ROOT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getCustomers() - { - if (customers == null) - { - customers = new EObjectContainmentEList(Customer.class, this, CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS); - } - return customers; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List getOrders() - { - if (orders == null) - { - orders = new EObjectContainmentEList(AnOrder.class, this, CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS); - } - return orders; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) - { - switch (featureID) - { - case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: - return ((InternalEList)getCustomers()).basicRemove(otherEnd, msgs); - case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: - return ((InternalEList)getOrders()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: - return getCustomers(); - case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: - return getOrders(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: - getCustomers().clear(); - getCustomers().addAll((Collection)newValue); - return; - case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: - getOrders().clear(); - getOrders().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) - { - switch (featureID) - { - case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: - getCustomers().clear(); - return; - case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: - getOrders().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: - return customers != null && !customers.isEmpty(); - case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: - return orders != null && !orders.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //DataGraphRootImpl diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java deleted file mode 100644 index e696c8dd6b..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; -import java.sql.Types; - -import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; - - -public class BookData extends TestDataWithExplicitColumns { - - //CREATE TABLE BOOK (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), AUTHOR VARCHAR(30), QUANTITY INT, OCC INTEGER) - - private static int[] bookTypes = {Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER}; - - private static Object[][] bookData = { - { new Integer(1), "The Brothers Karamazov", "Fyodor Dostoevsky", new Integer(5), new Integer(17) }, - { new Integer(2), "Cat in the Hat", "Doctor Seuss", new Integer(10), new Integer(1) }}; - - private static String[] bookColumns = { "BOOK_ID", "NAME", "AUTHOR", "QUANTITY", "OCC"}; - - public BookData(Connection connection) { - super(connection, bookData, bookColumns, bookTypes); - } - - public String getTableName() { - return "BOOK"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java deleted file mode 100644 index 0ebbd6c5af..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.test.framework.TestData; - - -public class CityData extends TestData { - - private static Object[][] cityData = { - {new Integer(1), "Lizard Lick", "1"}, - {new Integer(2), "Morrisville", "1"}, - {new Integer(3), "Breckenridge", "2"}, - {new Integer(4), "Barstow", "3"}, - {new Integer(5), "Sacramento", "3"} - - }; - - public CityData(Connection c) { - super(c, cityData); - } - - public String getTableName() { - return "CITIES"; - } - - public void doDeletes() throws SQLException { - deleteRowsFromTable(); - - } - - public void doInserts() throws SQLException { - insertRows(); - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java deleted file mode 100644 index 9c49004ba5..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; -import java.sql.Types; - -import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; - - -public class CompanyData extends TestDataWithExplicitColumns { - - //CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ,NAME VARCHAR(30)) - - private static int[] columnTypes = {Types.VARCHAR}; - - private static Object[][] companyData = { { "ACME Publishing" }, - { "Do-rite plumbing" }, - { "MegaCorp" } }; - - private static String[] companyColumns = { "NAME" }; - - public CompanyData(Connection connection) { - super(connection, companyData, companyColumns, columnTypes); - } - - public String getTableName() { - return "COMPANY"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java deleted file mode 100644 index 66d0c25369..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; - -import org.apache.tuscany.das.rdb.test.framework.RelationshipData; - - -public class CompanyDeptData extends RelationshipData { - - public static Object[][] data = { - {"MegaCorp", "Advanced Technologies"} - }; - - public CompanyDeptData(Connection c) { - super(c, data); - } - - protected String getParentRetrievalStatement() { - return "select id from company where name = ?"; - } - - protected String getChildUpdateStatement() { - return "update department set companyid = ? where department.name = ?"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java deleted file mode 100644 index 300bf57260..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java +++ /dev/null @@ -1,44 +0,0 @@ - -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; - -import org.apache.tuscany.das.rdb.test.framework.RelationshipData; - - -public class CompanyEmpData extends RelationshipData { - - public static Object[][] data = { - {"Mary Smith", "ACME Publishing" }, - {"Jane Doe", "Do-rite plumbing"}, - {"Al Smith", "MegaCorp"}}; - - public CompanyEmpData(Connection c) { - super(c, data); - } - - protected String getParentRetrievalStatement() { - return "select employee.id from employee where employee.name = ?"; - } - - protected String getChildUpdateStatement() { - return "update company set company.eotmid = ? where company.name = ?"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java deleted file mode 100644 index 149bcfc71b..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; - -import org.apache.tuscany.das.rdb.test.framework.TestData; - - -public class CustomerData extends TestData { - - private static Object[][] customerData = { - {new Integer(1), "Williams", "1212 foobar lane"}, - {new Integer(2), "Daniel", "156 Brentfield Loop"}, - {new Integer(3), "Williams", "456 penny lane"}, - {new Integer(4), "Williams", "5000 pineville"}, - {new Integer(5), "Williams", "100000 firefly lane"} - }; - - public CustomerData(Connection connection) { - super(connection, customerData); - } - - - public String getTableName() { - return "CUSTOMER"; - } - - - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java deleted file mode 100644 index fbd9cf7cab..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; - -import org.apache.tuscany.das.rdb.test.framework.RelationshipData; - - -public class DepEmpData extends RelationshipData { - - private static Object[][] data = { - {"Advanced Technologies", "John Jones"}, - {"Advanced Technologies", "Jane Doe"}, - {"Advanced Technologies", "Al Smith"} - }; - - - public DepEmpData(Connection c) { - super(c, data); - } - - protected String getParentRetrievalStatement() { - return "select department.id from department where department.name = ?"; - } - - protected String getChildUpdateStatement() { - return "update employee set employee.departmentid = ? where employee.name = ?"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java deleted file mode 100644 index d3c10affdd..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; -import java.sql.Types; - -import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; - - -public class DepartmentData extends TestDataWithExplicitColumns { - - private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}; - - private static Object[][] deptData = { { "Advanced Technologies", "NY", "123" } }; - - private static String[] deptColumns = { "NAME", "LOCATION", "NUMBER" }; - - public DepartmentData(Connection connection) { - super(connection, deptData, deptColumns, columnTypes); - } - - public String getTableName() { - return "DEPARTMENT"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java deleted file mode 100644 index f9dffc9360..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; -import java.sql.Types; - -import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; - - -public class EmployeeData extends TestDataWithExplicitColumns { - - private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.SMALLINT}; - - private static Object[][] employeeData = { - { "John Jones", "E0001", new Boolean(false) }, - { "Mary Smith", "E0002", new Boolean(true)}, - { "Jane Doe", "E0003", new Boolean(false)}, - { "Al Smith", "E0004", new Boolean(true) } }; - - private static String[] employeeColumns = { "NAME", "SN", "MANAGER" }; - - public EmployeeData(Connection connection) { - super(connection, employeeData, employeeColumns, columnTypes); - } - - public String getTableName() { - return "EMPLOYEE"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java deleted file mode 100644 index e6a52204f8..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; - -import org.apache.tuscany.das.rdb.test.framework.TestData; - - -public class OrderData extends TestData { - - - public static Object[][] orderData = { - {new Integer(1), "recombobulator", new Integer(47), new Integer(1)}, - {new Integer(2), "wrench", new Integer(17), new Integer(3)}, - {new Integer(3), "pliers", new Integer(500), new Integer(1)}, - {new Integer(4), "Tooth Paste", new Integer(12), new Integer(2)} - }; - - public OrderData(Connection c) { - super(c, orderData); - } - - public String getTableName() { - return "ANORDER"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java deleted file mode 100644 index 9193f7c6d5..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; - -import org.apache.tuscany.das.rdb.test.framework.TestData; - - -public class OrderDetailsData extends TestData { - - //CREATE TABLE ORDERDETAILS (ORDERID INT NOT NULL, PRODUCTID INT NOT NULL, PRICE FLOAT, PRIMARY KEY (ORDERID, PRODUCTID)) - - public static Object[][] orderDetailsData = { - {new Integer(1), new Integer(1), new Float(1.1)}, - {new Integer(1), new Integer(2), new Float(1.2)}, - {new Integer(2), new Integer(1), new Float(2.1)}, - {new Integer(2), new Integer(2), new Float(2.2)} - }; - - public OrderDetailsData(Connection c) { - super(c, orderDetailsData); - } - - public String getTableName() { - return "ORDERDETAILS"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java deleted file mode 100644 index dd78b1be35..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; -import java.sql.Types; - -import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; - - -public class PartData extends TestDataWithExplicitColumns { - - - //CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT ) - - private static String[] partColumns = { "ID" , "NAME", "QUANTITY", "PARENT_ID"}; - - private static int[] columnTypes = {Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER}; - - private static Object[][] partData = { - {new Integer(1), "Engine", new Integer(1), null}, - {new Integer(2), "Block", new Integer(1), new Integer(1)}, - {new Integer(3), "Cam Shaft", new Integer(2), new Integer(1)}, - {new Integer(4), "Piston", new Integer(8), new Integer(1)}, - {new Integer(5), "Piston Ring", new Integer(2), new Integer(4)} - }; - - public PartData(Connection connection) { - super(connection, partData, partColumns, columnTypes); - } - - public String getTableName() { - return "PART"; - } - -} - - diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java deleted file mode 100644 index 0c6d41d096..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.test.framework.TestData; - - -public class StateData extends TestData { - - public StateData(Connection c) { - super(c, stateData); - } - - public String getTableName() { - return "STATES"; - } - - private static Object[][] stateData = { - {new Integer(1), "NC"}, - {new Integer(2), "CO"}, - {new Integer(3), "CA"} - }; - - public void doDeletes() throws SQLException { - deleteRowsFromTable(); - } - - public void doInserts() throws SQLException { - insertRows(); - - } - - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java deleted file mode 100644 index 1097b07cc5..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.data; - -import java.sql.Connection; -import java.sql.Timestamp; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.tuscany.das.rdb.test.framework.TestData; - - -public class TypesData extends TestData { - - private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:ss:mm.SSS"); - private static Timestamp timestamp = getTimestamp(); - - private static Object[][] customerData = { - {new Integer(1), timestamp, new Float(1234567.89), new Float(1234567.89)} - }; - - public TypesData(Connection connection) { - super(connection, customerData); - } - - public String getTableName() { - return "TYPETEST"; - } - - - //Utilities - private static Date getDate() { - - try { - return dateFormat.parse("1966-12-20 00:00:00.0"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - - } - - public static Timestamp getTimestamp() { - - return new Timestamp(getDate().getTime()); - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java deleted file mode 100644 index 75df028490..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import junit.framework.Test; - -public class DB2Setup extends DatabaseSetup { - - public DB2Setup(Test test) { - super(test); - } - - protected void initConnectionProtocol() { - - platformName = "DB2"; - driverName = "com.ibm.db2.jcc.DB2Driver"; - databaseURL = "jdbc:db2:DASTEST"; - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java deleted file mode 100644 index c4e75d20a8..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import commonj.sdo.DataObject; -import commonj.sdo.Property; - -/** - * - */ -public class DasTest extends TestCase { - - public static Connection connection = null; - private boolean usingDefaultSetup = false; - - /** - * Tears down the fixture, for example, close a network connection. This - * method is called after a test is executed. - */ - protected void tearDown() throws Exception { -// if (usingDefaultSetup) -// connection = null; - } - - protected Connection getAutoConnection() throws SQLException { - - Connection c = primGetConnection(); - c.setAutoCommit(true); - return connection; - - } - - protected Connection getConnection() throws SQLException { - - Connection c = primGetConnection(); - c.setAutoCommit(false); - return connection; - } - - /** - * This provides the default connection for runing single test cases on a - * chosen platform. - */ - private Connection primGetConnection() { - if (connection == null) - defaultSetup(); - return connection; - } - - - - /** - * This is a bit of a hack since it counts on constructor initialization of the - * DatabaseSet up class and also calls its setUp method directly. This is a misuse - * of this JUnit TestSetup subclass . - * - * TODO - refactor to avoid this hackiness ... could move this logic to its own - * class that is then invoked by DatabaseSetUp - */ - private void defaultSetup() { - - usingDefaultSetup = true; - -// DatabaseSetup setUp = new DB2Setup(this); - DatabaseSetup setUp = new DerbySetup(this); - try { - setUp.setUp(); - } catch (Exception e) { - throw new RuntimeException(e); - } - - } - - - //Utilities - protected InputStream getConfig(String fileName) throws FileNotFoundException { - return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); - } - - protected void write(String label, ResultSet rs) throws IOException, SQLException { - - ResultSetMetaData md = rs.getMetaData(); - int count = md.getColumnCount(); - System.out.println("Contents of ResultSet from " + label); - for (int i = 1; i <= count; i++) { - System.out.print("\t"); - System.out.println (md.getColumnLabel(i)); - } - System.out.println(""); - while (rs.next()) { - for (int i = 1; i <= count; i++) { - System.out.print("\t"); - System.out.print(rs.getString(i)); - } - System.out.println("\t"); - } - System.out.println("done"); - } - - - protected void printList(List data) { - Iterator i = data.iterator(); - while ( i.hasNext()) { - System.out.println(); - DataObject obj = (DataObject) i.next(); - Iterator props = obj.getType().getProperties().iterator(); - while ( props.hasNext()) { - Property p = (Property) props.next(); - if ( p.isMany() ) { - System.out.print("[ " + p.getName() + " ] "); - Iterator children = obj.getList(p).iterator(); - while ( children.hasNext()) { - DataObject child = (DataObject) children.next(); - System.out.print("[ " + child.get("ID") + " ]"); - } - System.out.println(); - } else if ( !p.getType().isDataType()) { - DataObject child = obj.getDataObject(p); - if ( child != null ) - System.out.println("[ " + p.getName() + " ] " + "[ " + child.get("ID") + " ]"); - } else { - System.out.println("[ " + p.getName() + " ] " + obj.get(p)); - } - } - } - } - - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java deleted file mode 100644 index f0c5223cf0..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java +++ /dev/null @@ -1,238 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.extensions.TestSetup; -import junit.framework.Test; - -public class DatabaseSetup extends TestSetup { - - protected String platformName = "Not initialized"; - - protected String driverName = "Not initialized"; - - protected String databaseURL = "Not initialized"; - - private Connection connection; - - protected Statement s; - - public DatabaseSetup(Test test) { - super(test); - initConnectionProtocol(); - initConnection(); - DasTest.connection = connection; - } - - protected void initConnectionProtocol() { - // Subclasses provide implementation - } - - private void initConnection() { - - try { - - Class.forName(driverName).newInstance(); - connection = DriverManager.getConnection(databaseURL); - connection.setAutoCommit(false); - - } catch (Exception e) { - if (e instanceof SQLException) - ((SQLException) e).getNextException().printStackTrace(); - throw new RuntimeException(e); - } - - } - - protected void setUp() throws Exception { - - System.out.println("Setting up for " + platformName + " run"); - - s = connection.createStatement(); - - try { - dropTables(); - dropProcedures(); - createTables(); - createProcedures(); - connection.commit(); - } catch (SQLException e) { - connection.rollback(); - } - - } - - protected void tearDown() throws Exception { - - System.out.println("Ending " + platformName + " run"); - connection.close(); - - } - - private void dropTables() { - -// System.out.println("Dropping tables"); - - String[] statements = { - - "DROP TABLE CUSTOMER", "DROP TABLE ANORDER", "DROP TABLE ORDERDETAILS", "DROP TABLE ITEM", - "DROP TABLE COMPANY", "DROP TABLE EMPLOYEE", "DROP TABLE DEPARTMENT", "DROP TABLE BOOK", - "DROP TABLE PART", "DROP TABLE TYPETEST", "DROP TABLE CITIES", "DROP TABLE STATES", - "DROP TABLE conmgt.SERVERSTATUS" - - }; - - for (int i = 0; i < statements.length; i++) { - try { - s.execute(statements[i]); - } catch (SQLException e) { - // If the table does not exist then ignore the exception on drop - if (!e.getMessage().contains("does not exist")) - throw new RuntimeException(e); - } - } - } - - protected void dropProcedures() { - -// System.out.println("Dropping procedures"); - - String[] statements = { - - "DROP PROCEDURE GETALLCOMPANIES", "DROP PROCEDURE DELETECUSTOMER", "DROP PROCEDURE GETNAMEDCOMPANY", - "DROP PROCEDURE GETCUSTOMERANDORDERS", "DROP PROCEDURE GETNAMEDCUSTOMERS" - - }; - - for (int i = 0; i < statements.length; i++) { - try { - s.execute(statements[i]); - } catch (SQLException e) { - // If the proc does not exist then ignore the exception on drop - if (!e.getMessage().contains("does not exist")) - throw new RuntimeException(e); - } - } - } - - private void createTables() { - -// System.out.println("Creating tables"); - - try { - - s.execute(getCreateCustomer()); - s.execute(getCreateAnOrder()); - s.execute(getCreateOrderDetails()); - s.execute(getCreateItem()); - s.execute(getCreateCompany()); - s.execute(getCreateEmployee()); - s.execute(getCreateDepartment()); - s.execute(getCreateBook()); - s.execute(getCreatePart()); - s.execute(getCreateTypeTest()); - s.execute(getCreateStates()); - s.execute(getCreateCities()); - s.execute(getCreateServerStatus()); - - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - protected void createProcedures() { - -// System.out.println("Creating procedures"); - try { - - s.execute("CREATE PROCEDURE GETALLCOMPANIES() PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getAllCompanies'"); - s.execute("CREATE PROCEDURE DELETECUSTOMER(theId int) PARAMETER STYLE JAVA LANGUAGE JAVA MODIFIES SQL DATA EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.deleteCustomer'"); - s.execute("CREATE PROCEDURE GETNAMEDCOMPANY(theName VARCHAR(100)) PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getNamedCompany'"); - s.execute("CREATE PROCEDURE GETCUSTOMERANDORDERS(theID INTEGER) PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getCustomerAndOrders'"); - s.execute("CREATE PROCEDURE GETNAMEDCUSTOMERS(theName VARCHAR(100), OUT theCount INTEGER) PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getNamedCustomers'"); - // TODO - "GETNAMEDCUSTOMERS" is failing on DB2 with SQLCODE: 42723. Need to investigate - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - // - // This section povides methods that return strings for table creation. - // Platform-specific sublcasses - // can override these as necessary - // - - protected String getCreateCustomer() { - return "CREATE TABLE CUSTOMER (ID INT PRIMARY KEY NOT NULL, LASTNAME VARCHAR(30) DEFAULT 'Garfugengheist', ADDRESS VARCHAR(30))"; - } - - protected String getCreateAnOrder() { - return "CREATE TABLE ANORDER (ID INT PRIMARY KEY NOT NULL, PRODUCT VARCHAR(30), QUANTITY INT, CUSTOMER_ID INT)"; - } - - protected String getCreateOrderDetails() { - return "CREATE TABLE ORDERDETAILS (ORDERID INT NOT NULL, PRODUCTID INT NOT NULL, PRICE FLOAT, PRIMARY KEY (ORDERID, PRODUCTID))"; - } - - protected String getCreateItem() { - return "CREATE TABLE ITEM (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(30))"; - } - - protected String getCreateCompany() { - return "CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ,NAME VARCHAR(30), EOTMID INT)"; - } - - protected String getCreateEmployee() { - return "CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME VARCHAR(30), SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)"; - } - - protected String getCreateDepartment() { - return "CREATE TABLE DEPARTMENT (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), COMPANYID INT)"; - } - - protected String getCreateBook() { - return "CREATE TABLE BOOK (BOOK_ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), AUTHOR VARCHAR(30), QUANTITY INT, OCC INTEGER)"; - } - - protected String getCreatePart() { - return "CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT )"; - } - - protected String getCreateTypeTest() { - return "CREATE TABLE TYPETEST (ID INT PRIMARY KEY NOT NULL, ATIMESTAMP TIMESTAMP, ADECIMAL DECIMAL(9,2), AFLOAT FLOAT)"; - } - - protected String getCreateStates() { - return "CREATE TABLE STATES (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(2))"; - } - - protected String getCreateCities() { - return "CREATE TABLE CITIES (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), STATE_ID INT, CONSTRAINT FK1 FOREIGN KEY (STATE_ID) REFERENCES STATES (ID) ON DELETE NO ACTION ON UPDATE NO ACTION)"; - } - - protected String getCreateServerStatus() { - - return "CREATE TABLE CONMGT.SERVERSTATUS (STATUSID INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1 ,INCREMENT BY 1), MANAGEDSERVERID INTEGER NOT NULL, TIMESTAMP TIMESTAMP NOT NULL)"; - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java deleted file mode 100644 index 082b1ec50a..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.util.Properties; - -import junit.framework.Test; - -public class DerbySetup extends DatabaseSetup { - - public DerbySetup(Test test) { - super(test); - } - - protected void initConnectionProtocol() { - - //Set the derby property to explicitly specify the database location relative - //from current directory to "target" - Properties p = System.getProperties(); - p.put("derby.system.home", "target"); - - platformName = "Derby"; - driverName = "org.apache.derby.jdbc.EmbeddedDriver"; - databaseURL = "jdbc:derby:dastest; create = true"; - - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java deleted file mode 100644 index cd314e0fce..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -/** - * Stored Procedures for DB2 and Derby SP tests - * - */ -public class JavaStoredProcs { - - public static void getAllCompanies(ResultSet[] results) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn.prepareStatement("SELECT * FROM COMPANY"); - results[0] = ps.executeQuery(); - } - - public static void deleteCustomer(int theId) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn.prepareStatement("DELETE FROM CUSTOMER WHERE ID = ?"); - ps.setInt(1, theId); - ps.execute(); - - } - - public static void getNamedCompany(String theName, ResultSet[] results) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn.prepareStatement("SELECT * FROM COMPANY WHERE NAME = ?"); - ps.setString(1, theName); - results[0] = ps.executeQuery(); - } - - public static void getCustomerAndOrders(int theId, ResultSet[] results) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn - .prepareStatement("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = ?"); - ps.setInt(1, theId); - results[0] = ps.executeQuery(); - } - - public static void getNamedCustomers(String theName, int[] outCount, ResultSet[] results) throws SQLException { - - Connection conn = DriverManager.getConnection("jdbc:default:connection"); - PreparedStatement ps = conn.prepareStatement("SELECT * FROM CUSTOMER WHERE LASTNAME = ?"); - ps.setString(1, theName); - results[0] = ps.executeQuery(); - - ps = conn.prepareStatement("SELECT COUNT(*) FROM CUSTOMER WHERE LASTNAME = ?"); - ps.setString(1, theName); - - ResultSet rs = ps.executeQuery(); - rs.next(); - outCount[0] = rs.getInt(1); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java deleted file mode 100644 index b3616882f4..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.SQLException; - - -import junit.framework.Test; - -public class MySQLSetup extends DatabaseSetup { - - public MySQLSetup(Test test) { - super(test); - } - - protected void initConnectionProtocol() { - - platformName = "MySQL"; - driverName = "com.mysql.jdbc.Driver"; - databaseURL = "jdbc:mysql:///dastest?user=dastester&password=dastester"; - - } - - - protected void createProcedures () { - - String createGetAllCompanies = - "CREATE PROCEDURE `dastest`.`GETALLCOMPANIES` () "+ - " SELECT * FROM COMPANY "; - - - String createDeleteCustomer = - "CREATE PROCEDURE `dastest`.`DELETECUSTOMER` (theId INT) " + - " DELETE FROM CUSTOMER WHERE ID = theId "; - - - String createGetNamedCustomers = - "CREATE PROCEDURE `dastest`.`GETNAMEDCUSTOMERS`(IN thename VARCHAR(30), OUT theCount INTEGER ) " + - " BEGIN " + - " SELECT * FROM CUSTOMER AS CUSTOMER WHERE LASTNAME = theName; " + - " SET theCount = (SELECT COUNT(*) FROM CUSTOMER WHERE LASTNAME = theName); " + - " END "; - - String createGetCustomerAndOrders = - " CREATE PROCEDURE `dastest`.`GETCUSTOMERANDORDERS` (theId INT) " + - " SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = theId "; - - - String createGetNamedCompany = - " CREATE PROCEDURE `dastest`.`GETNAMEDCOMPANY` (theName VARCHAR(100)) " + - " SELECT * FROM COMPANY WHERE NAME = theName"; - - System.out.println("Creating procedures"); - try { - - s.execute(createGetAllCompanies); - s.execute(createDeleteCustomer); - s.execute(createGetNamedCompany); - s.execute(createGetCustomerAndOrders); -// s.execute(createGetNamedCustomers); -//TODO - add this back after DB2 problem is resolved - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - - //Overrides for table creation - protected String getCreateCompany() { - return "CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30))"; - } - protected String getCreateEmployee() { - return "CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30), SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)"; - } - protected String getCreateDepartment() { - return "CREATE TABLE DEPARTMENT (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), COMPANYID INT, EOTM INT)"; - } - protected String getCreateTypeTest() { - return "CREATE TABLE TYPETEST (ID INT PRIMARY KEY NOT NULL, ATIMESTAMP DATETIME, ADECIMAL DECIMAL(9,2), AFLOAT FLOAT)"; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java deleted file mode 100644 index 330320656e..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -public abstract class RelationshipData { - protected Object[][] data; - private int currentRow = -1; - protected Connection connection; - - - public RelationshipData(Connection c, Object[][] inputData) { - this.connection = c; - this.data = inputData; - } - - public int size() { - return data[0].length; - } - - public int numberOfRows() { - return data.length; - } - - public boolean next() { - ++currentRow; - if ( currentRow < numberOfRows() ) - return true; - else - return false; - } - - - public void refresh() throws SQLException { - updateRelationships(); - } - - protected abstract String getParentRetrievalStatement(); - protected abstract String getChildUpdateStatement(); - - - protected void updateRelationships() throws SQLException { - // { MegaCorp, Advanced Technologies } - // select company.id from company where company.name = ? - PreparedStatement retrieveParent = connection.prepareStatement(getParentRetrievalStatement()); - // update department set department.companyid = ? where department.name = ? - PreparedStatement updateChild = connection.prepareStatement(getChildUpdateStatement()); - - while ( next() ) { - retrieveParent.setObject(1, data[currentRow][0]); - retrieveParent.execute(); - ResultSet rs = retrieveParent.getResultSet(); - rs.next(); - Object parentID = rs.getObject(1); - retrieveParent.clearParameters(); - - updateChild.setObject(1, parentID); - updateChild.setObject(2, data[currentRow][1]); - updateChild.execute(); - updateChild.clearParameters(); - } - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java deleted file mode 100644 index 686433bfc8..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -public abstract class TestData { - - protected Object[][] data; - private int currentRow = -1; - protected Connection connection; - - - public TestData(Connection c, Object[][] customerData) { - this.connection = c; - this.data = customerData; - } - - public int size() { - return data[0].length; - } - - public int numberOfRows() { - return data.length; - } - - public boolean next() { - ++currentRow; - if ( currentRow < numberOfRows() ) - return true; - else - return false; - } - - public abstract String getTableName(); - - - public Object getObject(int i) { - return data[currentRow][i-1]; - } - - public void refresh() throws SQLException { - deleteRowsFromTable(); - insertRows(); - } - - protected void deleteRowsFromTable() throws SQLException { - PreparedStatement ps = connection.prepareStatement("delete from " + getTableName()); - ps.execute(); - } - - protected void insertRows() throws SQLException { - StringBuffer sql = new StringBuffer(); - sql.append("insert into "); - sql.append(getTableName()); - sql.append(" values ("); - for ( int i=1; i < size(); i++) { - sql.append("?,"); - } - sql.append("?)"); - PreparedStatement ps = connection.prepareStatement(sql.toString()); - - while ( next() ) { - for ( int i=1; i <= size(); i++ ) { - ps.setObject(i, getObject(i)); - } - ps.execute(); - ps.clearParameters(); - } - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java deleted file mode 100644 index 8ded99af9b..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.framework; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; - -import org.apache.tuscany.das.rdb.util.DebugUtil; - - -public abstract class TestDataWithExplicitColumns extends TestData { - - protected String[] columns; - protected int[] sqlTypes; - - private static boolean debug = false; - - public TestDataWithExplicitColumns(Connection c, Object[][] data, - String[] columns, int[] sqlTypes) { - super(c, data); - this.columns = columns; - this.sqlTypes = sqlTypes; - } - - private String getColumn(int i) { - return columns[i - 1]; - } - - private int getSqlType(int i) { - return (sqlTypes[i - 1]); - } - - // Create an insert statement of the following form ... - // "INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)" - // This is necessary for tables with a generated column since the PK value is not provided - protected void insertRows() throws SQLException { - StringBuffer sql = new StringBuffer(); - sql.append("insert into "); - sql.append(getTableName()); - - sql.append(" ("); - for (int i = 1; i <= size(); i++) { - sql.append(getColumn(i)); - if ( i < size() ) - sql.append(','); - } - sql.append(" )"); - - sql.append(" values ("); - for (int i = 1; i < size(); i++) { - sql.append("?,"); - } - sql.append("?)"); - - DebugUtil.debugln(getClass(), debug, sql.toString()); - PreparedStatement ps = connection.prepareStatement(sql.toString()); - - while (next()) { - for (int i = 1; i <= size(); i++) { - ps.setObject(i, getObject(i), getSqlType(i)); - } - ps.execute(); - ps.clearParameters(); - } - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java deleted file mode 100644 index e25d2c4c95..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.mappings; - -import org.apache.tuscany.das.rdb.Converter; - -public class IntegerToBooleanConverter implements Converter { - - public IntegerToBooleanConverter() { - super(); - } - - public Object getPropertyValue(Object columnData) { - Integer value = (Integer) columnData; - return value.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE; - } - - public Object getColumnValue(Object propertyData) { - Boolean value = (Boolean) propertyData; - if ( value.booleanValue()) - return new Integer(1); - else - return new Integer(0); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java deleted file mode 100644 index 7c164bd675..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.mappings; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.tuscany.das.rdb.Converter; - - -public class SillyDateStringConverter implements Converter { - - public SillyDateStringConverter() { - super(); - } - - private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); - - private static Date kbday; - - private static Date tbday; - - static { - try { - kbday = myformat.parse("1957.09.27"); - tbday = myformat.parse("1966.12.20"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - public Object getPropertyValue(Object columnData) { - - if (columnData.equals("Williams")) - return kbday; - - if (columnData.equals("Pavick")) - return tbday; - - throw new IllegalArgumentException(); - - } - - public Object getColumnValue(Object propertyData) { - - if (propertyData.equals(kbday)) - return "Williams"; - - if (propertyData.equals(tbday)) - return "Pavick"; - - throw new IllegalArgumentException(); - - } - - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java deleted file mode 100644 index 8ff57aef6d..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.mappings; - -import org.apache.tuscany.das.rdb.Converter; - -public class StringToIntegerConverter implements Converter { - - public StringToIntegerConverter() { - super(); - } - - public Object getPropertyValue(Object columnData) { - // System.out.println("Converting object.. " + columnData); - - return new Integer(columnData.toString()); - } - - public Object getColumnValue(Object columnData) { - return columnData.toString(); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java deleted file mode 100644 index 74a5e2917f..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.mappings; - -import org.apache.tuscany.das.rdb.Converter; - -public class StringToLongConverter implements Converter { - - public StringToLongConverter() { - super(); - } - - public Object getPropertyValue(Object columnData) { - return new Long(columnData.toString()); - } - - public Object getColumnValue(Object columnData) { - return columnData.toString(); - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java deleted file mode 100644 index 53941ad489..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.suites; - -import org.apache.tuscany.das.rdb.test.BestPracticeTests; -import org.apache.tuscany.das.rdb.test.CUDGeneration; -import org.apache.tuscany.das.rdb.test.CompanyTests; -import org.apache.tuscany.das.rdb.test.CompoundKeyTests; -import org.apache.tuscany.das.rdb.test.ConverterTests; -import org.apache.tuscany.das.rdb.test.CorrectedDefectTests; -import org.apache.tuscany.das.rdb.test.CrudWithChangeHistory; -import org.apache.tuscany.das.rdb.test.ExceptionTests; -import org.apache.tuscany.das.rdb.test.GeneratedCommandTests; -import org.apache.tuscany.das.rdb.test.GeneratedId; -import org.apache.tuscany.das.rdb.test.GraphMergeTests; -import org.apache.tuscany.das.rdb.test.NameMappingTests; -import org.apache.tuscany.das.rdb.test.OCCTests; -import org.apache.tuscany.das.rdb.test.OneToOneRelationshipTests; -import org.apache.tuscany.das.rdb.test.OperationOrderingTests; -import org.apache.tuscany.das.rdb.test.Paging; -import org.apache.tuscany.das.rdb.test.PartialUpdateTests; -import org.apache.tuscany.das.rdb.test.PassiveConnectionTests; -import org.apache.tuscany.das.rdb.test.ProgrammaticConfigTests; -import org.apache.tuscany.das.rdb.test.RecursiveTests; -import org.apache.tuscany.das.rdb.test.RelationshipTests; -import org.apache.tuscany.das.rdb.test.ResultSetShapeTests; -import org.apache.tuscany.das.rdb.test.SerializationTests; -import org.apache.tuscany.das.rdb.test.SimplestCrud; -import org.apache.tuscany.das.rdb.test.StoredProcs; -import org.apache.tuscany.das.rdb.test.TopDown; -import org.apache.tuscany.das.rdb.test.TypeTests; -import org.apache.tuscany.das.rdb.test.CommandGroupTests; -import org.apache.tuscany.das.rdb.test.typed.SimplestStaticCrud; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllCommonTests { - - public static Test suite() { - TestSuite suite = new TestSuite("All platform-common DAS tests"); - //$JUnit-BEGIN$ - - suite.addTest(new TestSuite (SimplestCrud.class)); - suite.addTest(new TestSuite (CrudWithChangeHistory.class)); - suite.addTest(new TestSuite (SimplestStaticCrud.class)); - suite.addTest(new TestSuite (Paging.class)); - suite.addTest(new TestSuite (GeneratedId.class)); - - suite.addTest(new TestSuite (StoredProcs.class)); - suite.addTest(new TestSuite (CUDGeneration.class)); - suite.addTest(new TestSuite (TopDown.class)); - suite.addTest(new TestSuite (OCCTests.class)); - suite.addTest(new TestSuite (RecursiveTests.class)); - - suite.addTest(new TestSuite (GraphMergeTests.class)); - suite.addTest(new TestSuite (CompoundKeyTests.class)); - suite.addTest(new TestSuite (RelationshipTests.class)); - suite.addTest(new TestSuite (NameMappingTests.class)); - suite.addTest(new TestSuite (GeneratedCommandTests.class)); - - suite.addTest(new TestSuite (CompanyTests.class)); - suite.addTest(new TestSuite (ResultSetShapeTests.class)); - suite.addTest(new TestSuite (TypeTests.class)); - suite.addTest(new TestSuite (OperationOrderingTests.class)); - suite.addTest(new TestSuite (ConverterTests.class)); - - suite.addTest(new TestSuite (PartialUpdateTests.class)); - suite.addTest(new TestSuite (ExceptionTests.class)); - suite.addTest(new TestSuite (PassiveConnectionTests.class)); - suite.addTest(new TestSuite (SerializationTests.class)); - - suite.addTest(new TestSuite (CommandGroupTests.class)); - suite.addTest(new TestSuite (BestPracticeTests.class)); - suite.addTest(new TestSuite (CorrectedDefectTests.class)); - suite.addTest(new TestSuite (OneToOneRelationshipTests.class)); - - suite.addTest(new TestSuite (ProgrammaticConfigTests.class)); - - //$JUnit-END$ - return suite; - } - -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java deleted file mode 100644 index a5fcb5eba0..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.suites; - -import org.apache.tuscany.das.rdb.test.ReadDBSchemaTests; -import org.apache.tuscany.das.rdb.test.framework.DB2Setup; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTestsDB2 { - - - public static Test suite() { - - TestSuite suite = new TestSuite(); - suite.addTest(AllCommonTests.suite()); - suite.addTest(new TestSuite (ReadDBSchemaTests.class)); - - TestSuite suite2 = new TestSuite("All DAS tests on DB2"); - suite2.addTest(new DB2Setup(suite)); - return suite2; - - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java deleted file mode 100644 index 8af82f0114..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.suites; - -import org.apache.tuscany.das.rdb.test.framework.DerbySetup; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTestsDerby extends TestSuite { - - - public static Test suite() { - - TestSuite suite = new TestSuite("All DAS tests on Derby"); - suite.addTest(new DerbySetup(AllCommonTests.suite())); - return suite; - - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java deleted file mode 100644 index 2b862eba8c..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.suites; - -import org.apache.tuscany.das.rdb.test.framework.MySQLSetup; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class AllTestsMySQL { - - - public static Test suite() { - - TestSuite suite = new TestSuite("All DAS tests on MySQL"); - suite.addTest(new MySQLSetup(AllCommonTests.suite())); - return suite; - - } -} diff --git a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java b/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java deleted file mode 100644 index f8baca2cb8..0000000000 --- a/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.das.rdb.test.typed; - -import java.io.InputStream; -import java.util.Collection; - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; -import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; -import org.apache.tuscany.das.rdb.test.data.CustomerData; -import org.apache.tuscany.das.rdb.test.framework.DasTest; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.helper.TypeHelper; - - -/** - */ -public class SimplestStaticCrud extends DasTest { - - protected void setUp() throws Exception { - super.setUp(); - new CustomerData(getAutoConnection()).refresh(); - } - - public void testRead() throws Exception { - SDOUtil.registerStaticTypes(CustomerFactory.class); - InputStream mapping = getClass().getClassLoader().getResourceAsStream("basicStaticCustomer.xml"); - Command select = Command.FACTORY.createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where LASTNAME = :LASTNAME",mapping); - select.setConnection(getConnection()); - select.setParameterValue("LASTNAME", "Williams"); - TypeHelper helper = TypeHelper.INSTANCE; - - select.setDataObjectModel(helper.getType(DataGraphRoot.class)); - - DataGraphRoot root = (DataGraphRoot) select.executeQuery(); - - Collection customers = root.getCustomers(); - assertEquals(4, customers.size()); - } - - -} |