diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-02 22:26:08 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-02 22:26:08 +0000 |
commit | b848f8f7991c569dadfc339d80977b443383c084 (patch) | |
tree | 677367d699ef1bee083dc7ad7b5a1ac6390f9b2f /das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java | |
parent | b8bb66d4a6e9a0951776e847538607e9e9aa9668 (diff) |
Removing temporary release candidate tag
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@832155 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java')
-rw-r--r-- | das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java b/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java deleted file mode 100644 index 5e7bf3976f..0000000000 --- a/das-java/tags/1.0-incubating-beta2-rc1/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.rdb.test; - -/* - * This test - * - */ - -import org.apache.tuscany.das.rdb.Command; -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.das.rdb.config.Config; -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.das.rdb.util.ConfigUtil; - -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 { - - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - - Command read = das.getCommand("all customers"); - DataObject root = read.executeQuery(); - - assertEquals(5, root.getList("CUSTOMER").size()); - - } - - /** - * Read - */ - public void testReadUsingConfigInput() throws Exception { - Config config = ConfigUtil.loadConfig(getConfig("CustomersOrdersConfig.xml")); - DAS das = DAS.FACTORY.createDAS(config, getConnection()); - - Command read = das.getCommand("all customers"); - DataObject root = read.executeQuery(); - - assertEquals(5, root.getList("CUSTOMER").size()); - - } - - /** - * Read an order using parm marker - */ - public void testReadWithParmmarker() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - - Command read = das.getCommand("order by id"); - read.setParameter(1, new Integer(1)); - DataObject root = read.executeQuery(); - - assertEquals("recombobulator", root.getString("ANORDER[1]/PRODUCT")); - - } - - /** - * Specify connection properties in config. Add explicit update command - */ - public void testUpdate() throws Exception { - - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - - Command read = das.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 = das.getCommand("update customer"); - update.setParameter(1, 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 - DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection()); - - // Read all customers and remember the first one - Command read = das.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 = das.getCommand("customer and orders"); - custOrders.setParameter(1, 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"); - das.applyChanges(root); - - // Verify - Command orderByID = das.getCommand("order by id"); - orderByID.setParameter(1, orderId); - assertEquals("Defibrillator", root.getString("ANORDER[1]/PRODUCT")); - - } - -} |