Search in sources :

Example 6 with ColumnSetDBMap

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

the class ColumnSetDBMapTest method testSubListLongLongMapOfLongListOfObjectDataValidationCase1.

/**
 * Test method for
 * {@link org.talend.dataquality.indicators.mapdb.ColumnSetDBMap#subList(long, long, java.util.Map, org.talend.cwm.indicator.DataValidation)}
 * Case 1 Unique case
 */
@Test
public void testSubListLongLongMapOfLongListOfObjectDataValidationCase1() {
    ColumnSetDBMap dbMap1 = new ColumnSetDBMap();
    Assert.assertEquals(true, dbMap1.isEmpty());
    List<Object> keyList = new ArrayList<Object>();
    // $NON-NLS-1$
    keyList.add("id1");
    // $NON-NLS-1$
    keyList.add("name1");
    dbMap1.put(keyList, 1l);
    keyList = new ArrayList<Object>();
    // $NON-NLS-1$
    keyList.add("id2");
    // $NON-NLS-1$
    keyList.add("name2");
    dbMap1.put(keyList, 2l);
    Assert.assertEquals(2, dbMap1.size());
    UniqueCountIndicator uniqueCountIndicator = IndicatorsFactory.eINSTANCE.createUniqueCountIndicator();
    List<Object[]> subList = dbMap1.subList(0, 2, new HashMap<Long, List<Object>>(), IDataValidationFactory.INSTANCE.createValidation(uniqueCountIndicator));
    Assert.assertEquals(1, subList.size());
}
Also used : ColumnSetDBMap(org.talend.dataquality.indicators.mapdb.ColumnSetDBMap) ArrayList(java.util.ArrayList) UniqueCountIndicator(org.talend.dataquality.indicators.UniqueCountIndicator) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 7 with ColumnSetDBMap

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

the class ColumnSetDBMapTest method testSubListLongLongMapOfLongListOfObjectDataValidationCase3.

/**
 * Test method for
 * {@link org.talend.dataquality.indicators.mapdb.ColumnSetDBMap#subList(long, long, java.util.Map, org.talend.cwm.indicator.DataValidation)}
 * Case 3 distinct case
 */
@Test
public void testSubListLongLongMapOfLongListOfObjectDataValidationCase3() {
    ColumnSetDBMap dbMap1 = new ColumnSetDBMap();
    Assert.assertEquals(true, dbMap1.isEmpty());
    List<Object> keyList = new ArrayList<Object>();
    // $NON-NLS-1$
    keyList.add("id1");
    // $NON-NLS-1$
    keyList.add("name1");
    dbMap1.put(keyList, 1l);
    keyList = new ArrayList<Object>();
    // $NON-NLS-1$
    keyList.add("id2");
    // $NON-NLS-1$
    keyList.add("name2");
    dbMap1.put(keyList, 2l);
    Assert.assertEquals(2, dbMap1.size());
    DistinctCountIndicator distinctCountIndicator = IndicatorsFactory.eINSTANCE.createDistinctCountIndicator();
    List<Object[]> subList = dbMap1.subList(0, 2, new HashMap<Long, List<Object>>(), IDataValidationFactory.INSTANCE.createValidation(distinctCountIndicator));
    Assert.assertEquals(2, subList.size());
}
Also used : DistinctCountIndicator(org.talend.dataquality.indicators.DistinctCountIndicator) ColumnSetDBMap(org.talend.dataquality.indicators.mapdb.ColumnSetDBMap) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)7 Test (org.junit.Test)7 ColumnSetDBMap (org.talend.dataquality.indicators.mapdb.ColumnSetDBMap)7 List (java.util.List)5 DistinctCountIndicator (org.talend.dataquality.indicators.DistinctCountIndicator)1 DuplicateCountIndicator (org.talend.dataquality.indicators.DuplicateCountIndicator)1 RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)1 UniqueCountIndicator (org.talend.dataquality.indicators.UniqueCountIndicator)1