Search in sources :

Example 1 with ColumnSetDBMap

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

the class ColumnSetDBMapTest method testSubListLongLongMapOfLongListOfObjectCase1.

/**
 * Test method for {@link org.talend.dataquality.indicators.mapdb.ColumnSetDBMap#subList(long, long, java.util.Map)}
 * Case 1 normal case
 */
@Test
public void testSubListLongLongMapOfLongListOfObjectCase1() {
    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());
    List<Object[]> subList = dbMap1.subList(0, 2, new HashMap<Long, List<Object>>());
    Assert.assertEquals(2, subList.size());
}
Also used : ColumnSetDBMap(org.talend.dataquality.indicators.mapdb.ColumnSetDBMap) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with ColumnSetDBMap

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

the class ColumnSetDBMapTest method testSubListLongLongMapOfLongListOfObjectDataValidationCase4.

/**
 * Test method for
 * {@link org.talend.dataquality.indicators.mapdb.ColumnSetDBMap#subList(long, long, java.util.Map, org.talend.cwm.indicator.DataValidation)}
 * Case 4 row count case
 */
@Test
public void testSubListLongLongMapOfLongListOfObjectDataValidationCase4() {
    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());
    RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
    List<Object[]> subList = dbMap1.subList(0, 2, new HashMap<Long, List<Object>>(), IDataValidationFactory.INSTANCE.createValidation(rowCountIndicator));
    Assert.assertEquals(2, subList.size());
}
Also used : ColumnSetDBMap(org.talend.dataquality.indicators.mapdb.ColumnSetDBMap) ArrayList(java.util.ArrayList) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with ColumnSetDBMap

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

the class ColumnSetDBMapTest method testSubListLongLongMapOfLongListOfObjectCase3.

/**
 * Test method for {@link org.talend.dataquality.indicators.mapdb.ColumnSetDBMap#subList(long, long, java.util.Map)}
 * Case 3 fromIndex more than toIndex
 */
@Test
public void testSubListLongLongMapOfLongListOfObjectCase3() {
    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());
    List<Object[]> subList = dbMap1.subList(2, 0, null);
    Assert.assertEquals(0, subList.size());
}
Also used : ColumnSetDBMap(org.talend.dataquality.indicators.mapdb.ColumnSetDBMap) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 4 with ColumnSetDBMap

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

the class ColumnSetDBMapTest method testSubListLongLongMapOfLongListOfObjectDataValidationCase2.

/**
 * Test method for
 * {@link org.talend.dataquality.indicators.mapdb.ColumnSetDBMap#subList(long, long, java.util.Map, org.talend.cwm.indicator.DataValidation)}
 * Case 2 duplicate case
 */
@Test
public void testSubListLongLongMapOfLongListOfObjectDataValidationCase2() {
    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());
    DuplicateCountIndicator duplicateCountIndicator = IndicatorsFactory.eINSTANCE.createDuplicateCountIndicator();
    List<Object[]> subList = dbMap1.subList(0, 2, new HashMap<Long, List<Object>>(), IDataValidationFactory.INSTANCE.createValidation(duplicateCountIndicator));
    Assert.assertEquals(1, subList.size());
}
Also used : DuplicateCountIndicator(org.talend.dataquality.indicators.DuplicateCountIndicator) ColumnSetDBMap(org.talend.dataquality.indicators.mapdb.ColumnSetDBMap) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 5 with ColumnSetDBMap

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

the class ColumnSetDBMapTest method testSubListLongLongMapOfLongListOfObjectCase2.

/**
 * Test method for {@link org.talend.dataquality.indicators.mapdb.ColumnSetDBMap#subList(long, long, java.util.Map)}
 * Case 2 indexMap is null
 */
@Test
public void testSubListLongLongMapOfLongListOfObjectCase2() {
    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());
    List<Object[]> subList = dbMap1.subList(0, 2, null);
    Assert.assertEquals(2, subList.size());
}
Also used : ColumnSetDBMap(org.talend.dataquality.indicators.mapdb.ColumnSetDBMap) 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