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

Ping Pong #9 #94

Merged
merged 13 commits into from
Feb 16, 2023
Merged

Ping Pong #9 #94

merged 13 commits into from
Feb 16, 2023

Conversation

Lugn1
Copy link
Contributor

@Lugn1 Lugn1 commented Feb 13, 2023

Add ping method with tests

phteffe and others added 6 commits February 6, 2023 09:36
Add simple if statement for simple string reply to ping and removed superflous readline.
Co-authored-by: phteffe <phtefan.karlsson@gmail.com>
Co-authored-by: JesperBodin <112554269+jesperbodin@users.noreply.github.com>
Co-authored-by: phteffe <phtefan.karlsson@gmail.com>
Co-authored-by: JesperBodin <112554269+jesperbodin@users.noreply.github.com>
# Conflicts:
#	src/main/java/org/fungover/haze/Main.java
Co-authored-by: saftromo <safstrom.oliver@gmail.com>
Co-authored-by: phteffe <phtefan.karlsson@gmail.com>
Co-authored-by: JesperBodin
<112554269+jesperbodin@users.noreply.github.com>
@Lugn1 Lugn1 linked an issue Feb 13, 2023 that may be closed by this pull request
safstromo
safstromo previously approved these changes Feb 13, 2023
Copy link
Contributor

@safstromo safstromo left a comment

Choose a reason for hiding this comment

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

Great!

Copy link
Contributor

@Ahlberg-iths Ahlberg-iths left a comment

Choose a reason for hiding this comment

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

The logic in the ping method and the accompanying tests look good, and the unit tests are passing so that's all good.

I'm not sure that I understand 100% how the code in the main method works, but I think passing the value variable as an argument to ping will get us in trouble here. What happens if we receive a command like "PING message\r\n"? I think readInputStream will opt for its else clause and fill the inputList with only two strings, which then would make getValueIfExist return an empty string. That would then be what would be passed into ping as an argument instead of "message" and ping itself would then also return an empty string. I'm speculating here though. It would be nice to get someone else to look at this as well.

I'm also a bit unsure about the actual format of the return from the ping method. Looking at the connected issue, the expected return string for a simple PING command seems to be a string starting with a + sign, and ending with \r\n, and otherwise be in the form of a bulk string. Maybe this is a standard we need to follow?

@Lugn1
Copy link
Contributor Author

Lugn1 commented Feb 14, 2023

The logic in the ping method and the accompanying tests look good, and the unit tests are passing so that's all good.

I think I got your point. The code is modified to be merged with cchriss123's #95 pull request for now.
What do you think about revamp the ping method and move to the pingCommand() in #95's CommandSwitch class?

Copy link
Contributor

@Ahlberg-iths Ahlberg-iths left a comment

Choose a reason for hiding this comment

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

Nicely done, looks awesome!

Yeah, I think we could just let it be as it is now, and then let the code that needs to use the function worry about how to pass in the correct arguments to it and call it.

Maybe the parameter name could be improved a little though, it might be a bit misleading.

safstromo
safstromo previously approved these changes Feb 14, 2023
Ahlberg-iths
Ahlberg-iths previously approved these changes Feb 14, 2023
Copy link
Contributor

@Ahlberg-iths Ahlberg-iths left a comment

Choose a reason for hiding this comment

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

Nice!

@RobertMili
Copy link
Contributor

RobertMili commented Feb 15, 2023

You did not include the new line code in the HazeDatabase class, which I implemented.
This is causing conflicts, so you just need to update the classes.

https://github.com/fungover/haze/blob/8-strings-verified-account/src/main/java/org/fungover/haze/HazeDatabase.java

Lugn1 and others added 2 commits February 16, 2023 09:58
Merge branch 'main' into 9-ping-pong

Co-authored-by: Ahlberg-iths <113943951+Ahlberg-iths@users.noreply.github.com>
Add ping case in executeCommand method
Fix off by one err in ping method
Add tests for ping in MainTest

Co-authored-by: Ahlberg-iths <113943951+Ahlberg-iths@users.noreply.github.com>
@sonarcloud
Copy link

sonarcloud bot commented Feb 16, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@jLereback jLereback left a comment

Choose a reason for hiding this comment

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

Works for everyone, super!

@kappsegla kappsegla added this pull request to the merge queue Feb 16, 2023
Merged via the queue into main with commit 6ab94f5 Feb 16, 2023
@jLereback jLereback deleted the 9-ping-pong branch February 16, 2023 10:00
@kappsegla kappsegla added the enhancement New feature or request label Feb 17, 2023
@kappsegla kappsegla changed the title Closes #9 Ping Pong #9 Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PING PONG
7 participants