Search in sources :

Example 1 with RowCountIndicator

use of org.talend.dataquality.indicators.RowCountIndicator in project tdq-studio-se by Talend.

the class TableIndicator method createTableIndicatorWithRowCountIndicator.

/**
 * DOC xqliu Comment method "createTableIndicatorWithRowCountIndicator".
 *
 * @param table
 * @return
 */
public static TableIndicator createTableIndicatorWithRowCountIndicator(NamedColumnSet set) {
    TableIndicator tableIndicator = new TableIndicator(set);
    RowCountIndicator createIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
    DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createIndicator);
    createIndicator.setAnalyzedElement(set);
    Indicator[] indicators = new Indicator[] { createIndicator };
    tableIndicator.setIndicators(indicators);
    return tableIndicator;
}
Also used : RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) Indicator(org.talend.dataquality.indicators.Indicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator)

Example 2 with RowCountIndicator

use of org.talend.dataquality.indicators.RowCountIndicator in project tdq-studio-se by Talend.

the class CountsIndicatorImpl method basicSetRowCountIndicator.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetRowCountIndicator(RowCountIndicator newRowCountIndicator, NotificationChain msgs) {
    RowCountIndicator oldRowCountIndicator = rowCountIndicator;
    rowCountIndicator = newRowCountIndicator;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IndicatorsPackage.COUNTS_INDICATOR__ROW_COUNT_INDICATOR, oldRowCountIndicator, newRowCountIndicator);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator)

Example 3 with RowCountIndicator

use of org.talend.dataquality.indicators.RowCountIndicator in project tdq-studio-se by Talend.

the class InidcatorUnitTest method testGetIndicatorNameCase3.

/**
 * Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getIndicatorName()}.
 *
 * test case 3: Get Indicator Name from TableIndicatorUnit
 */
@Test
public void testGetIndicatorNameCase3() {
    RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
    IRepositoryViewObject rowCountRepositoryViewObject = null;
    try {
        List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_SIMPLE_STATISTICS);
        Assert.assertEquals(10, all.size());
        rowCountRepositoryViewObject = all.get(7);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(rowCountRepositoryViewObject);
    TDQIndicatorDefinitionItem rowCountItem = (TDQIndicatorDefinitionItem) rowCountRepositoryViewObject.getProperty().getItem();
    rowCountIndicator.setIndicatorDefinition(rowCountItem.getIndicatorDefinition());
    TableIndicatorUnit TableIndicatorUnit = new TableIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, rowCountIndicator, null);
    Assert.assertEquals(org.talend.cwm.management.i18n.Messages.getString(rowCountItem.getProperty().getLabel()), TableIndicatorUnit.getIndicatorName());
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) Test(org.junit.Test)

Example 4 with RowCountIndicator

use of org.talend.dataquality.indicators.RowCountIndicator in project tdq-studio-se by Talend.

the class InidcatorUnitTest method testGetFormsCase1.

/**
 * Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getForms()}.
 *
 * test case 1: Get Forms from ColumnSetIndicatorUnit
 */
@Test
public void testGetFormsCase1() {
    RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
    IRepositoryViewObject rowCountRepositoryViewObject = null;
    try {
        List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_SIMPLE_STATISTICS);
        Assert.assertEquals(10, all.size());
        rowCountRepositoryViewObject = all.get(7);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(rowCountRepositoryViewObject);
    TDQIndicatorDefinitionItem rowCountItem = (TDQIndicatorDefinitionItem) rowCountRepositoryViewObject.getProperty().getItem();
    rowCountIndicator.setIndicatorDefinition(rowCountItem.getIndicatorDefinition());
    ColumnSetIndicatorUnit columnSetIndicatorUnit = new ColumnSetIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, rowCountIndicator);
    FormEnum[] forms = new FormEnum[] { FormEnum.IndicatorThresholdsForm };
    FormEnum[] resultforms = columnSetIndicatorUnit.getForms();
    Assert.assertEquals(forms.length, resultforms.length);
    for (int index = 0; index < forms.length; index++) {
        Assert.assertEquals(forms[index], resultforms[index]);
    }
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) FormEnum(org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum) Test(org.junit.Test)

Example 5 with RowCountIndicator

use of org.talend.dataquality.indicators.RowCountIndicator in project tdq-studio-se by Talend.

the class InidcatorUnitTest method testGetIndicatorNameCase2.

/**
 * Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getIndicatorName()}.
 *
 * test case 2: Get Indicator Name from ColumnIndicatorUnit
 */
@Test
public void testGetIndicatorNameCase2() {
    RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
    IRepositoryViewObject rowCountRepositoryViewObject = null;
    try {
        List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_SIMPLE_STATISTICS);
        Assert.assertEquals(10, all.size());
        rowCountRepositoryViewObject = all.get(7);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    Assert.assertNotNull(rowCountRepositoryViewObject);
    TDQIndicatorDefinitionItem rowCountItem = (TDQIndicatorDefinitionItem) rowCountRepositoryViewObject.getProperty().getItem();
    rowCountIndicator.setIndicatorDefinition(rowCountItem.getIndicatorDefinition());
    ColumnIndicatorUnit columnIndicatorUnit = new ColumnIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, rowCountIndicator, null);
    Assert.assertEquals(org.talend.cwm.management.i18n.Messages.getString(rowCountItem.getProperty().getLabel()), columnIndicatorUnit.getIndicatorName());
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) Test(org.junit.Test)

Aggregations

RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)33 Indicator (org.talend.dataquality.indicators.Indicator)12 Test (org.junit.Test)11 NullCountIndicator (org.talend.dataquality.indicators.NullCountIndicator)10 DuplicateCountIndicator (org.talend.dataquality.indicators.DuplicateCountIndicator)9 ArrayList (java.util.ArrayList)8 DistinctCountIndicator (org.talend.dataquality.indicators.DistinctCountIndicator)7 UniqueCountIndicator (org.talend.dataquality.indicators.UniqueCountIndicator)7 PersistenceException (org.talend.commons.exception.PersistenceException)6 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)6 TDQIndicatorDefinitionItem (org.talend.dataquality.properties.TDQIndicatorDefinitionItem)6 List (java.util.List)5 AverageLengthIndicator (org.talend.dataquality.indicators.AverageLengthIndicator)5 BlankCountIndicator (org.talend.dataquality.indicators.BlankCountIndicator)5 TdColumn (org.talend.cwm.relational.TdColumn)4 DefValueCountIndicator (org.talend.dataquality.indicators.DefValueCountIndicator)4 InvalidRegCodeCountIndicator (org.talend.dataquality.indicators.InvalidRegCodeCountIndicator)4 MaxLengthIndicator (org.talend.dataquality.indicators.MaxLengthIndicator)4 MaxValueIndicator (org.talend.dataquality.indicators.MaxValueIndicator)4 MeanIndicator (org.talend.dataquality.indicators.MeanIndicator)4