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());
}
}
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));
}
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;
}
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;
}
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());
}
Aggregations