use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class SemanticDiscoveryActionProviderTest method createNewColumnRepNode.
/**
* DOC zshen Comment method "createNewColumnRepNode".
*/
private IRepositoryNode createNewColumnRepNode() {
// TODOćcreate real connection with eresource
TdColumn tdColumn = RelationalFactory.eINSTANCE.createTdColumn();
TdTable createTdTable = RelationalFactory.eINSTANCE.createTdTable();
tdColumn.setOwner(createTdTable);
TdSqlDataType dataType = RelationalFactory.eINSTANCE.createTdSqlDataType();
dataType.setJavaDataType(Types.VARCHAR);
tdColumn.setSqlDataType(dataType);
MetadataColumnRepositoryObject columnObject = new MetadataColumnRepositoryObject(null, tdColumn);
IRepositoryNode columnRepNode = new DBColumnRepNode(columnObject, new RepositoryNode(null, null, null), ENodeType.REPOSITORY_ELEMENT, null);
return columnRepNode;
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class IndicatorHelperTest method testGetNullCountIndicator1.
/**
* Test method for
* {@link org.talend.dataquality.helpers.IndicatorHelper#getNullCountIndicator(orgomg.cwm.objectmodel.core.ModelElement, java.util.Map)}
* . get NullCountIndicator
*/
@Test
public void testGetNullCountIndicator1() {
// TdColumn
TdColumn column1 = RelationalFactory.eINSTANCE.createTdColumn();
// ~
// Indicator
Indicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
Indicator nullCountIndicator = IndicatorsFactory.eINSTANCE.createNullCountIndicator();
// ~
// List
List<Indicator> list = new ArrayList<Indicator>();
list.add(rowCountIndicator);
list.add(nullCountIndicator);
// ~
// Map
Map<ModelElement, List<Indicator>> elementToIndicator = new HashMap<ModelElement, List<Indicator>>();
elementToIndicator.put(column1, list);
// ~
NullCountIndicator nullCountIndicator2 = IndicatorHelper.getNullCountIndicator(column1, elementToIndicator);
assert (nullCountIndicator2 != null);
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class IndicatorHelperTest method testGetRowCountIndicator1.
/**
* Test method for
* {@link org.talend.dataquality.helpers.IndicatorHelper#getRowCountIndicator(orgomg.cwm.objectmodel.core.ModelElement, java.util.Map)}
* . get RowCountIndicator
*/
@Test
public void testGetRowCountIndicator1() {
// TdColumn
TdColumn column1 = RelationalFactory.eINSTANCE.createTdColumn();
// ~
// Indicator
Indicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
Indicator nullCountIndicator = IndicatorsFactory.eINSTANCE.createNullCountIndicator();
// ~
// List
List<Indicator> list = new ArrayList<Indicator>();
list.add(rowCountIndicator);
list.add(nullCountIndicator);
// ~
// Map
Map<ModelElement, List<Indicator>> elementToIndicator = new HashMap<ModelElement, List<Indicator>>();
elementToIndicator.put(column1, list);
// ~
RowCountIndicator rowCountIndicator2 = IndicatorHelper.getRowCountIndicator(column1, elementToIndicator);
assert (rowCountIndicator2 != null);
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class ColumnSetMultiValueIndicatorImplTest method createColumn11.
/**
* create a TdColumn, the DatamingType is Nominal, the getSqlDataType is NUMERIC.
*
* @return
*/
private ModelElement createColumn11() {
TdColumn tdColumn = RelationalFactory.eINSTANCE.createTdColumn();
tdColumn.setName(COLUMN_NAME_11);
tdColumn.setContentType(DataminingType.NOMINAL.getLiteral());
TdSqlDataType tdSqlDataType = RelationalFactory.eINSTANCE.createTdSqlDataType();
tdSqlDataType.setJavaDataType(Types.NUMERIC);
tdColumn.setSqlDataType(tdSqlDataType);
return tdColumn;
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class RegexpMatchingIndicatorImplTest method testGetRegexFail1NotJavaRegex.
/**
* Test method for {@link org.talend.dataquality.indicators.impl.RegexpMatchingIndicatorImpl#getJavaRegex()}.
*/
@Test
public void testGetRegexFail1NotJavaRegex() {
// RegexpMatchingIndicator
RegexpMatchingIndicator createRegexpMatchingIndicator = IndicatorsFactory.eINSTANCE.createRegexpMatchingIndicator();
// ~RegexpMatchingIndicator
// IndicatorParameters
IndicatorParameters createIndicatorParameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
// ~IndicatorParameters
// Domain
Domain createDomain = DomainFactory.eINSTANCE.createDomain();
EList<Pattern> patterns = createDomain.getPatterns();
// ~Domain
// Pattern
Pattern createJavaPattern = PatternFactory.eINSTANCE.createPattern();
Pattern createSQLPattern = PatternFactory.eINSTANCE.createPattern();
Pattern createMSSQLPattern = PatternFactory.eINSTANCE.createPattern();
patterns.add(createJavaPattern);
patterns.add(createSQLPattern);
patterns.add(createMSSQLPattern);
// ~Pattern
// init java Pattern data
RegularExpression createJavaRegularExpression = PatternFactory.eINSTANCE.createRegularExpression();
TdExpression createJavaTdExpression = RelationalFactory.eINSTANCE.createTdExpression();
createJavaTdExpression.setBody(JavaRegex);
createJavaTdExpression.setLanguage("Microsoft SQL Server");
createJavaRegularExpression.setExpression(createJavaTdExpression);
createJavaRegularExpression.setExpressionType(ExpressionType.REGEXP.getLiteral());
EList<PatternComponent> components = createJavaPattern.getComponents();
components.add(createJavaRegularExpression);
// ~init java Pattern data
createIndicatorParameters.setDataValidDomain(createDomain);
createRegexpMatchingIndicator.setParameters(createIndicatorParameters);
TdColumn column = RelationalFactory.eINSTANCE.createTdColumn();
MetadataTable mdColumn = RelationalFactory.eINSTANCE.createTdTable();
column.setTable(mdColumn);
createRegexpMatchingIndicator.setAnalyzedElement(column);
// call getRegex()
String regexResult = createRegexpMatchingIndicator.getRegex();
// ~call getRegex()
Assert.assertTrue(regexResult == null);
}
Aggregations