Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vavrtom
Copy link
Contributor

@vavrtom vavrtom commented Sep 11, 2019

Divided test testCreateValidation to

  • testSelectorNumberMustBePositiveOnCreate
  • testConnectionThreadPoolSizeMustBePositiveOnCreate
  • testSelectorNumberMustBeLessOrEqualToThePoolSizeOnCreate

and test testChangeValidation to

  • testSelectorNumberMustBePositiveOnChange
  • testConnectionThreadPoolSizeMustBePositiveOnChange
  • testSelectorNumberMustBeLessOrEqualToThePoolSizeOnChange

Copy link
Contributor

@alex-rufous alex-rufous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to split positive and negative tests into separate methods.
The positive tests can be strengthened with asserts verifying attributes values

@@ -509,31 +509,47 @@ public void testExistingConnectionBlocking()
}

@Test
public void testCreateValidation()
public void testSelectorNumberMustBePositiveOnCreate()
Copy link
Contributor

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

{
createVirtualHost(getTestName(), Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, "1"));
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Map<String, Object> attributes = Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, "1"); final QueueManagingVirtualHost<?> vh = createVirtualHost(getTestName(), attributes); assertEquals(1, vh.getNumberOfSelectors());

}

@Test
public void testConnectionThreadPoolSizeMustBePositiveOnCreate()
Copy link
Contributor

Choose a reason for hiding this comment

The 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);
Copy link
Contributor

Choose a reason for hiding this comment

The 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

}

@Test
public void testSelectorNumberMustBeLessOrEqualToThePoolSizeOnCreate()
Copy link
Contributor

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

{
QueueManagingVirtualHost<?> virtualHost = createVirtualHost(getTestName());
final QueueManagingVirtualHost<?> virtualHost = createVirtualHost(getTestName());
virtualHost.setAttributes(Collections.singletonMap(QueueManagingVirtualHost.NUMBER_OF_SELECTORS, "1"));
Copy link
Contributor

Choose a reason for hiding this comment

The 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

}

@Test
public void testConnectionThreadPoolSizeMustBePositiveOnChange()
Copy link
Contributor

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

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);
Copy link
Contributor

Choose a reason for hiding this comment

The 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

}

@Test
public void testSelectorNumberMustBeLessOrEqualToThePoolSizeOnChange()
Copy link
Contributor

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

{
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));
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants