Skip to content

Commit 82bb60f

Browse files
rahulKQLsduskis
authored andcommitted
Upgraded hbase to 1.9.0 (#311)
- Updated bigtable-hbase-1.x to 1.9.0. - Added more formatted terminal comments. - Standardized projectID argument for Integration Test.
1 parent 25f01ed commit 82bb60f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

bigtable/hbase/snippets/src/main/java/com/example/cloud/bigtable/quickstart/Quickstart.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,25 @@ public static void main(String... args) {
4444
// Use try-with-resources to make sure the connection is closed correctly
4545
try (Connection connection = BigtableConfiguration.connect(projectId, instanceId)) {
4646

47+
System.out.println("--- Connection established with Bigtable Instance ---");
4748
// Create a connection to the table that already exists
4849
// Use try-with-resources to make sure the connection to the table is closed correctly
4950
try (Table table = connection.getTable(TableName.valueOf(tableId))) {
5051

5152
// Read a row
5253
String rowKey = "r1";
54+
System.out.printf("--- Reading for row-key: %s for provided table: %s ---\n",
55+
rowKey, tableId);
5356

5457
// Retrieve the result
5558
Result result = table.get(new Get(Bytes.toBytes(rowKey)));
5659

5760
// Convert row data to string
5861
String rowValue = Bytes.toString(result.value());
5962

60-
System.out.printf("Row r1: %s", rowValue);
63+
System.out.printf("Scanned value for Row r1: %s \n", rowValue);
64+
65+
System.out.println(" --- Finished reading row --- ");
6166

6267
} catch (IOException e) {
6368
// handle exception while connecting to a table

bigtable/hbase/snippets/src/test/java/com/example/cloud/bigtable/quickstart/it/QuickstartIT.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@
4545
@SuppressWarnings("checkstyle:abbreviationaswordinname")
4646
public class QuickstartIT {
4747

48-
private final String instanceId = System.getProperty("bigtable.test.instance");
48+
// provide your project id as an env var
49+
private final String projectId = System.getProperty("bigtable.test.projectID");
50+
private final String instanceId = System.getProperty("bigtable.test.instanceID");
51+
4952
private final String tableId = formatForTest("my-table");
5053
private final String columnFamilyName = "my-column-family";
5154
private final String columnName = "my-column";
5255
private final String data = "my-data";
5356

54-
// provide your project id as an env var
55-
private final String projectId = System.getenv("GOOGLE_CLOUD_PROJECT");
5657

5758
private String formatForTest(String name) {
5859
return name + "-" + UUID.randomUUID().toString().substring(0, 20);

0 commit comments

Comments
 (0)