Package org.apache.tuscany.das.rdb.config

Examples of org.apache.tuscany.das.rdb.config.Config


     */
    public void testConnectionInfo() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        helper.addConnectionInfo("jdbc/adatasource");

        Config config = helper.getConfig();
        ConnectionInfo info = config.getConnectionInfo();
        assertEquals(info.getDataSource(), "jdbc/adatasource");
        assertEquals(info.isManagedtx(), true);
    }
View Full Code Here


     */
    public void testConnectionInfo2() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        helper.addConnectionInfo("jdbc/adatasource", false);

        Config config = helper.getConfig();
        ConnectionInfo info = config.getConnectionInfo();
        assertEquals(info.getDataSource(), "jdbc/adatasource");
        assertEquals(info.isManagedtx(), false);
    }
View Full Code Here

     */
    public void testConnectionInfoDriverManager() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        helper.addConnectionInfo("org.apache.derby.jdbc.EmbeddedDriver","jdbc:derby:target/dastest", "user", "password", 600);

        Config config = helper.getConfig();
        ConnectionInfo info = config.getConnectionInfo();
        assertNull(info.getDataSource());
        assertEquals(info.getConnectionProperties().getDriverClass(), "org.apache.derby.jdbc.EmbeddedDriver");
        assertEquals(info.getConnectionProperties().getDatabaseURL(), "jdbc:derby:target/dastest");
        assertEquals(info.getConnectionProperties().getUserName(), "user");
        assertEquals(info.getConnectionProperties().getPassword(), "password");
View Full Code Here

     */
    public void testAddSelectCommand() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        helper.addSelectCommand("get all customers", "select * from customers");

        Config config = helper.getConfig();
        List commands = config.getCommand();
        assertEquals(1, commands.size());
        org.apache.tuscany.das.rdb.config.Command cmd = (org.apache.tuscany.das.rdb.config.Command) commands.get(0);
        assertEquals("select", cmd.getKind());
        assertEquals("get all customers", cmd.getName());
        assertEquals("select * from customers", cmd.getSQL());
View Full Code Here

     */
    public void testAddUpdateCommand() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        helper.addUpdateCommand("update a customer", "update customers set name = ? where id = ?");

        Config config = helper.getConfig();
        List commands = config.getCommand();
        assertEquals(1, commands.size());
        org.apache.tuscany.das.rdb.config.Command cmd = (org.apache.tuscany.das.rdb.config.Command) commands.get(0);
        assertEquals("update", cmd.getKind());
        assertEquals("update a customer", cmd.getName());
        assertEquals("update customers set name = ? where id = ?", cmd.getSQL());
View Full Code Here

     */
    public void testAddInsertCommand() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        helper.addInsertCommand("insert customer", "insert into customers(ID,NAME) values (?,?)");

        Config config = helper.getConfig();
        List commands = config.getCommand();
        assertEquals(1, commands.size());
        org.apache.tuscany.das.rdb.config.Command cmd = (org.apache.tuscany.das.rdb.config.Command) commands.get(0);
        assertEquals("insert", cmd.getKind());
        assertEquals("insert customer", cmd.getName());
        assertEquals("insert into customers(ID,NAME) values (?,?)", cmd.getSQL());
View Full Code Here

     */
    public void testAddDeleteCommand() throws Exception {
        ConfigHelper helper = new ConfigHelper();
        helper.addDeleteCommand("delete customer", "delete from customers where id = ?");

        Config config = helper.getConfig();
        List commands = config.getCommand();
        assertEquals(1, commands.size());
        org.apache.tuscany.das.rdb.config.Command cmd = (org.apache.tuscany.das.rdb.config.Command) commands.get(0);
        assertEquals("delete", cmd.getKind());
        assertEquals("delete customer", cmd.getName());
        assertEquals("delete from customers where id = ?", cmd.getSQL());
View Full Code Here

     */
    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

    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

    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

TOP

Related Classes of org.apache.tuscany.das.rdb.config.Config

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.