Refactor Archiver Client for large requests#196
Refactor Archiver Client for large requests#196jacomago merged 7 commits intoChannelFinder:masterfrom
Conversation
|
This does sound like a good codeathon task |
f0f092d to
1edb6fe
Compare
1edb6fe to
e9679d1
Compare
src/main/java/org/phoebus/channelfinder/service/external/ArchiverService.java
Show resolved
Hide resolved
src/main/java/org/phoebus/channelfinder/service/external/ArchiverService.java
Outdated
Show resolved
Hide resolved
src/main/java/org/phoebus/channelfinder/service/external/ArchiverService.java
Outdated
Show resolved
Hide resolved
src/test/java/org/phoebus/channelfinder/service/external/ArchiverServiceTest.java
Show resolved
Hide resolved
src/main/java/org/phoebus/channelfinder/service/external/ArchiverService.java
Outdated
Show resolved
Hide resolved
src/test/java/org/phoebus/channelfinder/service/external/ArchiverServiceTest.java
Outdated
Show resolved
Hide resolved
src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/phoebus/channelfinder/configuration/AAChannelProcessor.java
Show resolved
Hide resolved
src/test/java/org/phoebus/channelfinder/service/external/ArchiverServiceTest.java
Outdated
Show resolved
Hide resolved
georgweiss
left a comment
There was a problem hiding this comment.
Had some Spring Boot related comments....
e9679d1 to
22427d3
Compare
This was used to distinguish support for getting status via post or query Now (from an earlier merge) we explicitly configure it instead.
8ed48ac to
3eac53e
Compare
3eac53e to
2db924e
Compare
Adds Validation checking of responses from ArchiveAction s Adds a test for ArchiverService with some example responses from a live archiver
Instead of the mockresponses
76bb0e8 to
1e24b36
Compare
Means the integration tests won't try to autowire it
1e24b36 to
778ad1a
Compare
|
|
I think the failures are now due to some broken docker changes in github actions and this PR is ready @anderslindho |
anderslindho
left a comment
There was a problem hiding this comment.
LGTM, but - as mentioned before - would be nice if your commit messages focused more on the "why"
To come up with thoughtful commits, consider the following:
- Why have I made these changes?
- What effect have my changes made?
- Why was the change needed?
- What are the changes in reference to?
Assume the reader does not understand what the commit is addressing. They may not have access to the story addressing the detailed background of the change.
https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/
| public ArchiverService( | ||
| RestClient.Builder builder, @Value("${aa.timeout_seconds:15}") int timeoutSeconds) { | ||
| SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); | ||
| factory.setReadTimeout(timeoutSeconds * 1000); |
There was a problem hiding this comment.
Magic value: put 1000 in a named variable
| private List<Map<String, String>> sendRequest(Object payload, String uriString) { | ||
| try { | ||
| String response = | ||
| String values = objectMapper.writeValueAsString(payload); |
There was a problem hiding this comment.
Should prob be outside of try-except 🔧
|
|
||
| public long configureAA(Map<ArchiveAction, List<ArchivePVOptions>> archivePVS, String aaURL) | ||
| throws JsonProcessingException { | ||
| List<String> submitArchiveAction(List<String> pvs, List<ArchivePVOptions> payload, String aaURL) { |
There was a problem hiding this comment.
We should maybe be more careful with how we use the terms "record", "record name", "pv", "pv name" - these are all slightly different 💭
| ArchiveAction(final String endpoint) { | ||
| ArchiveAction(final String endpoint, final String successfulStatus) { | ||
| this.endpoint = endpoint; | ||
| this.successfulStatus = successfulStatus; |



Refactored the Archiver Client to make sure it can stream large requests.
Swapped to the Spring boot RestClient
Added a test ArchiverServiceTest
Reduced the scope of the AAProcessorIT tests to mock the ArchiverService
For future I'd like to use openapi definition from the archiver to generate a client, maybe that's a good codathon ticket.