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

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


                configWrapper.addImpliedRelationship(pkTableName, fkTableName, columnName);
            }
        }
        // Add any tables defined in the model but not included in the ResultSet
        // to the list of propertyNames
        Config model = configWrapper.getConfig();
        if (model != null) {
            Iterator tablesFromModel = model.getTable().iterator();
            while (tablesFromModel.hasNext()) {
                TableWrapper t = new TableWrapper((Table) tablesFromModel.next());
                if (tableToPropertyMap.get(t.getTypeName()) == null) {
                    tableToPropertyMap.put(t.getTypeName(), Collections.EMPTY_LIST);
                }
View Full Code Here


        this(ConfigUtil.loadConfig(stream));

    }

    public DASImpl(Config inConfig) {
        Config cfg = inConfig;
        if (cfg == null) {
            cfg = ConfigFactory.INSTANCE.createConfig();
        }
        this.configWrapper = new MappingWrapper(cfg);
View Full Code Here

        }
        return connection;
    }

    private void initializeConnection() {
        Config config = configWrapper.getConfig();
        if (config == null || config.getConnectionInfo() == null
                || config.getConnectionInfo().getDataSource() == null) {
            throw new RuntimeException("No connection has been provided and no data source has been specified");
        }

        Connection connection = null;
View Full Code Here

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

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.