pivotal-jbarrett commented on code in PR #7630:
URL: https://github.com/apache/geode/pull/7630#discussion_r860227519


##########
geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java:
##########
@@ -317,4 +331,38 @@ public void 
testGetAllHostingMembersReturnsMemberWhenBucketAdvisorHasTwoProfiles
 
     assertThat(bucketAdvisor.adviseInitialized().size()).isEqualTo(1);
   }
+
+  @Test
+  void 
removePrimaryDeposePrimaryForColocatedChildrenBeforeReleasePrimaryLock() {
+    when(regionAdvisor.getPartitionedRegion()).thenReturn(partitionedRegion);
+    when(regionAdvisor.getBucket(any(Integer.class))).thenReturn(bucket);
+    when(partitionedRegion.getPartitionAttributes()).thenReturn(new 
PartitionAttributesImpl());
+    
when(bucket.getDistributionManager()).thenReturn(mock(DistributionManager.class));
+    BucketAdvisor bucketAdvisor = 
spy(BucketAdvisor.createBucketAdvisor(bucket, regionAdvisor));
+    InternalDistributedMember member = mock(InternalDistributedMember.class);
+    DistributionManager manager = mock(DistributionManager.class);
+    doReturn(true).when(bucketAdvisor).isPrimary();
+    doReturn(manager).when(bucketAdvisor).getDistributionManager();
+    when(manager.getId()).thenReturn(member);
+    bucketAdvisor.setPrimaryMemberForTest(member);

Review Comment:
   Are there places where this is called where we need to adjust the 
synchronized usage though?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to