Commit Graph

283 Commits (3fbf1a2ea618cf50d350a975b2771494bfdb17c9)

Author SHA1 Message Date
Madhura Bhave c0d4a771c9 Use new configuration properties in spring-boot-test
Update `spring-boot-test` to use the new configuration properties
support.

See gh-9000
8 years ago
Phillip Webb 06558675bb Polish 8 years ago
Phillip Webb 81fef71fcb Merge branch '1.5.x' 8 years ago
Phillip Webb 5abc050a96 Support detection and with test initializers
Relax `SpringBootTestContextBootstrapper` rules so that a test can
specify an `ApplicationContextInitializer` and still have
`@SpringBootConfiguration` detected.

Prior to this commit detection would not occur because it's possible
that an initializer _could_ register configuration. This scenario is
actually quite unlikely to occur, certainly less likely than wanting to
use an initializer in combination with auto-detection.

Fixes gh-8483
8 years ago
Phillip Webb 850517a8db Fix merge issue 8 years ago
Phillip Webb 94209e2883 Merge branch '1.5.x' 8 years ago
Phillip Webb 393c17b68b Support @SpringBootTest with @ContextHierarchy
Update SpringBootTestContextBootstrapper to detect `@ContextHierarchy`
annotations so that only the last child creates a
`WebApplicationContext`.

Prior to this commit a context hierarchy would start two embedded web
servers which is inconsistent with the `SpringApplicationBuilder`
behavior.

Fixes gh-8311
8 years ago
Phillip Webb 8eb79b3c0f Polish 8 years ago
Phillip Webb 383640d5ec Merge branch '1.5.x' 8 years ago
Phillip Webb f46d799f31 Polish 8 years ago
Madhura Bhave ed072abaef Merge branch '1.5.x' 8 years ago
Madhura Bhave 9e2d54feae Support json view with JacksonTester
Closes gh-8672
8 years ago
Phillip Webb 700f0ea93c Fix WebClientTest calls
Update calls to WebClientTest following upstream changes.
8 years ago
dreis f3bbbc4530 Use JDK hashCode() variants for primitives
See gh-8768
8 years ago
Andy Wilkinson ef72c22563 Update HtmlUnitDriver tests to align with HtmlUnit 2.26
See gh-8853 and cb34189c66
8 years ago
Stephane Nicoll 6d6d76ca06 Polish
See gh-8543
8 years ago
Madhura Bhave 0b1d32e762 Add tests for TestRestTemplate in reactive env
Closes gh-8543
8 years ago
Phillip Webb b76ca0bf8f Restructure web auto-configuration
Restructure `org.springframework.boot.autoconfigure.web` to better align
with the new package structure in `spring-boot`.

Auto-configuration is now split into client, servlet and reactive
sub-packages. In addition a new `http` package now handles common
HTTP concerns.

Fixes gh-8616
8 years ago
Phillip Webb 33e54ed723 Relocate `org.springframework.boot.web.support`
Move `org.springframework.boot.web.support` under the `servlet` package.

Fixes gh-8557
8 years ago
Phillip Webb b1c689b9b2 Unify WebServerFactory implementations
Unify common for from the abstract `ServletWebServerFactory` and
`ReactiveWebServerFactory` classes. Common code is now located in
`AbstractConfigurableWebServerFactory`.

Fixes gh-8631
8 years ago
Phillip Webb 67556ba8ea Restructure embedded web server packages
Rework `org.springframework.boot.context.embedded` to relocate classes
to `org.springframework.boot.web`. Packages are now organized around
the following areas:

Packages for shared concerns, for example the `WebServer` interface
to start/stop a server and the common configuration elements:
- org.springframework.boot.web.context
- org.springframework.boot.web.server

Servlet specific packages:
- org.springframework.boot.web.servlet.server
- org.springframework.boot.web.servlet.context
- org.springframework.boot.web.servlet.filter

Reactive specific packages:
- org.springframework.boot.web.reactive.context
- org.springframework.boot.web.reactive.server

Embedded server implementations (both reactive and servlet):
- org.springframework.boot.web.embedded

In addition:

- Rename `EmbeddedServletContainerFactory` to `ServletWebServerFactory`
  to align with the `ReactiveWebServerFactory`.
- Rename `EmbeddedWebApplicationContext` to
  `ServletWebServerApplicationContext` and
- Rename `EmbeddedReactiveWebApplicationContext` to
  `ReactiveWebServerApplicationContext`.
- Add checkstyle rules to restrict imports.
- Fixup all affected code to use the correct imports and local names.

Fixes gh-8532
8 years ago
Andy Wilkinson 62de505e43 Update tests to align with slight change in HtmlUnit's behaviour
See gh-8515
8 years ago
Stephane Nicoll 361ad69a4b Merge branch '1.5.x' 8 years ago
Stephane Nicoll c8ac94b75d Polish contribution
Closes gh-8490
8 years ago
Roland Weisleder a6f0da8cc6 Introduce reset method to OutputCapture
Closes gh-8390
8 years ago
Phillip Webb d8f827d224 Cleanup and format code 8 years ago
Phillip Webb 425dbc3e52 Update copyright header for edited files 8 years ago
Phillip Webb 2a592103f0 Polish formatting 8 years ago
Spring Buildmaster d23fa24340 Next Development Version 8 years ago
Stephane Nicoll f143ec52a6 Fix Javadoc of `WebEnvironment`
Closes gh-8469
8 years ago
Andy Wilkinson e20219aac9 Merge branch '1.5.x' 8 years ago
Andy Wilkinson 545b29552d Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 98cf35d48e Polish "Ignore spock.lang annotations when creating test context cache key"
See gh-8252
8 years ago
erlholmq 8f18df8a9c Ignore spock.lang annotations when creating test context cache key
See gh-7524
Closes gh-8252
8 years ago
Phillip Webb a4bcd20b64 Merge branch '1.5.x' 8 years ago
Phillip Webb ca1540cefe Update header copyright for changed files 8 years ago
Phillip Webb 5867cd6175 Polish 8 years ago
Stephane Nicoll c5595f296c Add support for Mock test with WebFlux
This commit add mock support for WebFlux with an infrastructure similar
to what `WebMvcTest` provides. `@WebFluxTest` can be used to test
controllers with a narrowed classpath that is relevant to WebFlux. Also,
`@SpringBootTest` now starts WebFlux in "mock" mode by default and
`@AutoConfigureWebTestClient` can be used to inject a `WebTestClient`
connected to the `ApplicationContext`.

To make that happen, a `ReactiveWebApplicationContext` interface has been
introduced to mirror what `WebApplicationContext` currently does. Things
are still a bit volatile at this point and that infra may move to Spring
Framework at some point.

Closes gh-8401
8 years ago
Stephane Nicoll 12397edbd4 Expose a WebTestClient with `@SpringBootTest`
This commit exposes a `WebTestClient` automatically in a reactive
integration test that uses an embedded web server. This is similar to
what we do with `TestRestTemplate` for servlet based integration tests.

Closes gh-8399
8 years ago
Stephane Nicoll 54939e8e3c Start a reactive web application if necessary
This commit makes sure that `@SpringBootTest` with a reactive setup
starts a web application if necessary.

If both a servlet and a reactive environment are available, a servlet
environment is bootstraped. This commit also adds a way to force a
reactive environment by specifying the `spring.main.web-application-type`
property of the test (e.g. `@TestPropertySource`).

Closes gh-8383
8 years ago
Andy Wilkinson fcd1eb79fc Fix forward merge of new SpyBean test to use correct Mockito 2 API 8 years ago
Andy Wilkinson 1e806bbbd2 Merge branch '1.5.x' 8 years ago
Andy Wilkinson 8318177b0d Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 70e802fba5 Use name from @SpyBean to disambiguate multiple candidates
Previously, @SpyBean's name attribute was not used when determining
the name of the bean to spy upon. When there were multiple candidates,
none of which were primary, this would lead to a failure to find the
bean to spy upon. This behaviour is also inconsistent with @MockBean
which does use the name attribute to identify the bean to mock.

This commit updates MockitoPostProcessor to use the name attribute,
when set, to identify the bean that should be spied upon. For
consistency with @MockBean it is always used when set. When not set
the previous logic will continue to be used.

Closes gh-8315
8 years ago
Andy Wilkinson 13791cad53 Use DefaultUriBuilderFactory instead of DefaultUriTemplateHandler
Closes gh-8247
8 years ago
Brian Clozel 12d883f6b9 Introduce "server.servlet" configuration prefix
This commit refactors the `ServerProperties` property keys and
introduces a separate "server.servlet" namespace to isolate
servlet-specific properties from the rest.

Closes gh-8066
8 years ago
Brian Clozel 250a1601d7 Add WebApplicationType.REACTIVE type
This commit introduces a new variant of web applications: there are now
Servlet based and Reactive web applications.
The mere presence of `Servlet` and `ConfigurableWebApplicationContext`
classes is not enough to make a difference between those variants.
This is why the decision process is now the following:

* if `DispatcherHandler` is present but not `DispatcherServlet`, the
WebApplicationType is detected as REACTIVE
* if `DispatcherHandler` is present and `DispatcherServlet`, this is a
case where we consider that developers are using Spring MVC in
combination with the reactive web client. So WebApplicationType is
detected as SERVLET
* if `Servlet` and `ConfigurableWebApplicationContext` are present,
WebApplicationType is detected as SERVLET
* if none of the above match, WebApplicationType is NONE

Fixes gh-8017
8 years ago
Stephane Nicoll cfdc75d384 Merge branch '1.5.x' 8 years ago
Johnny Lim 0adab8a2be Use logical 'and' instead of bitwise 'and'
Closes gh-8198
8 years ago
Andy Wilkinson aa19cad770 Merge branch '1.5.x' 8 years ago