use of org.talend.dataquality.analysis.ExecutionInformations in project tdq-studio-se by Talend.
the class OverviewResultPage method refreshSumSection.
/**
* DOC qzhang Comment method "refreshSumSection".
*
* @param summarySection
*/
private void refreshSumSection() {
fillDataProvider();
if (getTdDataProvider() == null) {
return;
}
if (sumSectionClient != null && !sumSectionClient.isDisposed()) {
Control[] children = sumSectionClient.getChildren();
for (Control control : children) {
control.dispose();
}
}
Composite leftComp = new Composite(sumSectionClient, SWT.NONE);
leftComp.setLayout(new GridLayout(2, false));
GridData subCompData = new GridData(GridData.FILL_HORIZONTAL);
subCompData.verticalAlignment = GridData.BEGINNING;
leftComp.setLayoutData(subCompData);
Composite rightComp = new Composite(sumSectionClient, SWT.NONE);
rightComp.setLayout(new GridLayout(2, false));
rightComp.setLayoutData(subCompData);
String connectionStr = JavaSqlFactory.getURL(getTdDataProvider());
Properties pameterProperties = SupportDBUrlStore.getInstance().getDBPameterProperties(connectionStr);
// $NON-NLS-1$
toolkit.createLabel(leftComp, DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.DBMS"));
// MOD TDQ-8539, find the db type from the connection, not from the properties file
toolkit.createLabel(leftComp, getDatabaseType(pameterProperties));
String serverName = JavaSqlFactory.getServerName(getTdDataProvider());
// $NON-NLS-1$
toolkit.createLabel(leftComp, DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.server"));
toolkit.createLabel(leftComp, serverName == null ? PluginConstant.EMPTY_STRING : serverName);
String port = JavaSqlFactory.getPort(getTdDataProvider());
// $NON-NLS-1$
toolkit.createLabel(leftComp, DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.port"));
toolkit.createLabel(leftComp, port == null ? PluginConstant.EMPTY_STRING : port);
String username = JavaSqlFactory.getUsername(getTdDataProvider());
// $NON-NLS-1$
toolkit.createLabel(leftComp, DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.connectAs"));
toolkit.createLabel(leftComp, username);
List<Catalog> tdCatalogs = getCatalogs();
// TDQ-6735 get the correct numbers of schema.
// MOD TDQ-8539 , get the schemas size
int schemaSize = masterPage.getSchamas(tdCatalogs);
toolkit.createLabel(leftComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.catalogs", PluginConstant.EMPTY_STRING));
toolkit.createLabel(leftComp, PluginConstant.EMPTY_STRING + tdCatalogs.size());
toolkit.createLabel(leftComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.schemata", PluginConstant.EMPTY_STRING));
toolkit.createLabel(leftComp, PluginConstant.EMPTY_STRING + schemaSize);
ExecutionInformations resultMetadata = masterPage.getCurrentModelElement().getResults().getResultMetadata();
toolkit.createLabel(rightComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.createionDate", PluginConstant.EMPTY_STRING));
toolkit.createLabel(rightComp, getFormatDateStr(masterPage.getCurrentModelElement().getCreationDate()));
toolkit.createLabel(rightComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("AbstractAnalysisResultPage.executionDate", PluginConstant.EMPTY_STRING));
toolkit.createLabel(rightComp, getFormatDateStr(resultMetadata.getExecutionDate()));
toolkit.createLabel(rightComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("AbstractAnalysisResultPage.executionDuration", PluginConstant.EMPTY_STRING));
// $NON-NLS-1$
toolkit.createLabel(rightComp, PluginConstant.EMPTY_STRING + resultMetadata.getExecutionDuration() / 1000.0d + "s");
String executeStatus = (resultMetadata.isLastRunOk() ? DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.success") : // $NON-NLS-1$ //$NON-NLS-2$
DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.failure", resultMetadata.getMessage()));
Label rightLabel = toolkit.createLabel(rightComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("AbstractAnalysisResultPage.executionStatus"));
int executionNumber = resultMetadata.getExecutionNumber();
if (!resultMetadata.isLastRunOk() && executionNumber != 0) {
rightLabel.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
rightLabel = toolkit.createLabel(rightComp, executionNumber == 0 ? PluginConstant.EMPTY_STRING : executeStatus);
toolkit.createLabel(rightComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("AbstractAnalysisResultPage.numberOfExecution", PluginConstant.EMPTY_STRING));
toolkit.createLabel(rightComp, PluginConstant.EMPTY_STRING + executionNumber);
toolkit.createLabel(rightComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("AbstractAnalysisResultPage.lastSucessfulExecution", PluginConstant.EMPTY_STRING));
toolkit.createLabel(rightComp, PluginConstant.EMPTY_STRING + resultMetadata.getLastExecutionNumberOk());
// MOD qiongli 2011-5-16
DataManager connection = masterPage.getCurrentModelElement().getContext().getConnection();
if (connection != null) {
RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(connection);
if (connNode != null && connNode.getObject().isDeleted()) {
Label leftLabel = toolkit.createLabel(leftComp, // $NON-NLS-1$
DefaultMessagesImpl.getString("AbstractPagePart.LogicalDeleteWarn", connNode.getLabel()));
leftLabel.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
toolkit.createLabel(rightComp, PluginConstant.EMPTY_STRING);
toolkit.createLabel(rightComp, PluginConstant.EMPTY_STRING);
}
}
sumSectionClient.layout();
}
use of org.talend.dataquality.analysis.ExecutionInformations in project tdq-studio-se by Talend.
the class ExecutionInformationsItemProvider method getText.
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
Date labelValue = ((ExecutionInformations) object).getExecutionDate();
String label = labelValue == null ? null : labelValue.toString();
return label == null || label.length() == 0 ? getString("_UI_ExecutionInformations_type") : getString("_UI_ExecutionInformations_type") + " " + label;
}
use of org.talend.dataquality.analysis.ExecutionInformations in project tdq-studio-se by Talend.
the class AnalysisHandlerTest method testChangeDefaultRowLoaded.
/**
* Test method for {@link org.talend.dq.analysis.AnalysisHandler#changeDefaultRowLoaded(java.lang.String)}.
*/
@Test
public void testChangeDefaultRowLoaded() {
int rowCountValue = 100;
Analysis createAna = AnalysisFactory.eINSTANCE.createAnalysis();
AnalysisResult createAnalysisResult = AnalysisFactory.eINSTANCE.createAnalysisResult();
createAna.setResults(createAnalysisResult);
ExecutionInformations createExecutionInformations = AnalysisFactory.eINSTANCE.createExecutionInformations();
createAnalysisResult.setResultMetadata(createExecutionInformations);
AnalysisHandler createHandler = AnalysisHandler.createHandler(createAna);
createHandler.changeDefaultRowLoaded(String.valueOf(rowCountValue));
String defaultLoadedRowCount = createHandler.getDefaultLoadedRowCount();
Assert.assertEquals(Integer.valueOf(rowCountValue), Integer.valueOf(defaultLoadedRowCount));
}
use of org.talend.dataquality.analysis.ExecutionInformations in project tdq-studio-se by Talend.
the class ColumnAnalysisExecutorTest method testCreateSqlStatement_1.
/**
* when there are some catelog
* {@link org.talend.dq.analysis.ColumnAnalysisExecutor#createSqlStatement(org.talend.dataquality.analysis.Analysis)}
* .
*/
@Test
public void testCreateSqlStatement_1() {
Analysis analysis = AnalysisFactory.eINSTANCE.createAnalysis();
AnalysisContext context = AnalysisFactory.eINSTANCE.createAnalysisContext();
analysis.setContext(context);
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");
AnalysisParameters analysisPara = AnalysisFactory.eINSTANCE.createAnalysisParameters();
analysisPara.setStoreData(false);
analysis.setParameters(analysisPara);
context.getAnalysedElements().add(tdColumn);
AnalysisResult analysisResult = AnalysisFactory.eINSTANCE.createAnalysisResult();
ExecutionInformations info = AnalysisFactory.eINSTANCE.createExecutionInformations();
analysisResult.setResultMetadata(info);
analysis.setResults(analysisResult);
// mock(Catalog.class);
Package catalog = orgomg.cwm.resource.relational.RelationalFactory.eINSTANCE.createCatalog();
// $NON-NLS-1$
catalog.setName("catalogName");
tdTable.setNamespace(catalog);
DatabaseConnection createConnection = ConnectionFactory.eINSTANCE.createDatabaseConnection();
createConnection.getTaggedValue().add(TaggedValueHelper.createTaggedValue(TaggedValueHelper.DB_PRODUCT_NAME, SupportDBUrlType.MYSQLDEFAULTURL.getLanguage()));
analysis.getContext().setConnection(createConnection);
ColumnAnalysisExecutor columnAnalysisExecutor = new ColumnAnalysisExecutor();
// $NON-NLS-1$
assertEquals("SELECT `columnName` FROM `catalogName`.`tableName`", columnAnalysisExecutor.createSqlStatement(analysis));
}
use of org.talend.dataquality.analysis.ExecutionInformations in project tdq-studio-se by Talend.
the class ColumnAnalysisExecutorTest method testCreateSqlStatement_2.
/**
* when there are some schema.
* {@link org.talend.dq.analysis.ColumnAnalysisExecutor#createSqlStatement(org.talend.dataquality.analysis.Analysis)}
* .
*/
@Test
public void testCreateSqlStatement_2() {
Analysis analysis = AnalysisFactory.eINSTANCE.createAnalysis();
AnalysisContext context = AnalysisFactory.eINSTANCE.createAnalysisContext();
analysis.setContext(context);
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");
AnalysisParameters analysisPara = AnalysisFactory.eINSTANCE.createAnalysisParameters();
analysisPara.setStoreData(false);
analysis.setParameters(analysisPara);
context.getAnalysedElements().add(tdColumn);
AnalysisResult analysisResult = AnalysisFactory.eINSTANCE.createAnalysisResult();
ExecutionInformations info = AnalysisFactory.eINSTANCE.createExecutionInformations();
analysisResult.setResultMetadata(info);
analysis.setResults(analysisResult);
// mock(Schema.class);
Package schema = orgomg.cwm.resource.relational.RelationalFactory.eINSTANCE.createSchema();
// $NON-NLS-1$
schema.setName("schemaName");
tdTable.setNamespace(schema);
// mock(Catalog.class);
Package catalog = orgomg.cwm.resource.relational.RelationalFactory.eINSTANCE.createCatalog();
// $NON-NLS-1$
catalog.setName("catalogName");
schema.setNamespace(catalog);
DatabaseConnection createConnection = ConnectionFactory.eINSTANCE.createDatabaseConnection();
createConnection.getTaggedValue().add(TaggedValueHelper.createTaggedValue(TaggedValueHelper.DB_PRODUCT_NAME, SupportDBUrlType.MSSQLDEFAULTURL.getLanguage()));
analysis.getContext().setConnection(createConnection);
ColumnAnalysisExecutor columnAnalysisExecutor = new ColumnAnalysisExecutor();
assertEquals("SELECT columnName FROM catalogName.schemaName.tableName", // $NON-NLS-1$
columnAnalysisExecutor.createSqlStatement(analysis));
}
Aggregations