diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/AppProfile.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/AppProfile.java index 4ee58bc47a..2507ef4dd3 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/AppProfile.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/AppProfile.java @@ -70,7 +70,7 @@ public RoutingPolicy getPolicy() { if (proto.hasMultiClusterRoutingUseAny()) { if (proto.getMultiClusterRoutingUseAny().hasRowAffinity()) { return MultiClusterRoutingPolicy.withRowAffinity( - ImmutableSet.copyOf(proto.getMultiClusterRoutingUseAny().getClusterIdsList())); + ImmutableSet.copyOf(proto.getMultiClusterRoutingUseAny().getClusterIdsList())); } return MultiClusterRoutingPolicy.of( ImmutableSet.copyOf(proto.getMultiClusterRoutingUseAny().getClusterIdsList())); @@ -272,13 +272,15 @@ public static MultiClusterRoutingPolicy of(Set clusterIds) { /** Creates a new instance of {@link MultiClusterRoutingPolicy}. */ public static MultiClusterRoutingPolicy withRowAffinity() { - return new MultiClusterRoutingPolicy(MultiClusterRoutingUseAny.newBuilder() - .setRowAffinity(MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()).build()); + return new MultiClusterRoutingPolicy( + MultiClusterRoutingUseAny.newBuilder() + .setRowAffinity(MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()) + .build()); } /** - * Creates a new instance of {@link MultiClusterRoutingPolicy} with row affinity enabled and specified cluster ids to - * route to. + * Creates a new instance of {@link MultiClusterRoutingPolicy} with row affinity enabled and + * specified cluster ids to route to. */ public static MultiClusterRoutingPolicy withRowAffinity(String... clusterIds) { return withRowAffinity(ImmutableSet.copyOf(clusterIds)); @@ -290,10 +292,10 @@ public static MultiClusterRoutingPolicy withRowAffinity(String... clusterIds) { */ public static MultiClusterRoutingPolicy withRowAffinity(Set clusterIds) { return new MultiClusterRoutingPolicy( - MultiClusterRoutingUseAny.newBuilder() - .addAllClusterIds(clusterIds) - .setRowAffinity(MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()) - .build()); + MultiClusterRoutingUseAny.newBuilder() + .addAllClusterIds(clusterIds) + .setRowAffinity(MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()) + .build()); } /* diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTests.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTests.java index 7310448865..2dd90f461a 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTests.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTests.java @@ -1040,36 +1040,40 @@ public void testCreateAppProfileAddRowAffinity() { 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() - .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() - .setRowAffinity(com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance())) - .build(); + com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny + .newBuilder() + .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() + .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 AppProfile actualResult = - adminClient.createAppProfile( - CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID) - .setDescription("my description") - .setRoutingPolicy(MultiClusterRoutingPolicy.withRowAffinity())); + adminClient.createAppProfile( + CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID) + .setDescription("my description") + .setRoutingPolicy(MultiClusterRoutingPolicy.withRowAffinity())); // Verify assertThat(actualResult).isEqualTo(AppProfile.fromProto(expectedResponse)); @@ -1081,40 +1085,45 @@ public void testCreateAppProfileAddRowAffinityAddMultipleClusterIds() { 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 AppProfile actualResult = - adminClient.createAppProfile( - CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID) - .setDescription("my description") - .setRoutingPolicy(MultiClusterRoutingPolicy.withRowAffinity("cluster-id-1", "cluster-id-2"))); + adminClient.createAppProfile( + CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID) + .setDescription("my description") + .setRoutingPolicy( + MultiClusterRoutingPolicy.withRowAffinity("cluster-id-1", "cluster-id-2"))); // Verify assertThat(actualResult).isEqualTo(AppProfile.fromProto(expectedResponse)); @@ -1126,38 +1135,43 @@ public void testCreateAppProfileAddRowAffinityAddMultipleClusterIdsWithList() { 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() - .addAllClusterIds(ImmutableList.of("cluster-id-1", "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() - .addAllClusterIds(ImmutableList.of("cluster-id-1", "cluster-id-2")) - .setRowAffinity(com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance())) - .build(); + com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny + .newBuilder() + .addAllClusterIds(ImmutableList.of("cluster-id-1", "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() + .addAllClusterIds(ImmutableList.of("cluster-id-1", "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 AppProfile actualResult = - adminClient.createAppProfile( - CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID) - .setDescription("my description") - .setRoutingPolicy(MultiClusterRoutingPolicy.withRowAffinity("cluster-id-1", "cluster-id-2"))); + adminClient.createAppProfile( + CreateAppProfileRequest.of(INSTANCE_ID, APP_PROFILE_ID) + .setDescription("my description") + .setRoutingPolicy( + MultiClusterRoutingPolicy.withRowAffinity("cluster-id-1", "cluster-id-2"))); // Verify assertThat(actualResult).isEqualTo(AppProfile.fromProto(expectedResponse)); diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableInstanceAdminClientIT.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableInstanceAdminClientIT.java index 2ab26134ee..6e9f82b5b4 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableInstanceAdminClientIT.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/it/BigtableInstanceAdminClientIT.java @@ -286,12 +286,12 @@ public void appProfileTestRowAffinity() { String newClusterId2 = newInstanceId + "-c2"; client.createInstance( - CreateInstanceRequest.of(newInstanceId) - .addCluster(newClusterId, testEnvRule.env().getPrimaryZone(), 1, StorageType.SSD) - .addCluster(newClusterId2, testEnvRule.env().getSecondaryZone(), 1, StorageType.SSD) - .setDisplayName("Row-Affinity-Instance-Test") - .addLabel("state", "readytodelete") - .setType(Type.PRODUCTION)); + CreateInstanceRequest.of(newInstanceId) + .addCluster(newClusterId, testEnvRule.env().getPrimaryZone(), 1, StorageType.SSD) + .addCluster(newClusterId2, testEnvRule.env().getSecondaryZone(), 1, StorageType.SSD) + .setDisplayName("Row-Affinity-Instance-Test") + .addLabel("state", "readytodelete") + .setType(Type.PRODUCTION)); try { assertThat(client.exists(newInstanceId)).isTrue(); @@ -299,13 +299,16 @@ public void appProfileTestRowAffinity() { String testAppProfile = prefixGenerator.newPrefix(); CreateAppProfileRequest request = - CreateAppProfileRequest.of(newInstanceId, testAppProfile) - .setRoutingPolicy(AppProfile.MultiClusterRoutingPolicy.withRowAffinity(newClusterId, newClusterId2)) - .setDescription("row affinity app profile"); + CreateAppProfileRequest.of(newInstanceId, testAppProfile) + .setRoutingPolicy( + AppProfile.MultiClusterRoutingPolicy.withRowAffinity(newClusterId, newClusterId2)) + .setDescription("row affinity app profile"); AppProfile newlyCreateAppProfile = client.createAppProfile(request); AppProfile.RoutingPolicy routingPolicy = newlyCreateAppProfile.getPolicy(); - assertThat(routingPolicy).isEqualTo(AppProfile.MultiClusterRoutingPolicy.withRowAffinity(newClusterId, newClusterId2)); + assertThat(routingPolicy) + .isEqualTo( + AppProfile.MultiClusterRoutingPolicy.withRowAffinity(newClusterId, newClusterId2)); } finally { if (client.exists(newInstanceId)) { client.deleteInstance(newInstanceId); diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/AppProfileTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/AppProfileTest.java index d56bdf2f52..d6e6e410e8 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/AppProfileTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/AppProfileTest.java @@ -295,16 +295,18 @@ public void testFromProtoWithDataBoostIsolation() { @Test public void testFromProtoWithRowAffinityNoClusterGroup() { AppProfile profile = - AppProfile.fromProto( - com.google.bigtable.admin.v2.AppProfile.newBuilder() - .setName(AppProfileName.of("my-project", "my-instance", "my-profile").toString()) - .setDescription("my description") - .setMultiClusterRoutingUseAny( - com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.newBuilder() - .setRowAffinity(com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()) - .build()) - .setEtag("my-etag") - .build()); + AppProfile.fromProto( + com.google.bigtable.admin.v2.AppProfile.newBuilder() + .setName(AppProfileName.of("my-project", "my-instance", "my-profile").toString()) + .setDescription("my description") + .setMultiClusterRoutingUseAny( + com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.newBuilder() + .setRowAffinity( + com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny + .RowAffinity.getDefaultInstance()) + .build()) + .setEtag("my-etag") + .build()); assertThat(profile.getInstanceId()).isEqualTo("my-instance"); assertThat(profile.getId()).isEqualTo("my-profile"); @@ -312,27 +314,31 @@ public void testFromProtoWithRowAffinityNoClusterGroup() { System.out.println(profile.getPolicy()); System.out.println(AppProfile.MultiClusterRoutingPolicy.withRowAffinity()); assertThat(profile.getPolicy()) - .isEqualTo(AppProfile.MultiClusterRoutingPolicy.withRowAffinity()); + .isEqualTo(AppProfile.MultiClusterRoutingPolicy.withRowAffinity()); } + @Test public void testFromProtoWithRowAffinityClusterGroup() { AppProfile profile = - AppProfile.fromProto( - com.google.bigtable.admin.v2.AppProfile.newBuilder() - .setName(AppProfileName.of("my-project", "my-instance", "my-profile").toString()) - .setDescription("my description") - .setMultiClusterRoutingUseAny( - com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.newBuilder() - .addAllClusterIds(ImmutableList.of("cluster-id-1", "cluster-id-2")) - .setRowAffinity(com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()) - .build()) - .setEtag("my-etag") - .build()); + AppProfile.fromProto( + com.google.bigtable.admin.v2.AppProfile.newBuilder() + .setName(AppProfileName.of("my-project", "my-instance", "my-profile").toString()) + .setDescription("my description") + .setMultiClusterRoutingUseAny( + com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny.newBuilder() + .addAllClusterIds(ImmutableList.of("cluster-id-1", "cluster-id-2")) + .setRowAffinity( + com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny + .RowAffinity.getDefaultInstance()) + .build()) + .setEtag("my-etag") + .build()); assertThat(profile.getInstanceId()).isEqualTo("my-instance"); assertThat(profile.getId()).isEqualTo("my-profile"); assertThat(profile.getDescription()).isEqualTo("my description"); assertThat(profile.getPolicy()) - .isEqualTo(AppProfile.MultiClusterRoutingPolicy.withRowAffinity("cluster-id-1", "cluster-id-2")); + .isEqualTo( + AppProfile.MultiClusterRoutingPolicy.withRowAffinity("cluster-id-1", "cluster-id-2")); } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/CreateAppProfileRequestTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/CreateAppProfileRequestTest.java index bf8495f259..7e9cc81541 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/CreateAppProfileRequestTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/CreateAppProfileRequestTest.java @@ -105,10 +105,13 @@ public void testDataBoostIsolationReadOnly() { @Test public void testRowAffinity() { CreateAppProfileRequest wrapper = - CreateAppProfileRequest.of("my-instance", "my-profile") - .setRoutingPolicy(MultiClusterRoutingPolicy.withRowAffinity()); + CreateAppProfileRequest.of("my-instance", "my-profile") + .setRoutingPolicy(MultiClusterRoutingPolicy.withRowAffinity()); assertThat(wrapper.toProto("my-project").getAppProfile().getMultiClusterRoutingUseAny()) - .isEqualTo(MultiClusterRoutingUseAny.newBuilder().setRowAffinity(MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()).build()); + .isEqualTo( + MultiClusterRoutingUseAny.newBuilder() + .setRowAffinity(MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()) + .build()); } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/UpdateAppProfileRequestTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/UpdateAppProfileRequestTest.java index e50d1c46a2..603943c533 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/UpdateAppProfileRequestTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/UpdateAppProfileRequestTest.java @@ -150,23 +150,30 @@ public void testUpdateExistingDataBoostIsolationReadOnly() { @Test public void testUpdateRowAffinity() { com.google.bigtable.admin.v2.AppProfile existingProto = - com.google.bigtable.admin.v2.AppProfile.newBuilder() - .setName("projects/my-project/instances/my-instance/appProfiles/my-profile") - .setEtag("my-etag") - .setDescription("description") - .setMultiClusterRoutingUseAny(MultiClusterRoutingUseAny.getDefaultInstance()) - .build(); + com.google.bigtable.admin.v2.AppProfile.newBuilder() + .setName("projects/my-project/instances/my-instance/appProfiles/my-profile") + .setEtag("my-etag") + .setDescription("description") + .setMultiClusterRoutingUseAny(MultiClusterRoutingUseAny.getDefaultInstance()) + .build(); AppProfile existingWrapper = AppProfile.fromProto(existingProto); UpdateAppProfileRequest updateWrapper = - UpdateAppProfileRequest.of(existingWrapper).setRoutingPolicy(AppProfile.MultiClusterRoutingPolicy.withRowAffinity()); + UpdateAppProfileRequest.of(existingWrapper) + .setRoutingPolicy(AppProfile.MultiClusterRoutingPolicy.withRowAffinity()); assertThat(updateWrapper.toProto("my-project")) - .isEqualTo( - com.google.bigtable.admin.v2.UpdateAppProfileRequest.newBuilder() - .setAppProfile(existingProto.toBuilder().setMultiClusterRoutingUseAny(MultiClusterRoutingUseAny.newBuilder().setRowAffinity(MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()))) - .setUpdateMask(FieldMask.newBuilder().addPaths("multi_cluster_routing_use_any")) - .build()); + .isEqualTo( + com.google.bigtable.admin.v2.UpdateAppProfileRequest.newBuilder() + .setAppProfile( + existingProto + .toBuilder() + .setMultiClusterRoutingUseAny( + MultiClusterRoutingUseAny.newBuilder() + .setRowAffinity( + MultiClusterRoutingUseAny.RowAffinity.getDefaultInstance()))) + .setUpdateMask(FieldMask.newBuilder().addPaths("multi_cluster_routing_use_any")) + .build()); } }