Skip to content

Add test cases to PulsarTemplateTests #38

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

Merged
merged 1 commit into from
Jul 25, 2022

Conversation

onobc
Copy link
Collaborator

@onobc onobc commented Jul 24, 2022

This adds tests cases for the newly added PulsarOperations APIs.

@onobc onobc requested a review from sobychacko July 24, 2022 06:03
* @return the id of the sent message
* @throws PulsarClientException if an error occurs
*/
default MessageId send(T message, MessageRouter messageRouter) throws PulsarClientException {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I missed this variant on the original proposal.

@@ -38,7 +38,7 @@
* @throws PulsarClientException if an error occurs
*/
default MessageId send(T message) throws PulsarClientException {
return send(null, message);
return send(null, message, null);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I made all of the default impls call to the abstract one rather than daisy-chan into the next most specific send method. This prevents coupling between the different APIs (ie send(T message) only depends on the abstract send(null, message, null); whereas before it depended on send(null, message); which then depended on send(null, message, null); which then would mean that we have to consider all 3 when changing one of them. Basically 2 dependent function calls is less coupling than 3.

pulsarClient = PulsarClient.builder()
.serviceUrl(getPulsarBrokerUrl())
.build();
}

@AfterEach
void closePulsarClient() throws PulsarClientException {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

[UNRELATED] I noticed this test was not cleaning up when done w/ the client.

* @author Soby Chacko
* @author Chris Bono
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@soby we can go over this one via Zoom if you like. It basically removes the "testUsage" test and replaces the 2 sync/async cases w/ the permutations of (syncOrAsync, defaultOrSpecificTopic, withOrWithoutRouter) via @ParameterizedTest.

Copy link

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My bad @soby . Sorry for the interruption - have a nice day. 😸

@sobychacko sobychacko merged commit d9cdec3 into spring-projects:main Jul 25, 2022
@sobychacko
Copy link
Collaborator

LGTM - Merged upstream.

@onobc onobc deleted the cbono-pulsartemplate-tests branch September 11, 2022 17:30
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.

3 participants