Commit Graph

104 Commits

Author SHA1 Message Date
Andy Wilkinson
6920c39349 Merge branch '1.3.x' into 1.4.x 2019-03-20 15:06:50 +00:00
Spring Operator
e2837843e1 Update build and setup configuration to use HTTPS
See gh-16244
2019-03-19 16:44:10 +00:00
Spring Buildmaster
88e43c8421 Next Development Version 2017-06-08 09:52:43 +00:00
Spring Buildmaster
d719d2cbbc Next Development Version 2017-04-20 12:46:19 +00:00
Spring Buildmaster
2a83e80a9b Next Development Version 2017-03-03 14:39:21 +00:00
Andy Wilkinson
1abd91dc23 Start building against Spring Framework 4.3.7 snapshots
See gh-8248
2017-02-20 14:05:04 +00:00
Spring Buildmaster
ed1ce140c0 Next Development Version 2017-01-26 14:20:39 +00:00
Phillip Webb
b05bdbfe4f Polish 2017-01-19 12:31:43 -08:00
Stephane Nicoll
ffa6d6d6e0 Improve error message used in TestDatabaseAutoConfiguration
By default, `@DataJpaTest` (and `@AutoConfigureTestDatabase`) attempt to
replace any existing `DataSource` by an embedded one. Previously, if
there is was no embedded database on the classpath, the exception message
did not provide that context in the error message.

This commit clarifies the error message to conduct
`TestDatabaseAutoConfiguration` (that is replacing the existing
`DataSource`).

Closes gh-7797
2017-01-19 16:13:49 +01:00
Spring Buildmaster
9057f9ae1f Next development version 2016-12-23 00:15:23 +00:00
Phillip Webb
bd74c3d327 Polish formatting 2016-12-19 12:25:09 -08:00
Phillip Webb
357d072a60 Polish 2016-11-28 15:14:46 -08:00
Stephane Nicoll
4bf645c615 AutoconfigureTestDatabase replace with a fresh database
Previously, two or more `@DataJpaTest` tests in the same test suite were
sharing the same in-memory database instance. This commit makes sure
that `TestDatabaseAutoConfiguration` creates a unique embedded database
for each test it operates on.

Closes gh-7473
2016-11-24 15:31:27 +01:00
Phillip Webb
74670cb20f Allow WebDriver beans to define their own scope
Update `WebDriverScope` so that only `WebDriver` beans with no explicit
scope are moved.

Fixes gh-7454
2016-11-22 15:48:28 -08:00
Andy Wilkinson
3423ca87b4 Ensure that RestClientTest can be used without Jackson on the class path
Closes gh-7431
2016-11-21 13:36:05 +00:00
Phillip Webb
bacf0878af Polish 2016-11-15 10:40:21 -08:00
Spring Buildmaster
e712a9ba8c Next Development Version 2016-11-08 16:55:37 +00:00
Stephane Nicoll
318701daa7 Apply DispatcherServlet customizations to MockMvc
This commits makes sure that customizations on `DispatcherServlet` are
also applied to the `TestDispatcherServlet` that `MockMvc` is using
internally.

Closes gh-5891
2016-11-08 10:56:54 +01:00
Stephane Nicoll
ebfd86ea26 Polish contribution
Closes gh-7326
2016-11-06 11:42:45 +01:00
sebastiankirsch
e8b0a64872 Add @Inherited to all AutoConfigure* classes
See gh-7326
2016-11-06 11:39:12 +01:00
Greg Potter
39d5881bf2 Respect 'primary' flag when replacing databases
Update TestDatabaseAutoConfiguration to ensure that the the `primary`
flag of the `BeanDefinition` is copied.

Closes gh-7217
2016-10-31 16:26:41 -07:00
Stephane Nicoll
a03ce0a9d1 Polish contribution
Add missing test

Closes gh-7193
2016-10-24 11:11:15 +02:00
Johnny Lim
0b5fbbedf4 Add a missing return
This commit adds a missing`return` in `getDataSourceBeanDefinition()`.

See gh-7193
2016-10-24 10:41:20 +02:00
Stephane Nicoll
6bd670edbc Initiate 1.4.x branch 2016-09-21 11:11:24 +02:00
Johnny Lim
a994b11a73 Polish 2016-09-18 23:38:21 -07:00
Phillip Webb
e239e64cb1 Only print MVC interactions when tests fail
Update `@AutoConfigureMockMvc` with a `printOnlyOnFailure` option which
allows errors to be printed only when tests fail. Defaults to `true`
meaning the logs are no longer cluttered with MVC results for passing
tests.

Fixes gh-6653
2016-09-18 23:37:46 -07:00
Andy Wilkinson
0a9bcd9893 Polish 2016-09-18 10:29:14 +01:00
Phillip Webb
ac2609b585 Fix WebDriver lifecycle issues
Update WebDriver support to ensure that the `.quit()` method is called
after each test method runs and that a new WebDriver instance is
injected each time.

Support is provided by introducing a new `Scope` which is applied by
a ContextCustomizerFactory and reset by a TestExecutionListener.

Fixes gh-6641
2016-09-18 00:18:29 -07:00
Phillip Webb
0ef845b96e Polish 2016-09-17 20:05:21 -07:00
Phillip Webb
82ae6e4049 Improve @AutoConfigureTestDatabase failure message
Fixes gh-6916
2016-09-17 19:56:25 -07:00
Phillip Webb
2c621f4094 Fix @AutoConfigureTestDatabase imports
Update `@AutoConfigureTestDatabase` so that it always imports
`DataSourceAutoConfiguration`. Prior to this commit the annotation
could only be applied if something else also imported DataSource
auto-configuration.

Fixes gh-6897
2016-09-16 16:49:36 -07:00
Phillip Webb
3e19f8aa8d Relax TestEntityManager @ID restriction
Change TestEntityManager so that entities with an ID can be persisted.

Fixes gh-6546
2016-09-15 17:22:52 -07:00
Phillip Webb
25c4e261e9 Fix failing tests
See gh-6897
2016-09-15 17:16:26 -07:00
Phillip Webb
46815fc483 Fix potential @AutoConfigureTestDatabase NPE
Protect against the situation where no DataSource beans can be found
at all.

Fixes gh-6897
2016-09-15 16:06:56 -07:00
Phillip Webb
ebb08c3655 Generate property meta-data for test projects
Add annotation processor to `spring-boot-test` and
`spring-boot-test-autoconfigure`.

Fixes gh-6893
2016-09-15 10:14:21 -07:00
Phillip Webb
7134586310 Ensure test @PostConstructs are only called once
Rename AutoConfigureReportTestExecutionListener to
SpringBootDependencyInjectionTestExecutionListener and ensure that it
replaces any existing DependencyInjectionTestExecutionListener.

Prior to this commit the registration of two DependencyInjection
listeners would cause @PostConstruct methods on tests to be called
twice.

In order to allow the standard DependencyInjectionTestExecutionListener
to be removed a new DefaultTestExecutionListenersPostProcessor interface
has been introduced.

Fixes gh-6874
2016-09-14 22:03:07 -07:00
Phillip Webb
41a36c4d40 Prevent CastCastException when stripping root URI
Update RootUriRequestExpectationManager to only wrap requests when
they cannot be cast to MockClientHttpRequest. This prevents later
ClassCastExceptions from being thrown with @RestClientTests that
define expected body content.

Fixes gh-6845
2016-09-12 12:44:31 -07:00
Phillip Webb
41dc53f5dd Polish 2016-09-07 08:34:45 -07:00
Stephane Nicoll
52d7282f5e Auto-configure JdbcTemplate with DataJpaTest
This commit adds `JdbcTemplateAutoConfiguration` to the list of auto-
configurations that are applied with `DataJpaTest`. This effectively
allows to inject a `JdbcTemplate` in any `@DataJpaTest` test.

Closes gh-6802
2016-09-02 09:38:07 +02:00
Stephane Nicoll
2c61064d93 Fix property prefix
This commit fixes the prefix for the WebClient and WebDriver auto-config
so that it complies with the prefix set on `AutoconfigureWebMvc`

Closes gh-6727
2016-08-23 17:11:14 +02:00
Johnny Lim
524edaea51 Polish
Closes gh-6728
2016-08-23 15:13:33 +02:00
Andy Wilkinson
5f7e966955 Enable MessageSourceAutoConfiguration when using @WebMvcTest
Closes gh-6608
2016-08-16 14:35:06 +01:00
Phillip Webb
f38bd7af37 Extract GSON/Jackson config to inner classes
Update JsonTestersAutoConfiguration so that GSON and Jackson specific
configuration are inner classes. This should prevent ClassNotFound
exception when the libraries are not on the classpath.

Fixes gh-6502
2016-08-02 15:14:30 -07:00
Brian Clozel
d62827373d Fix Bean Condition on GsonTester FactoryBean
This commit fixes the `@ConditionalOnClass` typo on the GsonTester
FactoryBean, which was testing for `ObjectMapper` instead of `Gson`.

This means that the next condition `@ConditionalOnBean(Gson.class)`
throws a `ClassNotFoundException: com.google.gson.Gson` since it's
trying to load that class to check for an existing Bean of that type.

Fixes gh-6502
2016-07-29 10:24:29 +02:00
Spring Buildmaster
334baaeffd Next development version 2016-07-28 19:54:01 +00:00
Phillip Webb
5d9836b3b1 Refine unmapped property support
Replace `@UnmappedPropertyValue` with a `skip` attribute on
`@PropertyMapping` so that any default attribute value can be skipped.

Closes gh-6455
2016-07-27 16:27:24 -07:00
Phillip Webb
162b9e84a3 Polish 2016-07-26 22:47:51 -07:00
Phillip Webb
296dc7132b Allow JSON Testers to be @Autowired
Switch `@AutoConfigureJsonTesters` to use regular `@Autowired` injection
for JSON testers. Prior to this commit JSON Tester fields were
initialized directly which caused IDE issues and was also a little
confusing.

Fixes gh-6451
2016-07-26 21:41:37 -07:00
Phillip Webb
4a1e0d4544 Extend @AutoConfigureMockMvc print support
Update @AutoConfigureMockMvc to support extended print options including
`System.err` and `log.debug`. In addition the "default" print option
can now be overridden by adding `spring.test.mockmvc.print=...` to
`src/test/resources/application.properties`.

Fixes gh-6455
2016-07-25 13:17:26 -07:00
Phillip Webb
8355d8516b Add @UnmappedPropertyValue support
Update @PropertyMapping support to allow single enum values to be marked
as an @UnmappedPropertyValue. This change is primarily so that users can
replace "default" values globally for across all tests.

See gh-6455
2016-07-25 13:13:16 -07:00