Search in sources :

Example 6 with AnalysisParameters

use of org.talend.dataquality.analysis.AnalysisParameters in project tdq-studio-se by Talend.

the class RespositoryDetailView method createAnaysisDetail.

private void createAnaysisDetail(Analysis ana) {
    if (ana == null) {
        return;
    }
    createName(ana);
    createPurpose(ana);
    createDescription(ana);
    AnalysisParameters parameters = ana.getParameters();
    String description = parameters == null ? null : parameters.getAnalysisType().getLiteral();
    // $NON-NLS-1$
    newLabelAndText(gContainer, DefaultMessagesImpl.getString("RespositoryDetailView.otherType"), description);
    AnalysisContext context = ana.getContext();
    int numn = context == null ? 0 : context.getAnalysedElements().size();
    newLabelAndText(gContainer, DefaultMessagesImpl.getString("RespositoryDetailView.numberOfAnalyzedElements"), // $NON-NLS-1$
    String.valueOf(numn));
    DataManager connection = context == null ? null : context.getConnection();
    if (connection == null) {
        description = null;
    } else {
        description = connection.getName();
    }
    // $NON-NLS-1$
    newLabelAndText(gContainer, DefaultMessagesImpl.getString("RespositoryDetailView.connection"), description);
}
Also used : AnalysisParameters(org.talend.dataquality.analysis.AnalysisParameters) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext)

Example 7 with AnalysisParameters

use of org.talend.dataquality.analysis.AnalysisParameters in project tdq-studio-se by Talend.

the class AnalysisBaseBuilder method createAnalysisParameters.

private AnalysisParameters createAnalysisParameters(AnalysisType type) {
    AnalysisParameters context = AnalysisFactory.eINSTANCE.createAnalysisParameters();
    context.setAnalysisType(type);
    return context;
}
Also used : AnalysisParameters(org.talend.dataquality.analysis.AnalysisParameters)

Example 8 with AnalysisParameters

use of org.talend.dataquality.analysis.AnalysisParameters in project tdq-studio-se by Talend.

the class UnitTestBuildHelper method createAndInitAnalysis.

public static Analysis createAndInitAnalysis() {
    Analysis ana = UnitTestBuildHelper.createRealAnalysis("anaA", null, false);
    AnalysisParameters parameters = AnalysisFactory.eINSTANCE.createAnalysisParameters();
    parameters.setExecutionLanguage(ExecutionLanguage.SQL);
    ana.setParameters(parameters);
    AnalysisContext context = AnalysisFactory.eINSTANCE.createAnalysisContext();
    ana.setContext(context);
    Connection createConnection = ConnectionFactory.eINSTANCE.createConnection();
    createConnection.setName("MySQL");
    context.setConnection(createConnection);
    return ana;
}
Also used : Analysis(org.talend.dataquality.analysis.Analysis) AnalysisParameters(org.talend.dataquality.analysis.AnalysisParameters) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext)

Example 9 with AnalysisParameters

use of org.talend.dataquality.analysis.AnalysisParameters in project tdq-studio-se by Talend.

the class MatchAnalysisExecutorTest method testExecute.

/**
 * Test method for
 * {@link org.talend.dq.analysis.MatchAnalysisExecutor#execute(org.talend.dataquality.analysis.Analysis)}.
 */
@SuppressWarnings("nls")
@Test
public void testExecute() {
    MatchAnalysisExecutor matchAnalysisExecutor = new MatchAnalysisExecutor();
    Analysis analysis = AnalysisPackage.eINSTANCE.getAnalysisFactory().createAnalysis();
    AnalysisContext context = AnalysisPackage.eINSTANCE.getAnalysisFactory().createAnalysisContext();
    analysis.setContext(context);
    AnalysisParameters params = AnalysisPackage.eINSTANCE.getAnalysisFactory().createAnalysisParameters();
    analysis.setParameters(params);
    TaggedValueHelper.setTaggedValue(analysis, TaggedValueHelper.PREVIEW_ROW_NUMBER, String.valueOf(100));
    // analysisResult.setAnalysis(analysis);
    context.setConnection(delimitedFileconnection);
    // $NON-NLS-1$
    URL fileUrl = this.getClass().getResource("match_test_data");
    metadataTable = UnitTestBuildHelper.getDefault().initFileConnection(fileUrl, delimitedFileconnection);
    this.name = UnitTestBuildHelper.getDefault().initColumns(context, this.metadataTable);
    // Scenario 1
    // - Match key: name, no block key, levenshtein attribute algorithm. groupQualityThreshold = 0.9d, matchInterval
    // = 0.95d .
    double groupQualityThreshold = 0.9d;
    double matchInterval = 0.95d;
    assertScenario1(matchAnalysisExecutor, analysis, name, "name", groupQualityThreshold, matchInterval);
    // Scenario 2
    // - Same to scenario 1, EXCEPT matchInterval = 0.8d .
    matchInterval = 0.8d;
    assertScenario2(matchAnalysisExecutor, analysis, name, "name", groupQualityThreshold, matchInterval);
    // Scenario 3
    // - Same to scenario 2, EXCEPT groupQualityThreshold = 0.95d.
    groupQualityThreshold = 0.95d;
    assertScenario3(matchAnalysisExecutor, analysis, name, "name", groupQualityThreshold, matchInterval);
    // Scenario 4
    // - Same to scenario 3, EXCEPT a new blocking key = country.
    assertScenario4(matchAnalysisExecutor, analysis, name, "name", groupQualityThreshold, matchInterval);
}
Also used : Analysis(org.talend.dataquality.analysis.Analysis) AnalysisParameters(org.talend.dataquality.analysis.AnalysisParameters) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext) URL(java.net.URL) Test(org.junit.Test)

Example 10 with AnalysisParameters

use of org.talend.dataquality.analysis.AnalysisParameters in project tdq-studio-se by Talend.

the class TableAnalysisSqlExecutorTest method setUp.

/**
 * DOC xqliu Comment method "setUp".
 *
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
    // create TdTable
    TdTable testTdTable = RelationalFactory.eINSTANCE.createTdTable();
    // $NON-NLS-1$
    testTdTable.setName("generateTable");
    // create connection
    DatabaseConnection testDatabaseConnection = ConnectionFactory.eINSTANCE.createDatabaseConnection();
    TaggedValueHelper.setTaggedValue(testDatabaseConnection, TaggedValueHelper.DB_PRODUCT_NAME, SupportDBUrlType.MYSQLDEFAULTURL.getDBKey());
    // create catalog
    Catalog testCatalog = orgomg.cwm.resource.relational.RelationalFactory.eINSTANCE.createCatalog();
    // $NON-NLS-1$
    testCatalog.setName("TBI");
    testTdTable.setNamespace(testCatalog);
    testCatalog.setNamespace(testDatabaseConnection);
    testCatalog.getDataManager().add(testDatabaseConnection);
    // create analysis
    testAnalysis = AnalysisFactory.eINSTANCE.createAnalysis();
    // create Analaysis result
    AnalysisResult testAnalysisResult = AnalysisFactory.eINSTANCE.createAnalysisResult();
    testAnalysis.setResults(testAnalysisResult);
    // create analysis parameter
    AnalysisParameters testAnalysisParameters = AnalysisFactory.eINSTANCE.createAnalysisParameters();
    testAnalysis.setParameters(testAnalysisParameters);
    // create analysis Content
    AnalysisContext testAnalysisContext = AnalysisFactory.eINSTANCE.createAnalysisContext();
    testAnalysis.setContext(testAnalysisContext);
    testAnalysisContext.setConnection(testDatabaseConnection);
    // create WhereRuleAide indicatorDefinition
    testWhereRuleIndicatorDefinition = RulesFactory.eINSTANCE.createWhereRule();
    // $NON-NLS-1$
    testWhereRuleIndicatorDefinition.setLabel("rule1");
    // create WhereRule indicator
    testWhereRuleIndicator = IndicatorSqlFactory.eINSTANCE.createWhereRuleIndicator();
    testAnalysisResult.getIndicators().add(testWhereRuleIndicator);
    testWhereRuleIndicator.setAnalyzedElement(testTdTable);
    testWhereRuleIndicator.setIndicatorDefinition(testWhereRuleIndicatorDefinition);
}
Also used : TdTable(org.talend.cwm.relational.TdTable) AnalysisParameters(org.talend.dataquality.analysis.AnalysisParameters) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext) Catalog(orgomg.cwm.resource.relational.Catalog) AnalysisResult(org.talend.dataquality.analysis.AnalysisResult) Before(org.junit.Before)

Aggregations

AnalysisParameters (org.talend.dataquality.analysis.AnalysisParameters)19 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)13 Analysis (org.talend.dataquality.analysis.Analysis)10 AnalysisResult (org.talend.dataquality.analysis.AnalysisResult)7 Test (org.junit.Test)6 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)6 TdTable (org.talend.cwm.relational.TdTable)6 TdColumn (org.talend.cwm.relational.TdColumn)5 ExecutionInformations (org.talend.dataquality.analysis.ExecutionInformations)5 Before (org.junit.Before)4 Connection (org.talend.core.model.metadata.builder.connection.Connection)3 Domain (org.talend.dataquality.domain.Domain)3 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)3 Package (orgomg.cwm.objectmodel.core.Package)3 IPath (org.eclipse.core.runtime.IPath)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 DelimitedFileConnection (org.talend.core.model.metadata.builder.connection.DelimitedFileConnection)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 TdSqlDataType (org.talend.cwm.relational.TdSqlDataType)2 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)2