Commit Graph

8151 Commits (06b81cf16f91da74ef734a1b0989886e1ed9dca7)
 

Author SHA1 Message Date
Phillip Webb 433f5e7930 Configure TestRestTemplate using builder
Update SpringBootTestContextCustomizer to create the TestRestTemplate
using the RestTemplateBuilder whenever possible.

Fixes gh-5509
9 years ago
Phillip Webb e1d74627f5 Make test auto-configuration classes public
Make test auto-configuration classes public so that they can be used
by others with @AutoConfigureBefore/@AutoConfigureAfter.

Fixes gh-6073
9 years ago
Phillip Webb b84330663d Update spring-boot-sample-test REST code
Update RemoteVehicleDetailsService and the related test to use the new
RestTemplateBuilder class and @RestClientTest annotation.

See gh-6030
See gh-5507
9 years ago
Phillip Webb 0a475946a1 Document RestTemplateBuilder and @RestClientTest
See gh-6030
See gh-5507
9 years ago
Phillip Webb 2eafb3d887 Add @RestClientTest support
Add @RestClientTest annotation that can be used when testing REST
clients. Provides auto-configuration for a MockRestServiceServer which
can be used when the bean under test builds a single RestTemplate
via the auto-configured RestTemplateBuilder.

Closes gh-6030
9 years ago
Phillip Webb b38231021d Provide web client Auto-configuration
Add auto-configuration for use with typical web clients. Currently
client auto-configuration consists of a RestTemplateBuilder
pre-configured with HttpMessageConverters.

Closes gh-5507
9 years ago
Phillip Webb b641e63466 Add RestTemplateBuilder support
Add a RestTemplateBuilder that allows RestTemplates to be easily created
and configured.

See gh-5507
9 years ago
Phillip Webb e664d585d9 Allow MockRest static imports
Update checkstyle rules to allow static imports from
MockRestRequestMatchers and MockRestResponseCreators.
9 years ago
Phillip Webb bc6f1cfdf3 Polish 9 years ago
Stephane Nicoll 68040c952f Merge pull request #6075 from izeye:patch-49
* pr/6075:
  Fix default value for `spring.rabbitmq.connection-timeout`
9 years ago
Johnny Lim d28c1890a2 Fix default value for `spring.rabbitmq.connection-timeout`
Closes gh-6075
9 years ago
Stephane Nicoll 71917abccf Fix typo
See gh-6004
9 years ago
Andy Wilkinson 4a73eb6045 Fix capitalization of TestDatabaseAutoConfiguration in spring.factories
The joys of OS X's case-insensitive, case-preserving file system

See gh-6001
9 years ago
Andy Wilkinson 73b01cff4f Use spring.factories to declare each test slice's auto-config imports
Closes gh-6001
9 years ago
Stephane Nicoll 1b0bbd89a2 Reuse ApplicationEventMulticaster
Spring Framework allows a custom `ApplicationEventMulticaster` bean to be
defined with a well-defined bean. If such bean is present, it is used
instead of the default implementation.

This commit fixes `EventPublishingRunListener` to properly honour such
arrangement. Rather than registering a `ApplicationEventMulticaster` to
transmit the application listeners from the `SpringBootApplication` it
now only uses an internal multicaster for early events (i.e. events that
are fired before the context is actually refreshed).

This has the positive effect of making sure that `ApplicationReadyEvent`
is fired to the proper multicaster.

Closes gh-6048
9 years ago
Andy Wilkinson b968c2c7af Start building against Spring Framework 4.3 snapshots
See gh-6049
9 years ago
Andy Wilkinson 29ac6fc154 Tolerate API changes between Tomcat 7 and Tomcat 8
See gh-6053
9 years ago
Andy Wilkinson a5ad2b33ab Enable JNDI lookups during app context refresh without changing TCCL
When Tomcat is starting up and JNDI is enabled, it binds the web app
class loader into its ContextBindings, thereby enabling JNDI lookups
on any thread that uses the web app class loader as its thread context
class loader. When Boot starts an application, the application context
is refreshed on the main thread which has the app class loader as its
TCCL. This meant that any JNDI lookups performed during refresh would
fail.

gh-2038 described this problem and a fix was made in ff99bb0. The
fix was to set the main thread's TCCL to be Tomcat's web app class
loader. This fixed the JNDI lookup problem, but it has become apparent
that it has caused other problems when testing an application.

The fix for gh-2038 sets the main thread's TCCL when embedded Tomcat
starts (during application context refresh) and then restores it when
embedded Tomcat stops (as a result of the application context being
closed). This causes problems during testing as, when application
context's are cached, the close is delayed. This means that the main
thread's TCCL isn't restored, causing subsequent tests to run with the
wrong TCCL.

This commit takes a different approach to fixing gh-2038. Rather than
changing the main thread's TCCL, it binds the app class loader into
Tomcat's ContextBindings, thereby enabling JNDI lookups from the main
thread. To avoid leaving a reference to the app class loader in
Tomcat's ContextBindings, it unbinds the app class loader at the end
of application context refresh. This narrows the scope of the fix so
that it only applies during application context refresh which is the
period in which JNDI lookups were problematic.

Note that the original fix could have been modified to restore the
TCCL once context refresh has completed rather than waiting for the
context to be closed. However, my feeling is that leaving the TCCL
unchanged and specifically addressing the JNDI problem by manipulating
the context bindings is a more precise, and hopefully safer,
solution.

Closes gh-6053
9 years ago
Stephane Nicoll b6ab929162 Merge branch '1.3.x' 9 years ago
Stephane Nicoll b49c6ca616 Fix link in doc
Closes gh-6033
9 years ago
Andy Wilkinson 8c9c649805 Fix MongoPropertiesTests following upgrade to Mongo 3.2 (6f5bd2e)
See gh-3011
9 years ago
Stephane Nicoll 306a82e652 Merge pull request #6046 from izeye:polish-2016052
* pr/6046:
  Polish
  Polish
9 years ago
Stephane Nicoll deb6c9a4f6 Polish 9 years ago
Johnny Lim 70adefc87b Polish
Closes gh-6046
9 years ago
Andy Wilkinson 6f5bd2e13a Upgrade to MongoDB 3
This commit upgrades to MongoDB 3. Dependency management has been added
for the new and preferred mongodb-driver artifact. The starter has
been updated to use this new artifact rather than monogo-java-driver.
Dependency management for mongo-java-driver has been retained to avoid
causing problems for people who have declared the dependency explicitly.
The auto-configuration for Embedded Mongo has also been updated to
use 3.2.2 by default.

Closes gh-3011
9 years ago
Stephane Nicoll 44b4df2d3d Deprecate hornetq support
Closes gh-6034
9 years ago
Andy Wilkinson 280ac90cef Polishing 349ec76: remove use of the diamond operator 9 years ago
Andy Wilkinson 349ec76e62 Update @WebMvcTest to auto-configure Spring HATEOAS
Closes gh-6043
9 years ago
Stephane Nicoll ed102b2714 Merge pull request #6010 from venilnoronha:issue-6003-fix
* pr/6010:
  Polish "Add activemq starter" contribution
  Add activemq starter
9 years ago
Stephane Nicoll f257b6a0b5 Polish "Add activemq starter" contribution
Closes gh-6010
9 years ago
Venil Noronha a5066f4d7a Add activemq starter
Closes gh-6003
9 years ago
Phillip Webb ccdcad757a Allow template lookup caching to be disabled
Extract TemplateAvailabilityProvider caching logic to a new
TemplateAvailabilityProviders class and provide property support to
disable it. Also update DevToolsPropertyDefaultsPostProcessor to
automatically set the property.

Fixes gh-5989
9 years ago
Phillip Webb 14c7a1284e Formatting 9 years ago
Andy Wilkinson bda2e766ac Merge branch '1.3.x' 9 years ago
Andy Wilkinson 9f425343ae Make FileSystemWatcherTests thread-safe
The list of changes is written to on one thread and read from on
another. Without some form of sychronization this is not thread-safe.

This commit makes changes a synchronized list which should guarantee
that the reading thread can see the changes made by the writing thread.
It also removes a redundant call to clear the list of changes at the
start of waitsForPollingInterval.

See gh-6038
9 years ago
Andy Wilkinson ac5afb142c Merge branch '1.3.x' 9 years ago
Andy Wilkinson a98d1a41a4 Run Maven Plugin's integration tests when full profile is active
Closes gh-6036
9 years ago
Andy Wilkinson fc1814919c Add jars that should have been commited in 6ed63a6 9 years ago
Stephane Nicoll 50e0bb2d9c Improve DataJpaTest documentation
As `@DataJpaTest` is meta-annotated with `@Transactional`, all data jpa
tests are transactional and rollback at the end of each test. It is
possible to tune that in many ways, including disabling the transaction
per test or per test class.

This commit improves the doc to explain those concepts.

Closes gh-5993
9 years ago
Andy Wilkinson ccd19ce2c3 Merge branch '1.3.x' 9 years ago
Andy Wilkinson 275651e89a Skips Cassandra and Elasticsearch tests on Windows
Neither Cassandra nor Elasticsearch starts reliably on Windows. This
commit adds a custom class rule to the associated sample application
tests to skip them on Windows. A class rule is used rather than a
Unit assumption as we want to avoid starting Elasticsearch (done by
the application context) and Cassandra (done by a test execution
listener) and an assumption would be too late.
9 years ago
Stephane Nicoll 6ed63a6eff Add support of system-scoped dependencies
In Maven land, provided and system-scope dependencies are very similar,
the latter being an special kind that allows you to specify the path to
the artifact rather than using the repository to locate it.

Prior to this commit, the repackage goal of the maven plugin was
inconsistent as it would repackage provided-scope dependencies but would
ignore the system-scoped ones.

This commit adds an extra boolean flag, `includeSystemScope` to control
this behaviour. For backward compatibility reasons, its default value is
`false`.

Closes gh-2224
9 years ago
Andy Wilkinson 98a039ea99 Clarify references to Commons Logging in the documentation 9 years ago
Stephane Nicoll 9ab5c09905 Add reference to `@TestPropertySource` in the doc
Closes gh-5899
9 years ago
Stephane Nicoll 8201c8d1f6 Merge pull request #5074 from vpavic:multiple-management-roles
* pr/5074:
  Polish contribution
  Support configuration of multiple management roles
9 years ago
Stephane Nicoll b02aba4c75 Polish contribution
Closes gh-5074
9 years ago
Vedran Pavic 20fa1b3b48 Support configuration of multiple management roles
Closes gh-5045
9 years ago
Andy Wilkinson e9a226c8f8 Fix handling of annotations on super classes in AnnotationsPropertySource
Closes gh-6006
9 years ago
Stephane Nicoll 3d0b682f0f Document `none` cache type
Closes gh-6004
9 years ago
Stephane Nicoll 9182ada260 Polish doc
Closes gh-6009
9 years ago