use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.
the class BaseBigtableDataClientTest method checkAndMutateRowExceptionTest3.
@Test
public void checkAndMutateRowExceptionTest3() 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;
RowFilter predicateFilter = RowFilter.newBuilder().build();
List<Mutation> trueMutations = new ArrayList<>();
List<Mutation> falseMutations = new ArrayList<>();
String appProfileId = "appProfileId704923523";
client.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations, appProfileId);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.
the class BaseBigtableDataClientTest method readModifyWriteRowTest4.
@Test
public void readModifyWriteRowTest4() throws Exception {
ReadModifyWriteRowResponse expectedResponse = ReadModifyWriteRowResponse.newBuilder().setRow(Row.newBuilder().build()).build();
mockBigtable.addResponse(expectedResponse);
String tableName = "tableName-1988717703";
ByteString rowKey = ByteString.EMPTY;
List<ReadModifyWriteRule> rules = new ArrayList<>();
String appProfileId = "appProfileId704923523";
ReadModifyWriteRowResponse actualResponse = client.readModifyWriteRow(tableName, rowKey, rules, appProfileId);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockBigtable.getRequests();
Assert.assertEquals(1, actualRequests.size());
ReadModifyWriteRowRequest actualRequest = ((ReadModifyWriteRowRequest) actualRequests.get(0));
Assert.assertEquals(tableName, actualRequest.getTableName());
Assert.assertEquals(rowKey, actualRequest.getRowKey());
Assert.assertEquals(rules, actualRequest.getRulesList());
Assert.assertEquals(appProfileId, actualRequest.getAppProfileId());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.
the class BaseBigtableDataClientTest method readModifyWriteRowExceptionTest2.
@Test
public void readModifyWriteRowExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockBigtable.addException(exception);
try {
String tableName = "tableName-1988717703";
ByteString rowKey = ByteString.EMPTY;
List<ReadModifyWriteRule> rules = new ArrayList<>();
client.readModifyWriteRow(tableName, rowKey, rules);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.
the class SyncCheckAndMutateRowStringBytestringRowfilterListmutationListmutation method syncCheckAndMutateRowStringBytestringRowfilterListmutationListmutation.
public static void syncCheckAndMutateRowStringBytestringRowfilterListmutationListmutation() throws Exception {
// It may require modifications to work in your environment.
try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
String tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
ByteString rowKey = ByteString.EMPTY;
RowFilter predicateFilter = RowFilter.newBuilder().build();
List<Mutation> trueMutations = new ArrayList<>();
List<Mutation> falseMutations = new ArrayList<>();
CheckAndMutateRowResponse response = baseBigtableDataClient.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations);
}
}
use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.
the class SyncMutateRowStringBytestringListmutation method syncMutateRowStringBytestringListmutation.
public static void syncMutateRowStringBytestringListmutation() throws Exception {
// It may require modifications to work in your environment.
try (BaseBigtableDataClient baseBigtableDataClient = BaseBigtableDataClient.create()) {
String tableName = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
ByteString rowKey = ByteString.EMPTY;
List<Mutation> mutations = new ArrayList<>();
MutateRowResponse response = baseBigtableDataClient.mutateRow(tableName, rowKey, mutations);
}
}
Aggregations