alex-rufous commented on a change in pull request #34: QPID-7615 Number of 
selectors can be equal to connection thread pool size
URL: https://github.com/apache/qpid-broker-j/pull/34#discussion_r323795243
 
 

 ##########
 File path: 
broker-core/src/test/java/org/apache/qpid/server/model/VirtualHostTest.java
 ##########
 @@ -509,31 +509,47 @@ public void testExistingConnectionBlocking()
     }
 
     @Test
-    public void testCreateValidation()
+    public void testSelectorNumberMustBePositiveOnCreate()
     {
+        createVirtualHost(getTestName(), 
Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, "1"));
         try
         {
-            createVirtualHost(getTestName(), 
Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS,
-                                                                      "-1"));
-            fail("Exception not thrown for negative number of selectors");
+            createVirtualHost(getTestName(), 
Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, "0"));
+            fail("Exception not thrown for non-positive number of selectors");
         }
         catch (IllegalConfigurationException e)
         {
             // pass
         }
+    }
+
+    @Test
+    public void testConnectionThreadPoolSizeMustBePositiveOnCreate()
+    {
+        final Map<String, Object> vhAttributes = new HashMap<>();
+        vhAttributes.put(QueueManagingVirtualHost.CONNECTION_THREAD_POOL_SIZE, 
1);
+        vhAttributes.put(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, 1);
+        createVirtualHost(getTestName(), vhAttributes);
         try
         {
-            createVirtualHost(getTestName(), 
Collections.singletonMap(QueueManagingVirtualHost.CONNECTION_THREAD_POOL_SIZE, 
"-1"));
-            fail("Exception not thrown for negative connection thread pool 
size");
+            createVirtualHost(getTestName(), 
Collections.singletonMap(QueueManagingVirtualHost.CONNECTION_THREAD_POOL_SIZE, 
"0"));
+            fail("Exception not thrown for non-positive connection thread pool 
size");
         }
         catch (IllegalConfigurationException e)
         {
             // pass
         }
+    }
+
+    @Test
+    public void testSelectorNumberMustBeLessOrEqualToThePoolSizeOnCreate()
+    {
+        createVirtualHost(getTestName(), 
Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, 
QueueManagingVirtualHost.DEFAULT_VIRTUALHOST_CONNECTION_THREAD_POOL_SIZE - 1));
 
 Review comment:
   The test can be strengthen with asserts verifying that specified values are 
indeed  set on the corresponding attributes

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to