Search in sources :

Example 61 with TableName

use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.

the class BaseBigtableDataClientTest method checkAndMutateRowExceptionTest4.

@Test
public void checkAndMutateRowExceptionTest4() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
    mockBigtable.addException(exception);
    try {
        String tableName = "tableName-1988717703";
        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.
    }
}
Also used : RowFilter(com.google.bigtable.v2.RowFilter) InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) ByteString(com.google.protobuf.ByteString) StatusRuntimeException(io.grpc.StatusRuntimeException) ArrayList(java.util.ArrayList) ByteString(com.google.protobuf.ByteString) Mutation(com.google.bigtable.v2.Mutation) Test(org.junit.Test)

Example 62 with TableName

use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.

the class SyncCheckAndMutateRowStringBytestringRowfilterListmutationListmutationString method syncCheckAndMutateRowStringBytestringRowfilterListmutationListmutationString.

public static void syncCheckAndMutateRowStringBytestringRowfilterListmutationListmutationString() 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<>();
        String appProfileId = "appProfileId704923523";
        CheckAndMutateRowResponse response = baseBigtableDataClient.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations, appProfileId);
    }
}
Also used : RowFilter(com.google.bigtable.v2.RowFilter) ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) CheckAndMutateRowResponse(com.google.bigtable.v2.CheckAndMutateRowResponse) ByteString(com.google.protobuf.ByteString) Mutation(com.google.bigtable.v2.Mutation) BaseBigtableDataClient(com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)

Example 63 with TableName

use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.

the class SyncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutation method syncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutation.

public static void syncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutation() 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;
        RowFilter predicateFilter = RowFilter.newBuilder().build();
        List<Mutation> trueMutations = new ArrayList<>();
        List<Mutation> falseMutations = new ArrayList<>();
        CheckAndMutateRowResponse response = baseBigtableDataClient.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations);
    }
}
Also used : TableName(com.google.bigtable.v2.TableName) RowFilter(com.google.bigtable.v2.RowFilter) ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) CheckAndMutateRowResponse(com.google.bigtable.v2.CheckAndMutateRowResponse) Mutation(com.google.bigtable.v2.Mutation) BaseBigtableDataClient(com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)

Example 64 with TableName

use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.

the class SyncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutationString method syncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutationString.

public static void syncCheckAndMutateRowTablenameBytestringRowfilterListmutationListmutationString() 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;
        RowFilter predicateFilter = RowFilter.newBuilder().build();
        List<Mutation> trueMutations = new ArrayList<>();
        List<Mutation> falseMutations = new ArrayList<>();
        String appProfileId = "appProfileId704923523";
        CheckAndMutateRowResponse response = baseBigtableDataClient.checkAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations, appProfileId);
    }
}
Also used : TableName(com.google.bigtable.v2.TableName) RowFilter(com.google.bigtable.v2.RowFilter) ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) CheckAndMutateRowResponse(com.google.bigtable.v2.CheckAndMutateRowResponse) Mutation(com.google.bigtable.v2.Mutation) ByteString(com.google.protobuf.ByteString) BaseBigtableDataClient(com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)

Example 65 with TableName

use of com.google.bigtable.v2.TableName in project gapic-generator-java by googleapis.

the class SyncMutateRowTablenameBytestringListmutation method syncMutateRowTablenameBytestringListmutation.

public static void syncMutateRowTablenameBytestringListmutation() 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<>();
        MutateRowResponse response = baseBigtableDataClient.mutateRow(tableName, rowKey, mutations);
    }
}
Also used : TableName(com.google.bigtable.v2.TableName) MutateRowResponse(com.google.bigtable.v2.MutateRowResponse) ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) Mutation(com.google.bigtable.v2.Mutation) BaseBigtableDataClient(com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)

Aggregations

ByteString (com.google.protobuf.ByteString)48 Test (org.junit.Test)46 ArrayList (java.util.ArrayList)39 Mutation (com.google.bigtable.v2.Mutation)25 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)19 AbstractMessage (com.google.protobuf.AbstractMessage)19 StatusRuntimeException (io.grpc.StatusRuntimeException)19 TableName (com.google.bigtable.v2.TableName)18 TableName (com.google.bigtable.admin.v2.TableName)17 CheckAndMutateRowResponse (com.google.bigtable.v2.CheckAndMutateRowResponse)12 ReadModifyWriteRule (com.google.bigtable.v2.ReadModifyWriteRule)12 RowFilter (com.google.bigtable.v2.RowFilter)12 BaseBigtableDataClient (com.google.cloud.bigtable.data.v2.BaseBigtableDataClient)12 JSONArray (org.json.JSONArray)9 JSONObject (org.json.JSONObject)9 CheckAndMutateRowRequest (com.google.bigtable.v2.CheckAndMutateRowRequest)8 MutateRowResponse (com.google.bigtable.v2.MutateRowResponse)8 ReadModifyWriteRowResponse (com.google.bigtable.v2.ReadModifyWriteRowResponse)8 ExecutionException (java.util.concurrent.ExecutionException)8 TableName (com.google.cloud.bigquery.storage.v1.TableName)7