use of com.google.cloud.bigquery.storage.v1.TableName in project gapic-generator-java by googleapis.
the class BaseBigtableDataClientTest method mutateRowExceptionTest.
@Test
public void mutateRowExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockBigtable.addException(exception);
try {
TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
ByteString rowKey = ByteString.EMPTY;
List<Mutation> mutations = new ArrayList<>();
client.mutateRow(tableName, rowKey, mutations);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.cloud.bigquery.storage.v1.TableName in project gapic-generator-java by googleapis.
the class SyncMutateRowTablenameBytestringListmutationString method syncMutateRowTablenameBytestringListmutationString.
public static void syncMutateRowTablenameBytestringListmutationString() throws Exception {
// It may require modifications to work in your environment.
try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
ByteString rowKey = ByteString.EMPTY;
List<Mutation> mutations = new ArrayList<>();
String appProfileId = "appProfileId704923523";
MutateRowResponse response = baseBigtableDataClient.mutateRow(tableName, rowKey, mutations, appProfileId);
}
}
use of com.google.cloud.bigquery.storage.v1.TableName in project gapic-generator-java by googleapis.
the class SyncReadModifyWriteRowTablenameBytestringListreadmodifywriterule method syncReadModifyWriteRowTablenameBytestringListreadmodifywriterule.
public static void syncReadModifyWriteRowTablenameBytestringListreadmodifywriterule() throws Exception {
// It may require modifications to work in your environment.
try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
ByteString rowKey = ByteString.EMPTY;
List<ReadModifyWriteRule> rules = new ArrayList<>();
ReadModifyWriteRowResponse response = baseBigtableDataClient.readModifyWriteRow(tableName, rowKey, rules);
}
}
use of com.google.cloud.bigquery.storage.v1.TableName in project gapic-generator-java by googleapis.
the class SyncReadModifyWriteRowTablenameBytestringListreadmodifywriteruleString method syncReadModifyWriteRowTablenameBytestringListreadmodifywriteruleString.
public static void syncReadModifyWriteRowTablenameBytestringListreadmodifywriteruleString() throws Exception {
// It may require modifications to work in your environment.
try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
ByteString rowKey = ByteString.EMPTY;
List<ReadModifyWriteRule> rules = new ArrayList<>();
String appProfileId = "appProfileId704923523";
ReadModifyWriteRowResponse response = baseBigtableDataClient.readModifyWriteRow(tableName, rowKey, rules, appProfileId);
}
}
use of com.google.cloud.bigquery.storage.v1.TableName in project gapic-generator-java by googleapis.
the class BaseBigtableDataClientTest method checkAndMutateRowTest.
@Test
public void checkAndMutateRowTest() throws Exception {
CheckAndMutateRowResponse expectedResponse = CheckAndMutateRowResponse.newBuilder().setPredicateMatched(true).build();
mockBigtable.addResponse(expectedResponse);
TableName tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
ByteString rowKey = ByteString.EMPTY;
RowFilter predicateFilter = RowFilter.newBuilder().build();
List<Mutation> trueMutations = new ArrayList<>();
List<Mutation> falseMutations = new ArrayList<>();
CheckAndMutateRowResponse actualResponse = client.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockBigtable.getRequests();
Assert.assertEquals(1, actualRequests.size());
CheckAndMutateRowRequest actualRequest = ((CheckAndMutateRowRequest) actualRequests.get(0));
Assert.assertEquals(tableName.toString(), actualRequest.getTableName());
Assert.assertEquals(rowKey, actualRequest.getRowKey());
Assert.assertEquals(predicateFilter, actualRequest.getPredicateFilter());
Assert.assertEquals(trueMutations, actualRequest.getTrueMutationsList());
Assert.assertEquals(falseMutations, actualRequest.getFalseMutationsList());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations