alex-rufous commented on a change in pull request #102:
URL: https://github.com/apache/qpid-broker-j/pull/102#discussion_r671122780



##########
File path: 
bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
##########
@@ -231,6 +233,10 @@ public long getNextMessageId()
                                                               
MESSAGE_METADATA_SEQ_CONFIG);
             newMessageId = mmdSeq.get(null, 1);
         }
+        catch(LockTimeoutException le)
+        {
+           throw new ConnectionScopedRuntimeException("Unexpected exception on 
BDB sequence",le);

Review comment:
       space is missed between comma and exception

##########
File path: 
bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
##########
@@ -218,4 +228,25 @@ protected boolean flowToDiskSupported()
         return true;
     }
 
+    @Test
+    public void testGetNextMessgaeIdWithLockException(){
+        BDBMessageStore bdbStore = (BDBMessageStore) createMessageStore();

Review comment:
       The test mixes different mocking approaches: spy, mockito moc and mocked 
messages for AMQP 0-8.
   IMHO, we can get rid of spy by using mockito mocks for 
EnvironmentFacadeFactory, EnvironmentFacade and message
   ```
   EnvironmentFacade eff = mock(EnvironmentFacadeFactory.class);
   EnvironmentFacade ef = mock(EnvironmentFacade.class);
   doThrow(LockTimeoutException.class).when(ef).openSequence(any(),any(),any());
   when(eff.createEnvironmentFacade(any())).thenReturn(ef);
   
   BDBMessageStore store = new BDBMessageStore (eff);
   store.openMessageStore();
   
    try
           {
               store.addMessage(new InternalMessageMetaData(false, null, 0))
               fails("exception is expected");
           }
           catch(ConnectionScopedRuntimeException e)
           {
               assertEquals("Unexpected exception on BDB 
sequence",e.getMessage());
           }
   
   ```
   
   I think the above reduces dependency to amqp 0-8 protocol and gets rid of spy




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to