BI-1555 - Cache program ontology terms#206
Conversation
Converted semaphore to use Redisson's semaphore (distributed semaphore)
…ce/impl design pattern Introduced flag to suppress refreshing cache on startup if desired (useful for integration tests)
722ec3f to
fb96326
Compare
There was a problem hiding this comment.
Testing locally revealed some problems.
Brapi:
- Single trait add errors
- Batch trait import errors
- Batch germplasm import passes
- Germplasm table display passes
- Germplasm list table display passes
- Germplasm export passes
BB:
- First single trait add passes
- Second single trait add "passes" but doesn't display
- Batch trait import "passes" but doesn't display and neither does second single trait. Traits do not display after waiting and refreshing, but do display once bi-api is restarted
- Batch germplasm import passes and germplasm displayed for two separate imports
- Displaying germplasm lists errors
| public class ProgramCacheUnitTest { | ||
| public class ProgramCacheUnitTest extends DatabaseTest { | ||
|
|
||
| // TODO: Tests |
There was a problem hiding this comment.
should this old todo be removed at this point?
| .documentationURL(program.getDocumentationUrl()); | ||
|
|
||
| // POST programs to each brapi service | ||
| // TODO: If there is a failure after the first brapi service, roll back all before the failure. |
There was a problem hiding this comment.
Is this todo being implemented as part of this card, or another?
There was a problem hiding this comment.
NA, was a pre-existing TODO
|
|
||
| BrAPIProgram brApiProgram = brApiPrograms.getBody().getResult().getData().get(0); | ||
|
|
||
| //TODO: Need to add archived/not archived when available in brapi |
There was a problem hiding this comment.
Likewise re: is this a todo with a card associated, a todo for this card, or just something to do in future?
There was a problem hiding this comment.
NA, was a pre-existing TODO
| .build()); | ||
| } | ||
|
|
||
| //TODO figure out why BrAPIServiceFilterIntegrationTest fails when requestTimeout is set in the constructor |
There was a problem hiding this comment.
NA, was a pre-existing TODO
| return new ArrayList<>(); | ||
| } | ||
|
|
||
| // Map<UUID, Trait> dbVariablesMap = dbVariables.stream().collect(Collectors.toMap(Trait::getId, p -> p)); |
There was a problem hiding this comment.
Should this still be commented out?
|
|
||
| List<BrAPIObservationVariable> variables = searchVariables(ids); | ||
|
|
||
| // TODO: make sure have all expected external references |
There was a problem hiding this comment.
NA, was a pre-existing TODO
|
|
||
| List<BrAPIObservationVariable> variables = searchVariables(ids); | ||
|
|
||
| // TODO: make sure have all expected external references |
There was a problem hiding this comment.
NA, was a pre-existing TODO
| @Override | ||
| public List<Trait> createTraitsBrAPI(List<Trait> traits, User actingUser, Program program){ | ||
|
|
||
| //TODO: Pass ontology reference |
There was a problem hiding this comment.
NA, was a pre-existing TODO
|
|
||
|
|
||
| // POST variables to each brapi service | ||
| // TODO: If there is a failure after the first brapi service, roll back all before the failure. |
There was a problem hiding this comment.
NA, was a pre-existing TODO
|
|
||
| @Override | ||
| public Trait updateTraitBrAPI(Trait trait, Program program) { | ||
| //TODO: Need to roll back somehow if there is an error |
There was a problem hiding this comment.
NA, was a pre-existing TODO
|
Developer Testing failed -
Expected result Actual result NOTE |
…allow for immediate consistency to the UI
|
passed my Developer testing |
HMS17
left a comment
There was a problem hiding this comment.
Tests passed!
Brapi:
- Single trait add passes
- Batch trait import passes
- Batch germplasm import passes
- Germplasm table display passes
- Germplasm list table display passes
- Germplasm export passes
BB:
- First single trait add passes
- Second single trait add passes
- Batch trait import passes
- Batch germplasm import passes and germplasm displayed for two imports
- Displaying germplasm lists errors - but error also shows up in qa-test
BI-1555 - Cache program ontology terms
BI-1555 - Cache program ontology terms
Description
Story: https://breedinginsight.atlassian.net/browse/BI-1555
ProgramCacheto utilize Redis instead of Guava'sLoadingCache.TraitDAOOne set of changes that appears rather irrelevant to the story is with
ProgramDAOandTraitDAObeing refactored to interfaces, and then the creation ofProgramDAOImpl,TraitDAOImpl, andAbstractDAO. The main reason for this was when trying to mock the originalProgramDAOorTraitDAO, errors were thrown when creating the mocks. The fix for this (per Micronaut) is to have interfaces for things you'd like to mock, especially if the class being mocked extends another class. By creating an interface, mocking is much simpler, and doesn't run into any issues due to inheritance.Dependencies
Redis container -> this has been added to the
docker-compose.ymlfile in bi-api, so you should be able to start up that container, and the code will default tolocalhost:6379to look for a Redis server to connect to.Testing
Test traits:
cache loading complete for key: <programUUID>:trait(you may want to wait until you see your program UUID of interest)Test germplasm:
cache loading complete for key: <programUUID>:brapigermplasm(you may want to wait until you see your program UUID of interest)Test restart (records should persist in redis between bi-api restarts):
Checklist: