Skip to content

Commit

Permalink
Run formatter
Browse files Browse the repository at this point in the history
Change-Id: Ieb04b2141c8843ff59cc4d756d736b4c00609ee2
  • Loading branch information
djyau committed Oct 14, 2024
1 parent fecd6ea commit 7ba35f8
Showing 1 changed file with 31 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import com.google.protobuf.FieldMask;
import io.grpc.Status;
import io.grpc.Status.Code;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -1138,48 +1137,47 @@ public void testCreateAppProfileAddRowAffinityAddSetOfClusterIds() {
Mockito.when(mockStub.createAppProfileCallable()).thenReturn(mockCreateAppProfileCallable);

com.google.bigtable.admin.v2.CreateAppProfileRequest expectedRequest =
com.google.bigtable.admin.v2.CreateAppProfileRequest.newBuilder()
.setParent(NameUtil.formatInstanceName(PROJECT_ID, INSTANCE_ID))
.setAppProfileId(APP_PROFILE_ID)
.setAppProfile(
com.google.bigtable.admin.v2.AppProfile.newBuilder()
.setDescription("my description")
.setMultiClusterRoutingUseAny(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
.newBuilder()
.addClusterIds("cluster-id-1")
.addClusterIds("cluster-id-2")
.setRowAffinity(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
.RowAffinity.getDefaultInstance())))
.build();

com.google.bigtable.admin.v2.AppProfile expectedResponse =
com.google.bigtable.admin.v2.AppProfile.newBuilder()
.setName(APP_PROFILE_NAME)
com.google.bigtable.admin.v2.CreateAppProfileRequest.newBuilder()
.setParent(NameUtil.formatInstanceName(PROJECT_ID, INSTANCE_ID))
.setAppProfileId(APP_PROFILE_ID)
.setAppProfile(
com.google.bigtable.admin.v2.AppProfile.newBuilder()
.setDescription("my description")
.setMultiClusterRoutingUseAny(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.newBuilder()
.addClusterIds("cluster-id-1")
.addClusterIds("cluster-id-2")
.setRowAffinity(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
.RowAffinity.getDefaultInstance()))
.build();
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
.newBuilder()
.addClusterIds("cluster-id-1")
.addClusterIds("cluster-id-2")
.setRowAffinity(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
.RowAffinity.getDefaultInstance())))
.build();

com.google.bigtable.admin.v2.AppProfile expectedResponse =
com.google.bigtable.admin.v2.AppProfile.newBuilder()
.setName(APP_PROFILE_NAME)
.setDescription("my description")
.setMultiClusterRoutingUseAny(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.newBuilder()
.addClusterIds("cluster-id-1")
.addClusterIds("cluster-id-2")
.setRowAffinity(
com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny
.RowAffinity.getDefaultInstance()))
.build();

Mockito.when(mockCreateAppProfileCallable.futureCall(expectedRequest))
.thenReturn(ApiFutures.immediateFuture(expectedResponse));
.thenReturn(ApiFutures.immediateFuture(expectedResponse));

// Execute
Set<String> clusterIds = new HashSet<String>();
clusterIds.add("cluster-id-1");
clusterIds.add("cluster-id-2");
AppProfile actualResult =
adminClient.createAppProfile(
CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID)
.setDescription("my description")
.setRoutingPolicy(
MultiClusterRoutingPolicy.withRowAffinity(clusterIds)));
adminClient.createAppProfile(
CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID)
.setDescription("my description")
.setRoutingPolicy(MultiClusterRoutingPolicy.withRowAffinity(clusterIds)));

// Verify
assertThat(actualResult).isEqualTo(AppProfile.fromProto(expectedResponse));
Expand Down

0 comments on commit 7ba35f8

Please sign in to comment.