Search in sources :

Example 36 with TdColumn

use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.

the class DbmsLanguageTest method testGetTableName.

/**
 * Test method for {@link org.talend.dq.dbms.DbmsLanguage#getTableName(orgomg.cwm.objectmodel.core.ModelElement)}.
 */
@Test
public void testGetTableName() {
    try {
        TdTable tdTable = RelationalFactory.eINSTANCE.createTdTable();
        tdTable.setName(TABLE_NAME);
        TdColumn tdColumn = RelationalFactory.eINSTANCE.createTdColumn();
        tdColumn.setName(COLUMN_NAME);
        tdTable.getOwnedElement().add(tdColumn);
        tdColumn.setOwner(tdTable);
        DbmsLanguage dbms = getMysqlDbmsLanguage();
        Assert.assertTrue(TABLE_NAME.equals(dbms.getTableName(tdColumn)));
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : TdTable(org.talend.cwm.relational.TdTable) TdColumn(org.talend.cwm.relational.TdColumn) Test(org.junit.Test)

Example 37 with TdColumn

use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.

the class AnalysisExecutorHelperTest method testGetTableName_2.

/**
 * try the oracle db type. Test method for
 * {@link org.talend.dq.helper.AnalysisExecutorHelper#getTableName(orgomg.cwm.objectmodel.core.ModelElement, org.talend.dq.dbms.DbmsLanguage)}
 * .
 */
@Test
public void testGetTableName_2() {
    TdColumn tdColumn = RelationalFactory.eINSTANCE.createTdColumn();
    TdTable tdTable = RelationalFactory.eINSTANCE.createTdTable();
    // $NON-NLS-1$
    tdTable.setName("tableName");
    tdColumn.setOwner(tdTable);
    // $NON-NLS-1$
    tdColumn.setName("columnName");
    DbmsLanguage dbmsLanguage = DbmsLanguageFactory.createDbmsLanguage(SupportDBUrlType.ORACLEWITHSIDDEFAULTURL.getLanguage(), null);
    // mock(Schema.class);
    Package schema = orgomg.cwm.resource.relational.RelationalFactory.eINSTANCE.createSchema();
    // $NON-NLS-1$
    schema.setName("schemaName");
    tdTable.setNamespace(schema);
    // $NON-NLS-1$
    assertEquals("\"SCHEMANAME\".\"TABLENAME\"", AnalysisExecutorHelper.getTableName(tdColumn, dbmsLanguage));
}
Also used : DbmsLanguage(org.talend.dq.dbms.DbmsLanguage) TdColumn(org.talend.cwm.relational.TdColumn) TdTable(org.talend.cwm.relational.TdTable) Package(orgomg.cwm.objectmodel.core.Package) Test(org.junit.Test)

Example 38 with TdColumn

use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.

the class UnitTestBuildHelper method createModelElementIndicator.

public static ModelElementIndicator createModelElementIndicator() {
    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);
    ModelElementIndicator modelElementIndicator = new ColumnIndicatorImpl(columnRepNode);
    return modelElementIndicator;
}
Also used : ColumnIndicatorImpl(org.talend.dataprofiler.core.model.impl.ColumnIndicatorImpl) 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) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TdSqlDataType(org.talend.cwm.relational.TdSqlDataType) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 39 with TdColumn

use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.

the class UnitTestBuildHelper method createRealTdColumn.

public static TdColumn createRealTdColumn(String columnName, String tdSqlName, int javaType) {
    TdTable table = org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdTable();
    // $NON-NLS-1$
    table.setName("TDQ_CALENDAR");
    TdColumn column = org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdColumn();
    column.setName(columnName);
    TdSqlDataType tdsql = org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdSqlDataType();
    tdsql.setName(tdSqlName);
    tdsql.setJavaDataType(javaType);
    column.setSqlDataType(tdsql);
    table.getOwnedElement().add(column);
    column.setOwner(table);
    return column;
}
Also used : TdTable(org.talend.cwm.relational.TdTable) TdColumn(org.talend.cwm.relational.TdColumn) TdSqlDataType(org.talend.cwm.relational.TdSqlDataType)

Example 40 with TdColumn

use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.

the class DrillDownEditorInputRealTest method testGetColumnsByTdColumnCase2.

/**
 * Test method for
 * {@link org.talend.dataprofiler.core.ui.editor.analysis.drilldown.DrillDownEditorInput#getColumnsByTdColumn(org.talend.cwm.relational.TdColumn)}
 * . case2 :for view case
 */
@Test
public void testGetColumnsByTdColumnCase2() {
    TdColumn currentTdColumn = RelationalFactory.eINSTANCE.createTdColumn();
    TdColumn secondTdColumn = RelationalFactory.eINSTANCE.createTdColumn();
    TdView createTdView = RelationalFactory.eINSTANCE.createTdView();
    List<TdColumn> tdColumns = new ArrayList<TdColumn>();
    tdColumns.add(currentTdColumn);
    tdColumns.add(secondTdColumn);
    ViewHelper.addColumns(createTdView, tdColumns);
    DrillDownEditorInput drillDownEditorInput = new DrillDownEditorInput();
    List<TdColumn> allofTdColumn = drillDownEditorInput.getColumnsByTdColumn(currentTdColumn);
    Assert.assertEquals(createTdView.getColumns().size(), allofTdColumn.size());
}
Also used : TdColumn(org.talend.cwm.relational.TdColumn) TdView(org.talend.cwm.relational.TdView) ArrayList(java.util.ArrayList) 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