@W-20798759: [MSDK] Add ability to programmatically update servers list#2841
Conversation
2d4444f to
c9fad55
Compare
| * it is not it will be automatically corrected | ||
| */ | ||
| @SuppressWarnings("unused") | ||
| public void reorderCustomLoginServer( |
There was a problem hiding this comment.
The documentation comment should provide adequate guidance, particularly where the boundary of non-custom and custom login server indexes is guarded.
There was a problem hiding this comment.
Is this the interface they wanted? I was envisioning something like:
public void reorderLoginServers(List<LoginServer> reorderedList)
Where they just gave us the list of servers in the order they wanted.
There was a problem hiding this comment.
And this only reorders custom login servers. Is that what they want?
| loginServers.remove(originalIndex); | ||
| loginServers.add(updatedIndex, originalLoginServer); | ||
|
|
||
| // Edit each login server indexed after the updated index. |
There was a problem hiding this comment.
This "re-indexing" logic is very similar to what's already in remove login server.
c9fad55 to
a3f81a9
Compare
| * login server this method will do nothing. | ||
| */ | ||
| @SuppressWarnings("unused") | ||
| public void replaceCustomLoginServer( |
There was a problem hiding this comment.
The documentation comment here should guide callers around legal parameters.
There was a problem hiding this comment.
Is it not possible to add an update(name, url) method to LoginServer itself?
|
Note the checks haven't run tests or code coverage, so there might be a little more work to do. That said, this ought to be really close to the mark. |
a3f81a9 to
ed5c8e9
Compare
ed5c8e9 to
0762987
Compare
Generated by 🚫 Danger |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2841 +/- ##
============================================
+ Coverage 63.30% 64.63% +1.32%
- Complexity 2836 2928 +92
============================================
Files 216 222 +6
Lines 16996 17323 +327
Branches 2420 2471 +51
============================================
+ Hits 10760 11196 +436
+ Misses 5069 4924 -145
- Partials 1167 1203 +36
🚀 New features to boost your workflow:
|
3e5215a to
0487f07
Compare
…st (Code Coverage 100%)
0487f07 to
3e8734b
Compare
|
@wmathurin, I did make a few minor logic updates to preemptively fix bugs as I increased code coverage. |
| LoginServer server = new LoginServer(name, url, isCustom); | ||
|
|
||
| // Only notify livedata consumers if the value has changed. | ||
| // Only notify live data consumers if the value has changed. |
There was a problem hiding this comment.
NIT: I think LiveData is probably the most correct. Google never writes it as two words.
| * it is not it will be automatically corrected | ||
| */ | ||
| @SuppressWarnings("unused") | ||
| public void reorderCustomLoginServer( |
There was a problem hiding this comment.
Is this the interface they wanted? I was envisioning something like:
public void reorderLoginServers(List<LoginServer> reorderedList)
Where they just gave us the list of servers in the order they wanted.
| * it is not it will be automatically corrected | ||
| */ | ||
| @SuppressWarnings("unused") | ||
| public void reorderCustomLoginServer( |
There was a problem hiding this comment.
And this only reorders custom login servers. Is that what they want?
| * login server this method will do nothing. | ||
| */ | ||
| @SuppressWarnings("unused") | ||
| public void replaceCustomLoginServer( |
There was a problem hiding this comment.
Is it not possible to add an update(name, url) method to LoginServer itself?
🎸 Ready For Review 🥁
This adds two new methods to the login server manager: Replace and re-order login server. For 13.2 point release, this only adds behavior and maintains API compatibility. To that end, this keeps this source in Java for now and attempts to follow the style of the existing code.
There are new unit tests to validate and cover the new methods. Also, here's a video where I added a few menu options to test interactively. Note in the video how the index of the updated login server is corrected when needed so it does not exceed the last index or precede the non-custom login servers which have higher priority and are immutable. The video doesn't show it, but the reset action also included all the negative tests that are present in the unit tests.