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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations