Package org.apache.tuscany.das.rdb

Examples of org.apache.tuscany.das.rdb.ConfigHelper


    /**
     * Simple unit test for DataObjectModel
     * @throws Exception
     */
    public void testDataObjectModel() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        helper.setDataObjectModel("org.apache.tuscany/mytypes");

        Config config = helper.getConfig();
        assertEquals("org.apache.tuscany/mytypes", config.getDataObjectModel());

    }
View Full Code Here


    /**
     * Simple unit test for adding a Delete statement to a Table
     * @throws Exception
     */
    public void testAddDeleteStatement() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        Table table = helper.addTable("widgets", "WIDGETS");
        helper.addDeleteStatement(table, "delete from widgets where id = ?", "ID");

        Config cfg = helper.getConfig();
        assertEquals(1, cfg.getTable().size());
        Table widgets = (Table) cfg.getTable().get(0);
        assertEquals("delete from widgets where id = ?", widgets.getDelete().getSql());
        assertEquals("WIDGETS", widgets.getTypeName());
        assertEquals("ID", widgets.getDelete().getParameters());
View Full Code Here

            assertEquals("Foreign key properties should not be set when the corresponding relationship has changed", ex.getMessage());
        }
    }
   
    public void testInvalidFKColumn() throws SQLException {
        ConfigHelper helper = new ConfigHelper();
        Relationship r = helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID_INVALID");
        r.setName("orders");
      

        DAS das = DAS.FACTORY.createDAS(helper.getConfig(), getConnection());
        Command select = das.createCommand("select * from CUSTOMER left join ANORDER "
                + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID");

        DataObject root = select.executeQuery()
        DataObject cust1 = root.getDataObject("CUSTOMER[1]")
View Full Code Here

    /**
     * Simple unit test for adding a Create statement to a Table
     * @throws Exception
     */
    public void testAddCreateStatement() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        Table table = helper.addTable("widgets", "WIDGETS");
        helper.addCreateStatement(table, "insert into widgets values (?,?)", "ID NAME");

        Config cfg = helper.getConfig();
        assertEquals(1, cfg.getTable().size());
        Table widgets = (Table) cfg.getTable().get(0);
        assertEquals("insert into widgets values (?,?)", widgets.getCreate().getSql());
        assertEquals("WIDGETS", widgets.getTypeName());
        assertEquals("ID NAME", widgets.getCreate().getParameters());
View Full Code Here

        assertEquals("ID NAME", widgets.getCreate().getParameters());

    }
   
    public void testAddInvalidPrimaryKey() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        try {
            helper.addPrimaryKey("PK");
        } catch (RuntimeException ex) {
            this.assertEquals ("Column PK must be qualified with a table name and optional schema name", ex.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.das.rdb.ConfigHelper

Copyright © 2018 www.massapicom. 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.