Skip to content

Commit 257c8dc

Browse files
authored
Merge pull request #234 from shenyunlong/local_hbase_compat_3_2.0
[Test] fix test compile error
2 parents fead4db + a0f324a commit 257c8dc

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

example/simple-hbase-demo/src/main/java/com/oceanbase/example/SimpleHBaseClientDemo.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import com.alipay.oceanbase.hbase.OHTableClient;
2121
import org.apache.hadoop.conf.Configuration;
22+
import org.apache.hadoop.hbase.Cell;
23+
import org.apache.hadoop.hbase.CellUtil;
2224
import org.apache.hadoop.hbase.client.Get;
2325
import org.apache.hadoop.hbase.client.Put;
2426
import org.apache.hadoop.hbase.client.Result;
@@ -49,7 +51,7 @@ public static void simpleTest() throws Exception {
4951
byte[] rowKey = toBytes("rowKey1");
5052
byte[] column = toBytes("column1");
5153
Put put = new Put(rowKey);
52-
put.add(family, column, System.currentTimeMillis(), toBytes("value1"));
54+
put.addColumn(family, column, System.currentTimeMillis(), toBytes("value1"));
5355
hTable.put(put);
5456

5557
// 3. get data like hbase
@@ -58,7 +60,7 @@ public static void simpleTest() throws Exception {
5860
Result r = hTable.get(get);
5961
if (!r.isEmpty()) {
6062
Cell cell = r.rawCells()[0];
61-
System.out.printf("column1: " + CellUtil.cloneQualifier(r));
63+
System.out.printf("column1: " + CellUtil.cloneQualifier(cell));
6264
}
6365

6466
// 4. close

src/test/java/com/alipay/oceanbase/hbase/secondary/OHTableShareStorageSeriesTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static void testGetImpl(String tableName) throws Exception {
7575
long curTs = System.currentTimeMillis();
7676
for (int i = 0; i < recordCount; i++) {
7777
Put put = new Put(toBytes(key + i));
78-
put.add(family.getBytes(), (column + i).getBytes(), curTs, toBytes(value + i));
78+
put.addColumn(family.getBytes(), (column + i).getBytes(), curTs, toBytes(value + i));
7979
hTable.put(put);
8080
}
8181

@@ -107,7 +107,7 @@ public static void testScanImpl(String tableName) throws Exception {
107107
long curTs = System.currentTimeMillis();
108108
for (int i = 0; i < recordCount; i++) {
109109
Put put = new Put(toBytes(key + i));
110-
put.add(family.getBytes(), (column).getBytes(), curTs, toBytes(value + i));
110+
put.addColumn(family.getBytes(), (column).getBytes(), curTs, toBytes(value + i));
111111
hTable.put(put);
112112
}
113113

src/test/java/com/alipay/oceanbase/hbase/secondary/OHTableShareStorageTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static void testGetImpl(String tableName) throws Exception {
8383
long curTs = System.currentTimeMillis();
8484
for (int i = 0; i < recordCount; i++) {
8585
Put put = new Put(toBytes(key + i));
86-
put.add(family.getBytes(), (column + i).getBytes(), curTs, toBytes(value + i));
86+
put.addColumn(family.getBytes(), (column + i).getBytes(), curTs, toBytes(value + i));
8787
hTable.put(put);
8888
}
8989

@@ -119,7 +119,7 @@ public static void testMultiCFGetImpl(Map.Entry<String, List<String>> entry) thr
119119
String family = getColumnFamilyName(tableName);
120120
for (int i = 0; i < recordCount; i++) {
121121
Put put = new Put(toBytes(key + i));
122-
put.add(family.getBytes(), (column + i).getBytes(), curTs, toBytes(value + i));
122+
put.addColumn(family.getBytes(), (column + i).getBytes(), curTs, toBytes(value + i));
123123
hTable.put(put);
124124
}
125125
}
@@ -204,7 +204,7 @@ public static void testBatchGetImpl(String tableName) throws Exception {
204204
long curTs = System.currentTimeMillis();
205205
for (int i = 0; i < recordCount; i++) {
206206
Put put = new Put(toBytes(key + i));
207-
put.add(family.getBytes(), (column + i).getBytes(), curTs, toBytes(value));
207+
put.addColumn(family.getBytes(), (column + i).getBytes(), curTs, toBytes(value));
208208
hTable.put(put);
209209
}
210210

@@ -245,7 +245,7 @@ public static void testScanImpl(String tableName) throws Exception {
245245
long curTs = System.currentTimeMillis();
246246
for (int i = 0; i < recordCount; i++) {
247247
Put put = new Put(toBytes(key + i));
248-
put.add(family.getBytes(), (column).getBytes(), curTs, toBytes(value + i));
248+
put.addColumn(family.getBytes(), (column).getBytes(), curTs, toBytes(value + i));
249249
hTable.put(put);
250250
}
251251

@@ -354,7 +354,7 @@ public static void testMultiCFScanImpl(Map.Entry<String, List<String>> entry) th
354354
String family = getColumnFamilyName(tableName);
355355
for (int i = 0; i < recordCount; i++) {
356356
Put put = new Put(toBytes(key + i));
357-
put.add(family.getBytes(), (column).getBytes(), curTs, toBytes(value));
357+
put.addColumn(family.getBytes(), (column).getBytes(), curTs, toBytes(value));
358358
hTable.put(put);
359359
}
360360
}

0 commit comments

Comments
 (0)