Package org.mule.module.db.internal.domain.param

Examples of org.mule.module.db.internal.domain.param.InputQueryParam


        int index = 1;
        for (DbType paramType : paramTypes)
        {

            InputQueryParam inputQueryParam = new DefaultInputQueryParam(index, paramType, "param" + index);
            queryParams.add(inputQueryParam);
            index++;
        }

        return new QueryTemplate(staticSqlText, QueryType.SELECT, queryParams);
View Full Code Here


        String sql = "SELECT * FROM PLANET WHERE POSITION = ?";
        QueryTemplate queryTemplate = parser.parse(sql);
        assertEquals(QueryType.SELECT, queryTemplate.getType());
        assertEquals(sql, queryTemplate.getSqlText());
        assertEquals(1, queryTemplate.getInputParams().size());
        InputQueryParam param1 = queryTemplate.getInputParams().get(0);
        assertEquals(UnknownDbType.getInstance(), param1.getType());
    }
View Full Code Here

    {
        QueryTemplate queryTemplate = parser.parse("update PLANET set NAME='Mercury' where ID= :planetId");
        assertEquals(QueryType.UPDATE, queryTemplate.getType());
        assertEquals("update PLANET set NAME='Mercury' where ID= ?", queryTemplate.getSqlText());
        assertEquals(1, queryTemplate.getInputParams().size());
        InputQueryParam param1 = queryTemplate.getInputParams().get(0);
        assertEquals(UnknownDbType.getInstance(), param1.getType());
        assertEquals("planetId", param1.getName());
        assertNull(param1.getValue());
    }
View Full Code Here

        assertTrue(queryTemplateBean instanceof QueryTemplate);
        QueryTemplate queryTemplate = (QueryTemplate) queryTemplateBean;
        assertEquals(QueryType.STORE_PROCEDURE_CALL, queryTemplate.getType());
        assertEquals(1, queryTemplate.getInputParams().size());

        InputQueryParam inputSqlParam = queryTemplate.getInputParams().get(0);
        assertEquals(UnknownDbType.getInstance(), inputSqlParam.getType());
        assertEquals("foo", inputSqlParam.getValue());
    }
View Full Code Here

        QueryTemplate queryTemplate = parser.parse("update PLANET set NAME='Mercury' where ID= #[planetId]");

        assertEquals(QueryType.UPDATE, queryTemplate.getType());
        assertEquals("update PLANET set NAME='Mercury' where ID= ?", queryTemplate.getSqlText());
        assertEquals(1, queryTemplate.getInputParams().size());
        InputQueryParam param1 = queryTemplate.getInputParams().get(0);
        assertEquals(UnknownDbType.getInstance(), param1.getType());
        assertNull(param1.getName());
        assertEquals("#[planetId]", param1.getValue());
    }
View Full Code Here

        QueryTemplate queryTemplate = parser.parse("SELECT * FROM PLANET WHERE POSITION = #[message.inboundProperties['position']] AND NAME= #[planetName]");

        assertEquals(QueryType.SELECT, queryTemplate.getType());
        assertEquals("SELECT * FROM PLANET WHERE POSITION = ? AND NAME= ?", queryTemplate.getSqlText());
        assertEquals(2, queryTemplate.getInputParams().size());
        InputQueryParam param1 = queryTemplate.getInputParams().get(0);
        assertEquals(UnknownDbType.getInstance(), param1.getType());
        assertNull(param1.getName());
        assertEquals("#[message.inboundProperties['position']]", param1.getValue());

        InputQueryParam param2 = queryTemplate.getInputParams().get(1);
        assertEquals(UnknownDbType.getInstance(), param2.getType());
        assertNull(param2.getName());
        assertEquals("#[planetName]", param2.getValue());
    }
View Full Code Here

        assertTrue(queryTemplateBean instanceof QueryTemplate);
        QueryTemplate queryTemplate = (QueryTemplate) queryTemplateBean;
        assertEquals(QueryType.SELECT, queryTemplate.getType());
        assertEquals("SELECT * FROM PLANET WHERE POSITION = ?", queryTemplate.getSqlText());
        assertEquals(1, queryTemplate.getInputParams().size());
        InputQueryParam param1 = queryTemplate.getInputParams().get(0);
        assertEquals(UnknownDbType.getInstance(), param1.getType());
        assertEquals("position", param1.getName());
        assertEquals("0", param1.getValue());
        assertEquals(1, param1.getIndex());
    }
View Full Code Here

        assertTrue(queryTemplateBean instanceof QueryTemplate);
        QueryTemplate queryTemplate = (QueryTemplate) queryTemplateBean;
        assertEquals(QueryType.UPDATE, queryTemplate.getType());
        assertEquals("update PLANET set NAME='Mercury' where ID=?", queryTemplate.getSqlText());
        assertEquals(1, queryTemplate.getInputParams().size());
        InputQueryParam param1 = queryTemplate.getInputParams().get(0);
        assertEquals(UnknownDbType.getInstance(), param1.getType());
        assertEquals("id", param1.getName());
        assertEquals("0", param1.getValue());
        assertEquals(1, param1.getIndex());
    }
View Full Code Here

        QueryTemplate queryTemplate = (QueryTemplate) queryTemplateBean;

        assertFalse(queryTemplate.isDynamic());
        assertEquals("SELECT * FROM PLANET WHERE POSITION = ?", queryTemplate.getSqlText());
        assertEquals(1, queryTemplate.getInputParams().size());
        InputQueryParam param1 = queryTemplate.getInputParams().get(0);
        assertEquals(UnknownDbType.getInstance(), param1.getType());
        assertEquals("position", param1.getName());
        assertEquals(null, param1.getValue());
        assertEquals(1, param1.getIndex());
    }
View Full Code Here

        QueryTemplate queryTemplate = (QueryTemplate) queryTemplateBean;
        assertEquals(QueryType.SELECT, queryTemplate.getType());
        assertEquals("SELECT * FROM PLANET WHERE POSITION = ? AND NAME = ?", queryTemplate.getSqlText());
        assertEquals(2, queryTemplate.getInputParams().size());

        InputQueryParam param1 = queryTemplate.getInputParams().get(0);
        assertEquals(UnknownDbType.getInstance(), param1.getType());
        assertEquals("position", param1.getName());
        assertEquals("0", param1.getValue());
        assertEquals(1, param1.getIndex());

        InputQueryParam param2 = queryTemplate.getInputParams().get(1);
        assertEquals(UnknownDbType.getInstance(), param2.getType());
        assertEquals("name", param2.getName());
        assertEquals("mars", param2.getValue());
        assertEquals(2, param2.getIndex());
    }
View Full Code Here

TOP

Related Classes of org.mule.module.db.internal.domain.param.InputQueryParam

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.