Package org.apache.tuscany.das.rdb

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


    public void testReadModifyApplyWithAssumedID() throws Exception {

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

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

        // Modify customer
View Full Code Here


    }

    public void testReadModifyApplyWithAssumedIDFailure() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command select = das.createCommand("Select * from ORDERDETAILS");

        DataObject root = select.executeQuery();

        DataObject od = root.getDataObject("ORDERDETAILS[1]");

View Full Code Here

    }

    public void testReadModifyApplyWithAssumedIDFailure2() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command select = das.createCommand("Select * from ORDERDETAILS");
        DataObject root = select.executeQuery();

        DataObject od = root.getDataObject("ORDERDETAILS[1]");
        od.delete();

View Full Code Here

    }

    public void testReadModifyApplyWithAssumedIDFailure3() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command select = das.createCommand("Select * from ORDERDETAILS");
        DataObject root = select.executeQuery();

        DataObject od = root.createDataObject("ORDERDETAILS");

        // Modify customer
View Full Code Here

        super.tearDown();
    }

    public void testInsert() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConfig("cityStates.xml"), getConnection());
        Command select = das.createCommand("Select * from STATES inner join CITIES on STATES.ID = CITIES.STATE_ID");
        DataObject root = select.executeQuery();

        int numberOfStates = root.getList("STATES").size();
        int numberOfCities = root.getList("CITIES").size();

View Full Code Here

        assertEquals(numberOfStates + 1, root.getList("STATES").size());
    }

    public void testDeletes() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConfig("cityStates.xml"), getConnection());
        Command select = das.createCommand("Select * from STATES inner join CITIES on STATES.ID = CITIES.STATE_ID");
        DataObject root = select.executeQuery();

        DataObject firstState = root.getDataObject("STATES[1]");
        String stateName = firstState.getString("NAME");

View Full Code Here

        super.tearDown();
    }

    public void testPartialUpdate() throws SQLException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");

        // Read
        DataObject root = readCustomers.executeQuery();

        DataObject customer = root.getDataObject("CUSTOMER[1]");
View Full Code Here

        DataObject customer = root.getDataObject("CUSTOMER[1]");
        // Verify
        assertEquals(1, customer.getInt("ID"));

        Command update = das.createCommand("update CUSTOMER set LASTNAME = 'modified' where ID = 1");
        update.execute();

        customer.setString("ADDRESS", "main street");

        das.applyChanges(root);
View Full Code Here

        assertEquals("main street", customer.getString("ADDRESS"));
    }

    public void testPartialInsert() throws SQLException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");

        // Read
        DataObject root = readCustomers.executeQuery();

        // Create a new customer
View Full Code Here

        // Purposely do not set lastname to let it default to 'Garfugengheist'
        // newCust.set("LASTNAME", "Gerkin" );

        das.applyChanges(root);

        Command readNewCust = das.createCommand("select * from CUSTOMER where ID = 100");
        root = readNewCust.executeQuery();

        // If partial insert was not used, LASTNAME would not be
        // 'Garfugengheist'
        newCust = root.getDataObject("CUSTOMER[1]");
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.