use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class TestThriftHBaseServiceHandlerWithReadOnly method testGetWithReadOnly.
@Test
public void testGetWithReadOnly() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
byte[] rowName = Bytes.toBytes("testGet");
ByteBuffer table = wrap(tableAname);
TGet get = new TGet(wrap(rowName));
boolean exceptionCaught = false;
try {
handler.get(table, get);
} catch (TIOError e) {
exceptionCaught = true;
} finally {
assertFalse(exceptionCaught);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class TestThriftHBaseServiceHandlerWithReadOnly method testExistsAllWithReadOnly.
@Test
public void testExistsAllWithReadOnly() throws TException {
ThriftHBaseServiceHandler handler = createHandler();
byte[] rowName1 = Bytes.toBytes("testExistsAll1");
byte[] rowName2 = Bytes.toBytes("testExistsAll2");
ByteBuffer table = wrap(tableAname);
List<TGet> gets = new ArrayList<>();
gets.add(new TGet(wrap(rowName1)));
gets.add(new TGet(wrap(rowName2)));
boolean exceptionCaught = false;
try {
handler.existsAll(table, gets);
} catch (TIOError e) {
exceptionCaught = true;
} finally {
assertFalse(exceptionCaught);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class TestThriftHBaseServiceHandlerWithReadOnly method testDeleteMultipleWithReadOnly.
@Test
public void testDeleteMultipleWithReadOnly() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
ByteBuffer table = wrap(tableAname);
byte[] rowName1 = Bytes.toBytes("testDeleteMultiple1");
byte[] rowName2 = Bytes.toBytes("testDeleteMultiple2");
List<TDelete> deletes = new ArrayList<>(2);
deletes.add(new TDelete(wrap(rowName1)));
deletes.add(new TDelete(wrap(rowName2)));
boolean exceptionCaught = false;
try {
handler.deleteMultiple(table, deletes);
} catch (TIOError e) {
exceptionCaught = true;
assertTrue(e.getCause() instanceof DoNotRetryIOException);
assertEquals("Thrift Server is in Read-only mode.", e.getMessage());
} finally {
assertTrue(exceptionCaught);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class TestThriftHBaseServiceHandlerWithReadOnly method testGetMultipleWithReadOnly.
@Test
public void testGetMultipleWithReadOnly() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
ByteBuffer table = wrap(tableAname);
byte[] rowName1 = Bytes.toBytes("testGetMultiple1");
byte[] rowName2 = Bytes.toBytes("testGetMultiple2");
List<TGet> gets = new ArrayList<>(2);
gets.add(new TGet(wrap(rowName1)));
gets.add(new TGet(wrap(rowName2)));
boolean exceptionCaught = false;
try {
handler.getMultiple(table, gets);
} catch (TIOError e) {
exceptionCaught = true;
} finally {
assertFalse(exceptionCaught);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class TestThriftHBaseServiceHandlerWithReadOnly method testPutMultipleWithReadOnly.
@Test
public void testPutMultipleWithReadOnly() throws Exception {
ThriftHBaseServiceHandler handler = createHandler();
ByteBuffer table = wrap(tableAname);
byte[] rowName1 = Bytes.toBytes("testPutMultiple1");
byte[] rowName2 = Bytes.toBytes("testPutMultiple2");
List<TColumnValue> columnValues = new ArrayList<>(2);
columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname)));
List<TPut> puts = new ArrayList<>(2);
puts.add(new TPut(wrap(rowName1), columnValues));
puts.add(new TPut(wrap(rowName2), columnValues));
boolean exceptionCaught = false;
try {
handler.putMultiple(table, puts);
} catch (TIOError e) {
exceptionCaught = true;
assertTrue(e.getCause() instanceof DoNotRetryIOException);
assertEquals("Thrift Server is in Read-only mode.", e.getMessage());
} finally {
assertTrue(exceptionCaught);
}
}
Aggregations