Package org.apache.tuscany.das.rdb

Examples of org.apache.tuscany.das.rdb.DAS.createCommand()


    public void testMissingConnection() throws Exception {
        DAS das = DAS.FACTORY.createDAS((Connection) null);

        try {
            Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");
            readCustomers.executeQuery();
            fail("RuntimeException should be thrown");
        } catch (RuntimeException ex) {
            assertEquals("No connection has been provided and no data source has been specified", ex.getMessage());
        }
View Full Code Here


    }

    public void testUnregisteredTypes() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConfig("staticInvalid.xml"), getConnection());
        Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");

        try {
            readCustomers.executeQuery();

            fail("Exception should be thrown");
View Full Code Here

    }

    public void testMissingMapping() throws Exception {
        SDOUtil.registerStaticTypes(CustomerFactory.class);
        DAS das = DAS.FACTORY.createDAS(getConfig("staticCustomer.xml"), getConnection());
        Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");

        try {
            readCustomers.executeQuery();

            fail("Exception should be thrown");
View Full Code Here

    }

    public void testReadOrdersAndDetails2() throws Exception {

        DAS das = DAS.FACTORY.createDAS(getConfig("InvalidConfig1.xml"), getConnection());
        Command read = das.createCommand("SELECT * FROM ANORDER LEFT JOIN ORDERDETAILS "
                + "ON ANORDER.ID = ORDERDETAILS.ORDERID ORDER BY ANORDER.ID");

        try {
            read.executeQuery();
        } catch (Exception ex) {
View Full Code Here

    }

    public void testMismatchedDataObjectModel() throws SQLException {
        SDOUtil.registerStaticTypes(CompanyFactory.class);
        DAS das = DAS.FACTORY.createDAS(getConfig("companyMappingWithConverters.xml"), getConnection());
        Command read = das.createCommand("select * from company");
        try {
            read.executeQuery();
        } catch (RuntimeException ex) {
            assertEquals("Type CompanyType does not contain a property named ID", ex.getMessage());
        }
View Full Code Here

    }

    public void testDeleteAndCreate() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD2.xml"), getConnection());
        // Read customer 1
        Command select = das.createCommand("Select * from CUSTOMER");
        DataObject root = select.executeQuery();

        DataObject customer = (DataObject) root.get("CUSTOMER[1]");

        int customerId = customer.getInt("ID");
View Full Code Here

        helper.addUpdateStatement(customerTable, "update CUSTOMER set LASTNAME = ?, ADDRESS = ? "
                + "where ID = ?", "LASTNAME ADDRESS ID");

        DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
        // Read customer 1
        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();

        DataObject customer = (DataObject) root.get("CUSTOMER[1]");

        // Modify customer
View Full Code Here

     */
    public void testReadModifyApply1() throws Exception {

        DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMappingWithCUD.xml"), getConnection());
        // Read customer 1
        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();

        DataObject customer = (DataObject) root.get("CUSTOMER[1]");

        // Modify customer
View Full Code Here

     */
    public void testReadModifyApply2() throws Exception {

        DAS das = DAS.FACTORY.createDAS(getConnection());
        // Read customer with particular ID
        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();

        DataObject customer = root.getDataObject("CUSTOMER[1]");

        // Modify customer
View Full Code Here

     * Builds on previous but: 1. Key info provided via XML file
     */
    public void testReadModifyApply3() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConfig("basicCustomerMapping.xml"), getConnection());
        // Read customer with particular ID
        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();

        DataObject customer = (DataObject) root.get("CUSTOMER[1]");

        // Modify customer
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.