-
Notifications
You must be signed in to change notification settings - Fork 203
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
persistent connection unit test #393
Conversation
@hs3180 Thanks for your pull request, let me find someone who can review it |
@dmzaytsev it's yours, please review |
@hs3180 plese fix qulice issues |
@dmzaytsev |
Maybe related to jcabi/jcabi-github#1165 |
@pecko |
@hs3180 I would suggest you implement only unit tests here. Full implementation will be too big for one PR.
you have to parse Let's implement tests for various scenarios for a persistent connection:
@yegor256 are you agree? |
@hs3180 I think you're right |
@dmzaytsev yes, I agree. I'm in general in favor of small pull requests |
@dmzaytsev
so I think there are only three scenario to be tested:
|
@ypshenychka review this ticket please, for compliance with our quality rules |
@hs3180 Why is this PR not merged? Have you created new PRs instead of this? |
@ypshenychka |
@hs3180 I see, thanks. |
@dmzaytsev
Only one issue was found during code review. Try to find at least three problems while future reviews. |
@ypshenychka I confirm |
@dmzaytsev Thanks. |
@dmzaytsev |
@@ -60,9 +74,9 @@ public void handlesSocket() throws IOException { | |||
Mockito.when(socket.getInputStream()).thenReturn( | |||
new ByteArrayInputStream( | |||
Joiner.on("\r\n").join( | |||
"GET / HTTP/1.1", | |||
"POST / HTTP/1.1", |
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.
@hs3180 why did you change this line?
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.
@dmzaytsev
In most practical applications, GET method shouldn't be attached with a body.
see latest discussion in #306 for more information.
"Host:localhost", | ||
"Content-Length: 2", | ||
"Content-Length: 4", |
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.
@hs3180 and this one?
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.
@dmzaytsev
The request body "hi" is actually "hi\r\n".
@hs3180 3 comments above |
@dmzaytsev |
@davvd Quality is acceptable. |
@ypshenychka thanks for the QA review, we'll work better next time |
@davvd @ypshenychka |
@dmzaytsev OK, go ahead |
@hs3180 OK, got it |
Mockito.when(socket.getPort()).thenReturn(0); | ||
final ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
Mockito.when(socket.getOutputStream()).thenReturn(baos); | ||
new BkBasic(new TkGreedy(new TkText(HELLO_WORLD))).accept(socket); |
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.
@hs3180 I still not understand how you check that the socket still open after first request...
@hs3180 one comment/question above
|
@hs3180 ping |
@dmzaytsev |
@hs3180 I don't see any unit test in this PR |
@dmzaytsev |
* @throws IOException Socket IOException. | ||
*/ | ||
@Test | ||
public void handleTwoRequestInOneConnection() throws IOException { |
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.
@hs3180 handlesTwoRequestInOneConnection
http://www.yegor256.com/2014/04/27/typical-mistakes-in-java-code.html?expand=1#test-method-names
same for javadoc and test name below
@hs3180 let's ignore broken tests and create puzzle to implement missed |
@hs3180 ping |
@dmzaytsev |
@dmzaytsev I added 10 mins to @ypshenychka (for QA review) in transaction 66959064 paid, thanks, added 26 mins to your account, payment review comments (c=11) added as a bonus +26 added to your rating, current score is: +1350 |
persistent connection feature(#306) and its integration test.