@Test public void testCheckAndMutateWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); ByteBuffer table = wrap(tableAname); ByteBuffer row = wrap(Bytes.toBytes("row")); ByteBuffer family = wrap(familyAname); ByteBuffer qualifier = wrap(qualifierAname); ByteBuffer value = wrap(valueAname); List<TColumnValue> columnValuesB = new ArrayList<>(1); TColumnValue columnValueB = new TColumnValue(family, wrap(qualifierBname), wrap(valueBname)); columnValuesB.add(columnValueB); TPut putB = new TPut(row, columnValuesB); putB.setColumnValues(columnValuesB); TRowMutations tRowMutations = new TRowMutations(row, Arrays.<TMutation> asList(TMutation.put(putB))); boolean exceptionCaught = false; try { handler.checkAndMutate(table, row, family, qualifier, TCompareOp.EQUAL, value, tRowMutations); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
@Test public void testMutateRowWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testMutateRow"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValuesA = new ArrayList<>(1); TColumnValue columnValueA = new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)); columnValuesA.add(columnValueA); TPut putA = new TPut(wrap(rowName), columnValuesA); putA.setColumnValues(columnValuesA); TDelete delete = new TDelete(wrap(rowName)); List<TMutation> mutations = new ArrayList<>(2); TMutation mutationA = TMutation.put(putA); mutations.add(mutationA); TMutation mutationB = TMutation.deleteSingle(delete); mutations.add(mutationB); TRowMutations tRowMutations = new TRowMutations(wrap(rowName),mutations); boolean exceptionCaught = false; try { handler.mutateRow(table,tRowMutations); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
TMutation mutationA = TMutation.put(putB); mutations.add(mutationA);
Arrays.<TMutation> asList(TMutation.put(putB)));
@Test public void testCheckAndMutateWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); ByteBuffer table = wrap(tableAname); ByteBuffer row = wrap(Bytes.toBytes("row")); ByteBuffer family = wrap(familyAname); ByteBuffer qualifier = wrap(qualifierAname); ByteBuffer value = wrap(valueAname); List<TColumnValue> columnValuesB = new ArrayList<>(1); TColumnValue columnValueB = new TColumnValue(family, wrap(qualifierBname), wrap(valueBname)); columnValuesB.add(columnValueB); TPut putB = new TPut(row, columnValuesB); putB.setColumnValues(columnValuesB); TRowMutations tRowMutations = new TRowMutations(row, Arrays.<TMutation> asList(TMutation.put(putB))); boolean exceptionCaught = false; try { handler.checkAndMutate(table, row, family, qualifier, TCompareOp.EQUAL, value, tRowMutations); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
@Test public void testCheckAndMutateWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); ByteBuffer table = wrap(tableAname); ByteBuffer row = wrap(Bytes.toBytes("row")); ByteBuffer family = wrap(familyAname); ByteBuffer qualifier = wrap(qualifierAname); ByteBuffer value = wrap(valueAname); List<TColumnValue> columnValuesB = new ArrayList<>(1); TColumnValue columnValueB = new TColumnValue(family, wrap(qualifierBname), wrap(valueBname)); columnValuesB.add(columnValueB); TPut putB = new TPut(row, columnValuesB); putB.setColumnValues(columnValuesB); TRowMutations tRowMutations = new TRowMutations(row, Arrays.<TMutation> asList(TMutation.put(putB))); boolean exceptionCaught = false; try { handler.checkAndMutate(table, row, family, qualifier, TCompareOp.EQUAL, value, tRowMutations); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
@Test public void testMutateRowWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testMutateRow"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValuesA = new ArrayList<>(1); TColumnValue columnValueA = new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)); columnValuesA.add(columnValueA); TPut putA = new TPut(wrap(rowName), columnValuesA); putA.setColumnValues(columnValuesA); TDelete delete = new TDelete(wrap(rowName)); List<TMutation> mutations = new ArrayList<>(2); TMutation mutationA = TMutation.put(putA); mutations.add(mutationA); TMutation mutationB = TMutation.deleteSingle(delete); mutations.add(mutationB); TRowMutations tRowMutations = new TRowMutations(wrap(rowName),mutations); boolean exceptionCaught = false; try { handler.mutateRow(table,tRowMutations); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
@Test public void testMutateRowWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testMutateRow"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValuesA = new ArrayList<>(1); TColumnValue columnValueA = new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)); columnValuesA.add(columnValueA); TPut putA = new TPut(wrap(rowName), columnValuesA); putA.setColumnValues(columnValuesA); TDelete delete = new TDelete(wrap(rowName)); List<TMutation> mutations = new ArrayList<>(2); TMutation mutationA = TMutation.put(putA); mutations.add(mutationA); TMutation mutationB = TMutation.deleteSingle(delete); mutations.add(mutationB); TRowMutations tRowMutations = new TRowMutations(wrap(rowName),mutations); boolean exceptionCaught = false; try { handler.mutateRow(table,tRowMutations); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
TMutation mutationA = TMutation.put(putB); mutations.add(mutationA);
TMutation mutationA = TMutation.put(putB); mutations.add(mutationA);
Arrays.<TMutation> asList(TMutation.put(putB)));
Arrays.<TMutation> asList(TMutation.put(putB)));