-
-
Notifications
You must be signed in to change notification settings - Fork 55
Added version API #316
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
Added version API #316
Conversation
Pull Request Test Coverage Report for Build 581
💛 - Coveralls |
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.
@milux Please see my comments.
Also, did you make these PRs because of this article?
https://amihaiemil.com/2020/02/15/solve-github-issues-and-get-cash.html
If yes, please be aware that there are no open bounties for this repo.
However, if the PRs get merged, I'll send you some cash...
But please, next time, don't work unless you are assigned and the ticket has a bounty on it.
public Version version() throws IOException { | ||
final String versionUri = this.baseUri.toString() + "/version"; | ||
final HttpGet version = new HttpGet(versionUri); | ||
final JsonObject json = this.client.execute( |
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.
@milux This variable is only used one time, please put it inline, in the call to new RtVersion()
, like this:
return new RtVersion(
this.client.execute(
version,
new ReadJsonObject(
new MatchStatus(version.getURI(), HttpStatus.SC_OK)
)
),
this.client,
URI.create(versionUri),
this
);
Also, wrap everything in try/finally
and release the connection, like here
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.
Done, also improved structure according to the pattern I found in Inspection.java
.
* @since 0.0.11 | ||
*/ | ||
public interface Version extends JsonObject { | ||
} |
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.
@milux We should also have accesor methods, since the JsonObject has quite a few attributes, as I see.
Also, it would be nice to have the docker()
method as well, which returns the parent Docker
instance.
If you already spent too much time, please leave a puzzle for continuing implementation.
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.
Done, plus I have no clue what those "puzzles" are? Read about it somewhere in your code, but didn't quite get it. Can you provide an example for better understanding?
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.
Removed the local variables because I think they're pointless anyway. Can undo this if you think differently.
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.
@milux Can you remove the get
and is
prefixes from the methods name? I never use them, they are just noise in the code :)
I also don't see the docker()
method, can you add it?
this.baseUri = uri; | ||
this.docker = dkr; | ||
} | ||
} |
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.
@milux We also need unit tests. See how other unit tests are written, it's not complicated. Generally, PRs should not decrease code coverage.
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.
Done, although the method I wrote the unit test is somewhat different from that of the other tests. (Using locally stored JSON resource file for response mockup, for instance.) Hope you're still fine with this...
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.
@milux Yes, it's fine. It can be changed later, no prob.
This pull request #316 is assigned to @amihaiemil/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @amihaiemil/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer; there will be a monetary reward for this job |
Manual assignment of issues is discouraged, see §19: -5 point(s) just awarded to @amihaiemil/z |
BTW: Please let me be quite clear that I don't want to earn money with this. |
@milux Thank you. I would still like to send you some cash in PayPal, if you give me your e-mail address from there. I want to invest in my projects, attract developers, build a distributed team etc. Also, maybe your institute could invest a few dollars in this library, so we make it better with Bounties. |
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.
@milux Thank you! Just remove the is
and get
prefixes and add the docker()
method.
A "puzzle" is actually a TODO which will automatically be transformed into a new Github Issue. It looks like this:
@todo #parent_ticket_number:30min Please continue with implementation,
we need this and that, and such a Puzzle should have at least 2-3 sentences,
otherwise the bot will complain. Also pay attention to the puzzle's indentation,
the second and following sentences have to begin with a space (be alligned with
the @ sign).
* @throws IOException If an I/O error occurs. | ||
*/ | ||
RtVersion(final HttpClient client, final URI uri) throws IOException { | ||
super(fetch(client, uri)); |
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.
@milux Well, this fetch method goes a little against the architecture. How you did it before, it was ok. But I can change it later without modifying the interfaces, so it's ok.
this.baseUri = uri; | ||
this.docker = dkr; | ||
} | ||
} |
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.
@milux Yes, it's fine. It can be changed later, no prob.
* @since 0.0.11 | ||
*/ | ||
public interface Version extends JsonObject { | ||
} |
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.
@milux Can you remove the get
and is
prefixes from the methods name? I never use them, they are just noise in the code :)
I also don't see the docker()
method, can you add it?
Done, both. Regarding |
@milux well, all the objects in the library have the But we can add it later, no worries. Can you fix the build, then we'll merge the PR? :D |
Sure, very good and noble attitude and plans, but I'm afraid taking money could violate a bunch of regulations, for instance our anti-corruption rules (Yes it's silly, but that's Germany... ^^).
I wish, but I believe the sad reality is that while we can pay for commercial tools, supporting FOSS projects bounces because all those stupid regulations. 😞 |
@milux Well, I don't think it's corruption to take money for honest work :D If you change your mind, let me know. I saw you understood the architecture here so we could use contributors. |
@rultor try to merge |
1 similar comment
@rultor try to merge |
@amihaiemil OK, I'll try to merge now. You can check the progress of the merge here |
@amihaiemil @milux Oops, I failed. You can see the full log here (spent 6min)
|
@amihaiemil OK, I'll try to merge now. You can check the progress of the merge here |
@amihaiemil I noticed that there was a copy-paste flaw in the comment of the unit test I provided. It appears that the commit didn't make it to this PR. If rultor fails again, you may want to include this, although it's a minor thing. |
@amihaiemil @milux Oops, I failed. You can see the full log here (spent 6min)
|
@milux rultor has other issues, unfortunately.... it will be an Issue for us now because until Rultor is fixed, I cannot make a release to Maven Central... |
Job was finished in 3 hours, bonus for fast delivery is possible (see §36) |
Order was finished: +20 point(s) just awarded to @amihaiemil/z |
Payment to |
This PR adds support for the version API documented at https://docs.docker.com/engine/api/v1.35/#operation/SystemVersion.
RtVersion
doesn't have any methods, since there are no ops available with this API. Convenience methods for the available JSON properties might be implemented if desired.