use of orgomg.cwm.objectmodel.core.Expression in project tdq-studio-se by Talend.
the class DbmsLanguageTest method testExtractRegularExpressionFunctionForNetezza.
/**
* {@link org.talend.dq.dbms.DbmsLanguage#extractRegularExpressionFunction(Expression)}.
*
* case 6:Netezza database expression
*/
@Test
public void testExtractRegularExpressionFunctionForNetezza() {
DbmsLanguage netezzaDbmsLanguage = DbmsLanguageFactory.createDbmsLanguage(SupportDBUrlType.NETEZZADEFAULTURL);
Expression createExpression = CoreFactory.eINSTANCE.createExpression();
// netezza Database UDP mode
createExpression.setBody(// $NON-NLS-1$
"SELECT COUNT(CASE WHEN REGEXP_EXTRACT(<%=__COLUMN_NAMES__%>,<%=__PATTERN_EXPR__%>) THEN 1 END), COUNT(*) FROM <%=__TABLE_NAME__%> <%=__WHERE_CLAUSE__%>");
try {
// $NON-NLS-1$
netezzaDbmsLanguage.extractRegularExpressionFunction(createExpression, "<%=__PATTERN_EXPR__%>");
} catch (UnsupportedOperationException e) {
// $NON-NLS-1$
Assert.fail("Default DbmsLanguage don't should call extractRegularExpressionFunction method should thorw UnsupportedOperationException.");
}
}
use of orgomg.cwm.objectmodel.core.Expression in project tdq-studio-se by Talend.
the class DbmsLanguageTest method testGetSelectRegexpTestStringStringExpression.
/**
* Test method for
* {@link org.talend.dq.dbms.DbmsLanguage#getSelectRegexpTestString(java.lang.String, orgomg.cwm.objectmodel.core.Expression)}
* .
*/
@Test
public void testGetSelectRegexpTestStringStringExpression() {
try {
// $NON-NLS-1$
Expression createExpression = createExpression("Mysql");
DbmsLanguage dbms = getMysqlDbmsLanguage();
Assert.assertNotNull(dbms.getSelectRegexpTestString(REGEXP_STR, createExpression));
} catch (Exception e) {
fail(e.getMessage());
}
}
use of orgomg.cwm.objectmodel.core.Expression in project tdq-studio-se by Talend.
the class DbmsLanguageTest method testSetFunctionReturnValueCase4.
/**
* {@link org.talend.dq.dbms.DbmsLanguage#setFunctionReturnValue(Expression)}.
*
* case 4:Can not find the keyword for "THEN" in the body of expression.
*/
@Test
public void testSetFunctionReturnValueCase4() {
// $NON-NLS-1$
DbmsLanguage dbmsLanguage = DbmsLanguageFactory.createDbmsLanguage(DbmsLanguage.MSSQL, "1.0");
Expression createExpression = CoreFactory.eINSTANCE.createExpression();
// default Database
// $NON-NLS-1$
createExpression.setBody("**** WHEN RegularFunctionName(***)returnValue **)****");
// $NON-NLS-1$
dbmsLanguage.setFunctionReturnValue(dbmsLanguage.extractRegularExpressionFunctionReturnValue(createExpression, "***"));
String regularfunctionReturnValue = dbmsLanguage.getFunctionReturnValue();
Assert.assertEquals(StringUtils.EMPTY, regularfunctionReturnValue);
}
use of orgomg.cwm.objectmodel.core.Expression in project tdq-studio-se by Talend.
the class DbmsLanguageTest method testExtractRegularExpressionFunctionForVertica.
/**
* {@link org.talend.dq.dbms.DbmsLanguage#extractRegularExpressionFunction(Expression)}.
*
* case 1:vertica database expression
*/
@Test
public void testExtractRegularExpressionFunctionForVertica() {
DbmsLanguage netezzaDbmsLanguage = DbmsLanguageFactory.createDbmsLanguage(SupportDBUrlType.VERTICA);
Expression createExpression = CoreFactory.eINSTANCE.createExpression();
// Vertica Database
// $NON-NLS-1$
createExpression.setBody("**");
// $NON-NLS-1$
String regularFunctionName = netezzaDbmsLanguage.extractRegularExpressionFunction(createExpression, "***");
// $NON-NLS-1$
Assert.assertEquals("REGEXP_LIKE", regularFunctionName);
}
use of orgomg.cwm.objectmodel.core.Expression in project tdq-studio-se by Talend.
the class DbmsLanguageTest method testExtractRegularExpressionFunctionForOracle.
/**
* {@link org.talend.dq.dbms.DbmsLanguage#extractRegularExpressionFunction(Expression)}.
*
* case 4:Oracle database expression
*/
@Test
public void testExtractRegularExpressionFunctionForOracle() {
DbmsLanguage netezzaDbmsLanguage = DbmsLanguageFactory.createDbmsLanguage(SupportDBUrlType.ORACLEWITHSIDDEFAULTURL);
Expression createExpression = CoreFactory.eINSTANCE.createExpression();
// oracle Database
// $NON-NLS-1$
createExpression.setBody("**");
// $NON-NLS-1$
String regularFunctionName = netezzaDbmsLanguage.extractRegularExpressionFunction(createExpression, "***");
// $NON-NLS-1$
Assert.assertEquals("REGEXP_LIKE", regularFunctionName);
}
Aggregations