-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QPID-7615 Number of selectors can be equal to connection thread pool size #34
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -509,31 +509,47 @@ public void testExistingConnectionBlocking() | |
} | ||
|
||
@Test | ||
public void testCreateValidation() | ||
public void testSelectorNumberMustBePositiveOnCreate() | ||
{ | ||
createVirtualHost(getTestName(), Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, "1")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It make sense to verify that attribute "numberOfSelectors" is indeed set to the specified value, for example
|
||
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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, split method into positive and negative tests |
||
{ | ||
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test can be strengthen with asserts verifying that specified values are indeed set on the corresponding attributes |
||
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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to suggest splitting positive and negative tests into separate methods |
||
{ | ||
createVirtualHost(getTestName(), Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, QueueManagingVirtualHost.DEFAULT_VIRTUALHOST_CONNECTION_THREAD_POOL_SIZE - 1)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test can be strengthen with asserts verifying that specified values are indeed set on the corresponding attributes |
||
createVirtualHost(getTestName(), Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, QueueManagingVirtualHost.DEFAULT_VIRTUALHOST_CONNECTION_THREAD_POOL_SIZE)); | ||
try | ||
{ | ||
createVirtualHost(getTestName(), Collections.<String, Object>singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, QueueManagingVirtualHost.DEFAULT_VIRTUALHOST_CONNECTION_THREAD_POOL_SIZE)); | ||
fail("Exception not thrown for number of selectors equal to connection thread pool size"); | ||
createVirtualHost(getTestName(), Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, QueueManagingVirtualHost.DEFAULT_VIRTUALHOST_CONNECTION_THREAD_POOL_SIZE + 1)); | ||
fail("Exception not thrown for number of selectors greater than connection thread pool size"); | ||
} | ||
catch (IllegalConfigurationException e) | ||
{ | ||
|
@@ -542,32 +558,50 @@ public void testCreateValidation() | |
} | ||
|
||
@Test | ||
public void testChangeValidation() | ||
public void testSelectorNumberMustBePositiveOnChange() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to suggest splitting positive and negative tests into separate methods |
||
{ | ||
QueueManagingVirtualHost<?> virtualHost = createVirtualHost(getTestName()); | ||
final QueueManagingVirtualHost<?> virtualHost = createVirtualHost(getTestName()); | ||
virtualHost.setAttributes(Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, "1")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test can be strengthen with asserts verifying that specified values are indeed set on the corresponding attributes |
||
try | ||
{ | ||
virtualHost.setAttributes(Collections.<String, Object>singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, "-1")); | ||
fail("Exception not thrown for negative number of selectors"); | ||
virtualHost.setAttributes(Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, "0")); | ||
fail("Exception not thrown for non-positive number of selectors"); | ||
} | ||
catch (IllegalConfigurationException e) | ||
{ | ||
// pass | ||
} | ||
} | ||
|
||
@Test | ||
public void testConnectionThreadPoolSizeMustBePositiveOnChange() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to suggest splitting positive and negative tests into separate methods |
||
{ | ||
final QueueManagingVirtualHost<?> virtualHost = createVirtualHost(getTestName()); | ||
final Map<String, Object> vhAttributes = new HashMap<>(); | ||
vhAttributes.put(QueueManagingVirtualHost.CONNECTION_THREAD_POOL_SIZE, 1); | ||
vhAttributes.put(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, 1); | ||
virtualHost.setAttributes(vhAttributes); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test can be strengthen with asserts verifying that specified values are indeed set on the corresponding attributes |
||
try | ||
{ | ||
virtualHost.setAttributes(Collections.singletonMap(QueueManagingVirtualHost.CONNECTION_THREAD_POOL_SIZE, | ||
"-1")); | ||
fail("Exception not thrown for negative connection thread pool size"); | ||
virtualHost.setAttributes(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 testSelectorNumberMustBeLessOrEqualToThePoolSizeOnChange() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to suggest splitting positive and negative tests into separate methods |
||
{ | ||
final QueueManagingVirtualHost<?> virtualHost = createVirtualHost(getTestName()); | ||
virtualHost.setAttributes(Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, QueueManagingVirtualHost.DEFAULT_VIRTUALHOST_CONNECTION_THREAD_POOL_SIZE - 1)); | ||
virtualHost.setAttributes(Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, QueueManagingVirtualHost.DEFAULT_VIRTUALHOST_CONNECTION_THREAD_POOL_SIZE)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test can be strengthen with asserts verifying that specified values are indeed set on the corresponding attributes |
||
try | ||
{ | ||
virtualHost.setAttributes(Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, QueueManagingVirtualHost.DEFAULT_VIRTUALHOST_CONNECTION_THREAD_POOL_SIZE)); | ||
fail("Exception not thrown for number of selectors equal to connection thread pool size"); | ||
virtualHost.setAttributes(Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, QueueManagingVirtualHost.DEFAULT_VIRTUALHOST_CONNECTION_THREAD_POOL_SIZE + 1)); | ||
fail("Exception not thrown for number of selectors greater than connection thread pool size"); | ||
} | ||
catch (IllegalConfigurationException e) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to suggest splitting positive and negative tests into separate methods