-
Notifications
You must be signed in to change notification settings - Fork 10
Freemabd1/rw 391 SpringBootTest to verify bindings work #730
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
Conversation
* New "select boxes" * Stylin * Stub in ethnicity * Tests & linting * Small bugfix, more linting
* Adding non-standard columns to observation table in CDM schema * Updating comment * Updated README
* Refactor detail tab pages to use single page * Add tab name
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.
Thanks for doing this!
@SpringBootTest(classes = {TestWebMvcConfig.class}) | ||
public class ApplicationTest { | ||
|
||
@Autowired |
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.
Do we have to list all these out here? Is it possible for us to programatically detect all bindings for services / controllers / etc. and test them? (We are likely to forget to add new stuff 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.
👍 It would be nice to not have to update this for all new controllers/services/etc.
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.
So it seems that Spring doesn't have a handy way to get beans with certain annotations like @service or @configuration. There is a way to get all bean definitions and iterate them. I'm working on a solution for this. It won't completely erase the need to manage this test but it will definitely minimized the affects when beans are added.
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.
Test now loads: @NoRepositoryBean, @service, @controller, @component and @configuration classes
@@ -0,0 +1,5 @@ | |||
insert into config (config_id, configuration) values |
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.
Add comment describing how this gets used / where it's referenced from?
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.
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.
OK. There's no direct reference to these files in ApplicationTest... can you describe the mechanism that causes them to get loaded?
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.
@@ -0,0 +1,16 @@ | |||
create table config ( |
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.
Add comment describing how this gets used / where it's referenced from?
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.
* Add ability to run just the tests * Remove unused options
* Not Found Page * Fix spacing * PR Comments * Move to better not found pattern. * Fix linting?
* Fix sidebar, cohort-review wrapper, persistent scrollbar * Add comment about height
* Remove imports, get rid of one getme call * Make loc public
…ialization. (#744) * Start * Fixes * Removing imports * PR comments * Removing log
…load beans were interested in testing.
@Test | ||
public void contextLoads() throws Exception { | ||
//This loads all dao's that implement JPA repositories | ||
Map<String, Object> repoBeans = context.getBeansWithAnnotation(NoRepositoryBean.class); |
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.
Nit: you could make an array with NoRepositoryBean.class and Component.class and loop over it below, rather than repeating the logic.
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.
//This loads all dao's that implement JPA repositories | ||
Map<String, Object> repoBeans = context.getBeansWithAnnotation(NoRepositoryBean.class); | ||
for (Map.Entry<String, Object> entry : repoBeans.entrySet()) { | ||
System.out.println(entry.getKey()); |
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.
Remove System.out?
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.
@@ -0,0 +1,5 @@ | |||
insert into config (config_id, configuration) values |
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.
OK. There's no direct reference to these files in ApplicationTest... can you describe the mechanism that causes them to get loaded?
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.
👍
…load beans were interested in testing.
…ench into freemabd1/RW-391
* RW-391 created applicaiton test. * RW-391 attempt at getting @SpringBootTest working. * RW-391 more experimentation. * RW-391 successfuly SpringBootTest! * RW-391 removed unused properties. * RW-391 moved test case to integration. * RW-391 replace with master copy. * Tweak deploy docs and logging (#731) * Js/demo form update (#728) * New "select boxes" * Stylin * Stub in ethnicity * Tests & linting * Small bugfix, more linting * Adding non-standard columns to observation table in CDM schema (#729) * Adding non-standard columns to observation table in CDM schema * Updating comment * Updated README * Refactor detail tab pages to use single page (#733) * Refactor detail tab pages to use single page * Add tab name * Fix "Google Bucket" link (#736) * RW-391 finding a way to programmatically test all beans. * Add ability to run just the tests (#735) * Add ability to run just the tests * Remove unused options * fix for new notebook button being truncated (#738) * Blrubenstein/not found page (#734) * Not Found Page * Fix spacing * PR Comments * Move to better not found pattern. * Fix linting? * Fix sidebar, cohort-review wrapper, persistent scrollbar (#737) * Fix sidebar, cohort-review wrapper, persistent scrollbar * Add comment about height * Clean up PR (#740) * RW-391 * Remove imports, get rid of one getme call (#741) * Remove imports, get rid of one getme call * Make loc public * Add BSD 3-clause LICENSE (#743) * [RW-514] Joining to tables after LIMIT where possible in cohort materialization. (#744) * Start * Fixes * Removing imports * PR comments * Removing log * RW-391 added comments to data.sql and schema.sql and programmtically load beans were interested in testing. * RW-391 cleanup of unused imports. * RW-391 removed unused inserts. * RW-391 removed println. * RW-391 added comment about initializing the database. * RW-391 added maps to list for iteration. * RW-391 created applicaiton test. * RW-391 attempt at getting @SpringBootTest working. * RW-391 more experimentation. * RW-391 successfuly SpringBootTest! * RW-391 removed unused properties. * RW-391 moved test case to integration. * RW-391 replace with master copy. * RW-391 finding a way to programmatically test all beans. * RW-391 * RW-391 added comments to data.sql and schema.sql and programmtically load beans were interested in testing. * RW-391 cleanup of unused imports. * RW-391 removed unused inserts. * RW-391 removed println. * RW-391 added comment about initializing the database. * RW-391 added maps to list for iteration.
No description provided.