use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.
the class EncodedColumnQualifierCellsListTest method testGetIndex.
@Test
public void testGetIndex() throws Exception {
EncodedColumnQualiferCellsList list = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
Cell[] cells = new Cell[7];
populateListAndArray(list, cells);
for (int i = 0; i < cells.length; i++) {
assertEquals(cells[i], list.get(i));
}
}
use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.
the class EncodedColumnQualifierCellsListTest method testSize.
@Test
public void testSize() {
EncodedColumnQualiferCellsList list = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
assertEquals(0, list.size());
populateList(list);
assertEquals(7, list.size());
int originalSize = list.size();
Iterator itr = list.iterator();
while (itr.hasNext()) {
itr.next();
itr.remove();
assertEquals(--originalSize, list.size());
}
}
use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.
the class EncodedColumnQualifierCellsListTest method testFailFastIterator.
@Test
public void testFailFastIterator() throws Exception {
EncodedColumnQualiferCellsList list = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
populateList(list);
int i = 0;
Iterator<Cell> itr = list.iterator();
while (itr.hasNext()) {
i++;
try {
itr.next();
list.add(KeyValue.createFirstOnRow(row, cf, FOUR_BYTE_QUALIFIERS.encode(0)));
if (i == 2) {
fail("ConcurrentModificationException should have been thrown as the list is being modified while being iterated through");
}
} catch (ConcurrentModificationException expected) {
assertEquals("Exception should have been thrown when getting the second element", 2, i);
break;
}
}
}
use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.
the class EncodedColumnQualifierCellsListTest method testToArrayWithoutParam.
@Test
public void testToArrayWithoutParam() throws Exception {
EncodedColumnQualiferCellsList list = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
Cell[] cells = new Cell[7];
populateListAndArray(list, cells);
Object[] array = list.toArray();
assertTrue(Arrays.equals(cells, array));
}
use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.
the class EncodedColumnQualifierCellsListTest method testRetainAll.
@Test
public void testRetainAll() throws Exception {
EncodedColumnQualiferCellsList list1 = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
populateList(list1);
EncodedColumnQualiferCellsList list2 = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
populateList(list2);
// retainAll won't be modifying the list1 since they both have the same elements equality wise
assertFalse(list1.retainAll(list2));
list2.remove(KeyValue.createFirstOnRow(row, cf, FOUR_BYTE_QUALIFIERS.encode(12)));
assertTrue(list1.retainAll(list2));
assertEquals(list1.size(), list2.size());
for (Cell c : list1) {
assertTrue(list2.contains(c));
}
}
Aggregations