本文整理汇总了Java中org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext类的典型用法代码示例。如果您正苦于以下问题:Java TestContext类的具体用法?Java TestContext怎么用?Java TestContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestContext类属于org.apache.hadoop.hbase.MultithreadedTestUtil包,在下文中一共展示了TestContext类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AtomicityWriter
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicityWriter(TestContext ctx, byte targetRows[][],
byte targetFamilies[][]) throws IOException {
super(ctx);
this.targetRows = targetRows;
this.targetFamilies = targetFamilies;
table = new HTable(ctx.getConf(), TABLE_NAME);
}
示例2: AtomicGetReader
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicGetReader(TestContext ctx, byte targetRow[],
byte targetFamilies[][]) throws IOException {
super(ctx);
this.targetRow = targetRow;
this.targetFamilies = targetFamilies;
table = new HTable(ctx.getConf(), TABLE_NAME);
}
示例3: AtomicScanReader
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicScanReader(TableName TABLE_NAME, TestContext ctx,
byte targetFamilies[][]) throws IOException {
super(ctx);
this.TABLE_NAME = TABLE_NAME;
this.targetFamilies = targetFamilies;
table = new HTable(conf, TABLE_NAME);
}
示例4: testPutAndCheckAndPutInParallel
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
/**
* Test written as a verifier for HBASE-7051, CheckAndPut should properly read
* MVCC.
*
* Moved into TestAtomicOperation from its original location, TestHBase7051
*/
@Test
public void testPutAndCheckAndPutInParallel() throws Exception {
final String tableName = "testPutAndCheckAndPut";
Configuration conf = TEST_UTIL.getConfiguration();
conf.setClass(HConstants.REGION_IMPL, MockHRegion.class, HeapSize.class);
final MockHRegion region = (MockHRegion) TEST_UTIL.createLocalHRegion(Bytes.toBytes(tableName),
null, null, tableName, conf, false, Durability.SYNC_WAL, null, Bytes.toBytes(family));
Put[] puts = new Put[1];
Put put = new Put(Bytes.toBytes("r1"));
put.add(Bytes.toBytes(family), Bytes.toBytes("q1"), Bytes.toBytes("10"));
puts[0] = put;
region.batchMutate(puts, HConstants.NO_NONCE, HConstants.NO_NONCE);
MultithreadedTestUtil.TestContext ctx =
new MultithreadedTestUtil.TestContext(conf);
ctx.addThread(new PutThread(ctx, region));
ctx.addThread(new CheckAndPutThread(ctx, region));
ctx.startThreads();
while (testStep != TestStep.CHECKANDPUT_COMPLETED) {
Thread.sleep(100);
}
ctx.stop();
Scan s = new Scan();
RegionScanner scanner = region.getScanner(s);
List<Cell> results = new ArrayList<Cell>();
ScannerContext scannerContext = ScannerContext.newBuilder().setBatchLimit(2).build();
scanner.next(results, scannerContext);
for (Cell keyValue : results) {
assertEquals("50",Bytes.toString(CellUtil.cloneValue(keyValue)));
}
}
示例5: AtomicScanReader
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicScanReader(String TABLE_NAME, TestContext ctx,
byte targetFamilies[][]) throws IOException {
super(ctx);
this.TABLE_NAME = TABLE_NAME;
this.targetFamilies = targetFamilies;
table = new HTable(conf, TABLE_NAME);
}
示例6: testPutAndCheckAndPutInParallel
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
@Test
public void testPutAndCheckAndPutInParallel() throws Exception {
final String tableName = "testPutAndCheckAndPut";
Configuration conf = HBaseConfiguration.create();
conf.setClass(HConstants.REGION_IMPL, MockHRegion.class, HeapSize.class);
final MockHRegion region = (MockHRegion) TestHRegion.initHRegion(Bytes.toBytes(tableName),
tableName, conf, Bytes.toBytes(family));
List<Pair<Mutation, Integer>> putsAndLocks = Lists.newArrayList();
Put[] puts = new Put[1];
Put put = new Put(Bytes.toBytes("r1"));
put.add(Bytes.toBytes(family), Bytes.toBytes("q1"), Bytes.toBytes("10"));
puts[0] = put;
Pair<Mutation, Integer> pair = new Pair<Mutation, Integer>(puts[0], null);
putsAndLocks.add(pair);
region.batchMutate(putsAndLocks.toArray(new Pair[0]));
MultithreadedTestUtil.TestContext ctx =
new MultithreadedTestUtil.TestContext(conf);
ctx.addThread(new PutThread(ctx, region));
ctx.addThread(new CheckAndPutThread(ctx, region));
ctx.startThreads();
while (testStep != TestStep.CHECKANDPUT_COMPLETED) {
Thread.sleep(100);
}
ctx.stop();
Scan s = new Scan();
RegionScanner scanner = region.getScanner(s);
List<KeyValue> results = new ArrayList<KeyValue>();
scanner.next(results, 2);
for (KeyValue keyValue : results) {
assertEquals("50",Bytes.toString(keyValue.getValue()));
}
}
示例7: testPutAndCheckAndPutInParallel
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
/**
* Test written as a verifier for HBASE-7051, CheckAndPut should properly read
* MVCC.
*
* Moved into TestAtomicOperation from its original location, TestHBase7051
*/
@Test
public void testPutAndCheckAndPutInParallel() throws Exception {
final String tableName = "testPutAndCheckAndPut";
Configuration conf = TEST_UTIL.getConfiguration();
conf.setClass(HConstants.REGION_IMPL, MockHRegion.class, HeapSize.class);
final MockHRegion region = (MockHRegion) TEST_UTIL.createLocalHRegion(Bytes.toBytes(tableName),
null, null, tableName, conf, false, Durability.SYNC_WAL, null, Bytes.toBytes(family));
Put[] puts = new Put[1];
Put put = new Put(Bytes.toBytes("r1"));
put.add(Bytes.toBytes(family), Bytes.toBytes("q1"), Bytes.toBytes("10"));
puts[0] = put;
region.batchMutate(puts);
MultithreadedTestUtil.TestContext ctx =
new MultithreadedTestUtil.TestContext(conf);
ctx.addThread(new PutThread(ctx, region));
ctx.addThread(new CheckAndPutThread(ctx, region));
ctx.startThreads();
while (testStep != TestStep.CHECKANDPUT_COMPLETED) {
Thread.sleep(100);
}
ctx.stop();
Scan s = new Scan();
RegionScanner scanner = region.getScanner(s);
List<Cell> results = new ArrayList<Cell>();
scanner.next(results, 2);
for (Cell keyValue : results) {
assertEquals("50",Bytes.toString(CellUtil.cloneValue(keyValue)));
}
}
示例8: AtomicityWriter
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicityWriter(TestContext ctx, byte targetRows[][], byte targetFamilies[][])
throws IOException {
super(ctx);
this.targetRows = targetRows;
this.targetFamilies = targetFamilies;
table = new HTable(ctx.getConf(), TABLE_NAME);
}
示例9: AtomicGetReader
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicGetReader(TestContext ctx, byte targetRow[], byte targetFamilies[][])
throws IOException {
super(ctx);
this.targetRow = targetRow;
this.targetFamilies = targetFamilies;
table = new HTable(ctx.getConf(), TABLE_NAME);
}
示例10: AtomicityWriter
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicityWriter(TestContext ctx, byte[][] targetRows, byte[][] targetFamilies,
ExecutorService pool) throws IOException {
super(ctx);
this.targetRows = targetRows;
this.targetFamilies = targetFamilies;
connection = ConnectionFactory.createConnection(ctx.getConf(), pool);
table = connection.getTable(TABLE_NAME);
}
示例11: AtomicGetReader
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicGetReader(TestContext ctx, byte[] targetRow, byte[][] targetFamilies,
ExecutorService pool) throws IOException {
super(ctx);
this.targetRow = targetRow;
this.targetFamilies = targetFamilies;
connection = ConnectionFactory.createConnection(ctx.getConf(), pool);
table = connection.getTable(TABLE_NAME);
}
示例12: AtomicScanReader
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicScanReader(TestContext ctx, byte[][] targetFamilies, ExecutorService pool)
throws IOException {
super(ctx);
this.targetFamilies = targetFamilies;
connection = ConnectionFactory.createConnection(ctx.getConf(), pool);
table = connection.getTable(TABLE_NAME);
}
示例13: AtomicScanReader
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
public AtomicScanReader(TableName TABLE_NAME, TestContext ctx,
byte targetFamilies[][]) throws IOException {
super(ctx);
this.TABLE_NAME = TABLE_NAME;
this.targetFamilies = targetFamilies;
table = UTIL.getConnection().getTable(TABLE_NAME);
}
示例14: testPutAndCheckAndPutInParallel
import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; //导入依赖的package包/类
/**
* Test written as a verifier for HBASE-7051, CheckAndPut should properly read
* MVCC.
*
* Moved into TestAtomicOperation from its original location, TestHBase7051
*/
@Test
public void testPutAndCheckAndPutInParallel() throws Exception {
Configuration conf = TEST_UTIL.getConfiguration();
conf.setClass(HConstants.REGION_IMPL, MockHRegion.class, HeapSize.class);
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(name.getMethodName()))
.addFamily(new HColumnDescriptor(family));
this.region = TEST_UTIL.createLocalHRegion(htd, null, null);
Put[] puts = new Put[1];
Put put = new Put(Bytes.toBytes("r1"));
put.addColumn(Bytes.toBytes(family), Bytes.toBytes("q1"), Bytes.toBytes("10"));
puts[0] = put;
region.batchMutate(puts, HConstants.NO_NONCE, HConstants.NO_NONCE);
MultithreadedTestUtil.TestContext ctx =
new MultithreadedTestUtil.TestContext(conf);
ctx.addThread(new PutThread(ctx, region));
ctx.addThread(new CheckAndPutThread(ctx, region));
ctx.startThreads();
while (testStep != TestStep.CHECKANDPUT_COMPLETED) {
Thread.sleep(100);
}
ctx.stop();
Scan s = new Scan();
RegionScanner scanner = region.getScanner(s);
List<Cell> results = new ArrayList<>();
ScannerContext scannerContext = ScannerContext.newBuilder().setBatchLimit(2).build();
scanner.next(results, scannerContext);
for (Cell keyValue : results) {
assertEquals("50",Bytes.toString(CellUtil.cloneValue(keyValue)));
}
}