Search in sources :

Example 41 with TdColumn

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;
}
Also used : TdColumn(org.talend.cwm.relational.TdColumn) TdTable(org.talend.cwm.relational.TdTable) IRepositoryNode(org.talend.repository.model.IRepositoryNode) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) TdSqlDataType(org.talend.cwm.relational.TdSqlDataType)

Example 42 with TdColumn

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);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) TdColumn(org.talend.cwm.relational.TdColumn) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) NullCountIndicator(org.talend.dataquality.indicators.NullCountIndicator) Indicator(org.talend.dataquality.indicators.Indicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) NullCountIndicator(org.talend.dataquality.indicators.NullCountIndicator) Test(org.junit.Test)

Example 43 with TdColumn

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);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) TdColumn(org.talend.cwm.relational.TdColumn) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) NullCountIndicator(org.talend.dataquality.indicators.NullCountIndicator) Indicator(org.talend.dataquality.indicators.Indicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) Test(org.junit.Test)

Example 44 with TdColumn

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;
}
Also used : TdColumn(org.talend.cwm.relational.TdColumn) TdSqlDataType(org.talend.cwm.relational.TdSqlDataType)

Example 45 with 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);
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) RegularExpression(org.talend.dataquality.domain.pattern.RegularExpression) TdColumn(org.talend.cwm.relational.TdColumn) TdExpression(org.talend.cwm.relational.TdExpression) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) PatternComponent(org.talend.dataquality.domain.pattern.PatternComponent) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) Domain(org.talend.dataquality.domain.Domain) Test(org.junit.Test)

Aggregations

TdColumn (org.talend.cwm.relational.TdColumn)177 TdTable (org.talend.cwm.relational.TdTable)47 ArrayList (java.util.ArrayList)45 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)40 Test (org.junit.Test)37 ColumnSet (orgomg.cwm.resource.relational.ColumnSet)35 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)26 RepositoryNode (org.talend.repository.model.RepositoryNode)26 IRepositoryNode (org.talend.repository.model.IRepositoryNode)23 Indicator (org.talend.dataquality.indicators.Indicator)20 Connection (org.talend.core.model.metadata.builder.connection.Connection)17 Catalog (orgomg.cwm.resource.relational.Catalog)17 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)16 TdSqlDataType (org.talend.cwm.relational.TdSqlDataType)16 Analysis (org.talend.dataquality.analysis.Analysis)16 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)15 IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)14 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)14 Package (orgomg.cwm.objectmodel.core.Package)14 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)13