Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1888#discussion_r99298185
  
    --- Diff: 
external/storm-kafka/src/test/org/apache/storm/kafka/ZkCoordinatorTest.java ---
    @@ -114,6 +113,33 @@ public void testPartitionsChange() throws Exception {
             }
         }
     
    +    @Test
    +    public void testPartitionManagerRecreate() throws Exception {
    +        final int totalTasks = 2;
    +        int partitionsPerTask = 2;
    +        List<ZkCoordinator> coordinatorList = buildCoordinators(totalTasks 
/ partitionsPerTask);
    +        
when(reader.getBrokerInfo()).thenReturn(TestUtils.buildPartitionInfoList(TestUtils.buildPartitionInfo(totalTasks,
 9092)));
    +        List<List<PartitionManager>> partitionManagersBeforeRefresh = 
getPartitionManagers(coordinatorList);
    +        waitForRefresh();
    +        
when(reader.getBrokerInfo()).thenReturn(TestUtils.buildPartitionInfoList(TestUtils.buildPartitionInfo(totalTasks,
 9093)));
    +        List<List<PartitionManager>> partitionManagersAfterRefresh = 
getPartitionManagers(coordinatorList);
    +        assertEquals(partitionManagersAfterRefresh.size(), 
partitionManagersAfterRefresh.size());
    +        Iterator<List<PartitionManager>> iterator = 
partitionManagersAfterRefresh.iterator();
    +        for (List<PartitionManager> partitionManagersBefore : 
partitionManagersBeforeRefresh) {
    +            List<PartitionManager> partitionManagersAfter = 
iterator.next();
    +            for (PartitionManager before : partitionManagersBefore)
    +                for (PartitionManager after: partitionManagersAfter)
    +                    if (before.getPartition().partition == 
after.getPartition().partition)
    +                        assertStateIsTheSame(before, after);
    +        }
    +    }
    +
    +    private void assertStateIsTheSame(PartitionManager managerBefore, 
PartitionManager managerAfter) {
    +        // check if state was actually moved from old PartitionManager
    +        assertNotSame(managerBefore, managerAfter);
    +        assertSame(managerBefore._waitingToEmit, 
managerAfter._waitingToEmit);
    --- End diff --
    
    No I think that's enough.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to