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

    https://github.com/apache/incubator-omid/pull/23#discussion_r167857492
  
    --- Diff: 
tso-server/src/test/java/org/apache/omid/tso/TestPersistenceProcessorHandler.java
 ---
    @@ -126,6 +126,36 @@ void afterMethod() {
             Mockito.reset(mockWriter);
         }
     
    +    @Test(timeOut = 1_000)
    +    public void testPersistentProcessorHandlerIdsAreCreatedConsecutive() 
throws Exception {
    +
    +        TSOServerConfig tsoConfig = new TSOServerConfig();
    +        tsoConfig.setNumConcurrentCTWriters(32);
    +
    +        PersistenceProcessorHandler[] handlers = new 
PersistenceProcessorHandler[tsoConfig.getNumConcurrentCTWriters()];
    +        for (int i = 0; i < tsoConfig.getNumConcurrentCTWriters(); i++) {
    +            handlers[i] = new PersistenceProcessorHandler(metrics,
    +                                                          "localhost:1234",
    +                                                          
mock(LeaseManager.class),
    +                                                          commitTable,
    +                                                          
mock(ReplyProcessor.class),
    +                                                          retryProcessor,
    +                                                          panicker);
    +        }
    +
    +        for (int i = 0; i < tsoConfig.getNumConcurrentCTWriters(); i++) {
    +            // Required to generalize the cases when other tests have 
increased the static variable assigning the ids
    +            if (i + 1 < tsoConfig.getNumConcurrentCTWriters()) {
    +                int followingHandlerIdAsInt = Integer.valueOf(handlers[i + 
1].getId());
    +                assertEquals(handlers[i].getId(), 
String.valueOf(followingHandlerIdAsInt - 1));
    --- End diff --
    
    We kind of testing the atomic integer :)


---

Reply via email to