@Override public Type getType() { return cell.getType(); }
@Test public void testGetType() throws IOException { Cell c = Mockito.mock(Cell.class); Mockito.when(c.getType()).thenCallRealMethod(); for (Cell.Type type : Cell.Type.values()) { Mockito.when(c.getTypeByte()).thenReturn(type.getCode()); assertEquals(type, c.getType()); } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Maximum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Minimum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } }
@Test public void testGetType() throws IOException { Cell c = Mockito.mock(Cell.class); Mockito.when(c.getType()).thenCallRealMethod(); for (Cell.Type type : Cell.Type.values()) { Mockito.when(c.getTypeByte()).thenReturn(type.getCode()); assertEquals(type, c.getType()); } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Maximum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Minimum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } }
TColumn column = new TColumn(ByteBuffer.wrap(familyEntry.getKey())); for (Cell cell: familyEntry.getValue()) { TDeleteType cellDeleteType = deleteTypeFromHBase(cell.getType()); if (type == null) { type = cellDeleteType;
@Test public void testGetType() throws IOException { Cell c = Mockito.mock(Cell.class); Mockito.when(c.getType()).thenCallRealMethod(); for (Cell.Type type : Cell.Type.values()) { Mockito.when(c.getTypeByte()).thenReturn(type.getCode()); assertEquals(type, c.getType()); } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Maximum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Minimum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } }
columnValue.setFamily(family) .setQualifier(CellUtil.cloneQualifier(cell)) .setType(cell.getType().getCode()) .setTimestamp(cell.getTimestamp()) .setValue(CellUtil.cloneValue(cell));
columnValue.setFamily(family) .setQualifier(CellUtil.cloneQualifier(cell)) .setType(cell.getType().getCode()) .setTimestamp(cell.getTimestamp()) .setValue(CellUtil.cloneValue(cell));
@Override public Type getType() { return cell.getType(); } };
@Override public Type getType() { return cell.getType(); }
col.setTimestamp(kv.getTimestamp()); col.setValue(CellUtil.cloneValue(kv)); col.setType(kv.getType().getCode()); if (kv.getTagsLength() > 0) { col.setTags(PrivateCellUtil.cloneTags(kv));
@Override public Type getType() { return delegate.getType(); } }
private Cell newCellWithNotExistColumnFamily(Cell cell) { return ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY) .setRow(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()) .setFamily(CF_NOT_EXIST_BYTES, 0, CF_NOT_EXIST_BYTES.length) .setQualifier(CellUtil.cloneQualifier(cell)).setTimestamp(cell.getTimestamp()) .setType(cell.getType().getCode()).setValue(CellUtil.cloneValue(cell)).build(); }
private Cell newCellWithDifferentColumnFamily(Cell cell) { return ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY) .setRow(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()) .setFamily(CF2_BYTES, 0, CF2_BYTES.length).setQualifier(CellUtil.cloneQualifier(cell)) .setTimestamp(cell.getTimestamp()).setType(cell.getType().getCode()) .setValue(CellUtil.cloneValue(cell)).build(); }
public static void mutatePutValue(Put somePut, byte[] family, byte[] qualifier, byte[] newValue) { NavigableMap<byte[], List<Cell>> familyCellMap = somePut.getFamilyCellMap(); List<Cell> cells = familyCellMap.get(family); List<Cell> newCells = Lists.newArrayList(); if (cells != null) { for (Cell cell : cells) { if (Bytes.compareTo(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength(), qualifier, 0, qualifier.length) == 0) { Cell replacementCell = new KeyValue(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength(), cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength(), cell.getTimestamp(), KeyValue.Type.codeToType(cell.getType().getCode()), newValue, 0, newValue.length); newCells.add(replacementCell); } else { newCells.add(cell); } } familyCellMap.put(family, newCells); } }
@Override public Type getType() { return cell.getType(); } };
@Override public Type getType() { return cell.getType(); } };
@Override public Type getType() { return cell.getType(); }
cell.getValueLength()) .setTimestamp(cell.getTimestamp()) .setType(cell.getType()) .setTags(TagUtil.concatTags(tagArray, cell)) .build();
VIEW_STATEMENT_BYTES, 0, VIEW_STATEMENT_BYTES.length, cell.getTimestamp(), viewStatement, 0, viewStatement.length, cell.getType()); cells.add(viewStatementCell); cell.getFamilyOffset(), cell.getFamilyLength(), VIEW_CONSTANT_BYTES, 0, VIEW_CONSTANT_BYTES.length, cell.getTimestamp(), bytes, 0, bytes.length, cell.getType()); cells.add(viewConstantCell); cell.getFamilyLength(), VIEW_INDEX_ID_BYTES, 0, VIEW_INDEX_ID_BYTES.length, cell.getTimestamp(), bytes, 0, bytes.length, cell.getType()); cells.add(indexIdCell); indexId = seqValue;
public static void mutatePutValue(Put somePut, byte[] family, byte[] qualifier, byte[] newValue) { NavigableMap<byte[], List<Cell>> familyCellMap = somePut.getFamilyCellMap(); List<Cell> cells = familyCellMap.get(family); List<Cell> newCells = Lists.newArrayList(); if (cells != null) { for (Cell cell : cells) { if (Bytes.compareTo(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength(), qualifier, 0, qualifier.length) == 0) { Cell replacementCell = new KeyValue(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength(), cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength(), cell.getTimestamp(), KeyValue.Type.codeToType(cell.getType().getCode()), newValue, 0, newValue.length); newCells.add(replacementCell); } else { newCells.add(cell); } } familyCellMap.put(family, newCells); } }