Commit Graph

53 Commits

Author SHA1 Message Date
Sam Brannen 33ee0ea4a6 Fix broken test in ContentAssertionTests 2013-01-15 11:56:27 +01:00
Rossen Stoyanchev b2d6596901 Add contentTypeCompatibleWith option to Spring MVC Test
An expectation such as content().contentType(MediaType.TEXT_PLAIN)
fails if the actual media type contains a charset or another parameter.
A new method allows comparing the media type and subtype only via
content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN).

Issue: SPR-10165
2013-01-14 22:00:55 -05:00
Chris Beams bfdc191035 Merge branch 'SPR-10093' into 3.2.x
* SPR-10093:
  Polish changes from pull request #205
2013-01-11 16:35:08 +01:00
Chris Beams 74137794da Polish changes from pull request #205
- Replace space intendation with tabs
 - Remove leading tabs on otherwise empty lines
 - Remove illegal {@link ...} syntax in Javadoc @see reference

Issue: SPR-10093
2013-01-11 16:32:52 +01:00
Sam Brannen 18bf860c27 Update Javadoc for MockMvc
Deleted reference to the obsolete configureWarRootDir() method from the
stand-alone spring-test-mvc project.
2013-01-11 00:31:37 +01:00
Chris Beams 0829cbfdd3 Update license header for recently modified files
Issue: SPR-7763, SPR-10140, SPR-10132, SPR-10093, SPR-10103
2013-01-08 16:23:46 +01:00
Arnaud Cogoluègnes a56d8f28fe Add support for HTTP OPTIONS in Spring MVC Test
Issue: SPR-10093
2013-01-08 10:01:51 -05:00
Chris Beams 4c8cd7b0bd Add @Override annotations to test sources
Issue: SPR-10129
2012-12-28 23:05:44 +01:00
Chris Beams 4d97ff2479 Fix [dep-ann] warnings with @Deprecated 2012-12-28 22:50:45 +01:00
Phillip Webb 6c14eaad61 Fix [cast] compiler warnings 2012-12-28 22:41:06 +01:00
Phillip Webb 2cf45bad86 Replace space indentation with tabs
Issue: SPR-10127
2012-12-28 20:49:56 +01:00
Phillip Webb 1762157ad1 Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
    xargs perl -p -i -e "s/[ \t]*$//g" {} \;

Issue: SPR-10127
2012-12-28 20:49:45 +01:00
Craig Walls ccb1153440 Fix JavaDoc in MockRestServiceServer 2012-12-14 10:07:50 -05:00
Chris Beams f26534700a Eliminate all Javadoc warnings
- Support external Javadoc links using Gradle's javadoc.options.links

 - Fix all other Javadoc warnings, such as typos, references to
   non-existent (or no longer existent) types and members, etc,
   including changes related to the Quartz 2.0 upgrade (SPR-8275) and
   adding the HTTP PATCH method (SPR-7985).

 - Suppress all output for project-level `javadoc` tasks in order to
   hide false-negative warnings about cross-module @see and @link
   references (e.g. spring-core having a @see reference to spring-web).
   Use the `--info` (-i) flag to gradle at any time to see project-level
   javadoc warnings without running the entire `api` task. e.g.
   `gradle :spring-core:javadoc -i`

 - Favor root project level `api` task for detection of legitimate
   Javadoc warnings. There are now zero Javadoc warnings across the
   entirety of spring-framework. Goal: keep it that way.

 - Remove all @link and @see references to types and members that exist
   only in Servlet <= 2.5 and Hibernate <= 4.0, favoring 3.0+ and 4.0+
   respectively. This is necessary because only one version of each of
   these dependencies can be present on the global `api` javadoc task's
   classpath. To that end, the `api` task classpath has now been
   customized to ensure that the Servlet 3 API and Hibernate Core 4 jars
   have precedence.

 - SPR-8896 replaced our dependency on aspectjrt with a dependency on
   aspectjweaver, which is fine from a POM point of view, but causes
   a spurious warning to be emitted from the ant iajc task that it
   "cannot find aspectjrt on the classpath" - even though aspectjweaver
   is perfectly sufficient. In the name of keeping the console quiet, a
   new `rt` configuration has been added, and aspectjrt added as a
   dependency to it. In turn, configurations.rt.asPath is appended to
   the iajc classpath during both compileJava and compileTestJava for
   spring-aspects.

Issue: SPR-10078, SPR-8275, SPR-7985, SPR-8896
2012-12-12 12:55:10 +01:00
Phillip Webb c8a3562933 Update test tiles.xml files to use v3 DTD
Update tiles.xml files used with tests to reference tiles-config_3_0
instead of tiles-config_2_1 DTD.

Prior to this commit tiles based tests would fail when building
offline or behind a proxy server.
2012-12-10 15:39:47 -08:00
Sam Brannen a436a57503 Move tests to spring-test module
When Spr9799XmlConfigTests and Spr9799AnnotationConfigTests were
created, there were issues with the classpath related to slf4j
dependencies that made it impossible for these classes to reside in the
spring-test module. Consequently, these tests were added to the
spring-test-mvc module. However, the issues with slf4j have since been
resolved in the Gradle build, and this commit therefore moves these test
classes to the spring-test module where they belong.

Issue: SPR-9799
2012-12-08 14:26:47 +01:00
Rossen Stoyanchev 3643d92cb8 Fix issue with creating ServletRequestAttributes
Prevously the FrameworkServlet created a new ServletRequestAttributes
instance for every request, unless the RequestContextHolder already
contained an instance whose type is not ServletRequestAttributes.
The main intent was that if RequestContextHolder contains a
PortletRequestAttributes, it should be left in place.

This change does an "instanceof" check against the request in
RequestContextHolder instead of an "equals" check on the type.
It still leaves PortletRequestAttributes in place but also allows
the previous request to be any sub-class of ServletRequestAttributes.

Issue: SPR-10025
2012-12-07 15:19:38 -05:00
Sam Brannen 69ace01640 Clean up warnings in spring-test
- Deleted unused imports.

 - Switched from junit.framework.Assert to org.junit.Assert, since the
   former is deprecated as of JUnit 4.11.

 - Suppressed warnings for continued deprecated usage of
   junit.framework.Assert.
2012-12-07 12:26:27 +01:00
Rossen Stoyanchev 31cb14e03a Remove Spring Security sample tests in spring-test-mvc
Those tests as well as Spring Hateoas tests will be added to respective
projects instead.
2012-12-05 19:10:13 -05:00
Sam Brannen ffd040b8d2 Javadoc in MockMvcClientHttpRequestFactoryTests
The Javadoc in MockMvcClientHttpRequestFactoryTests had been copied and
pasted from WebAppResourceTests. This commit updates the documentation
in MockMvcClientHttpRequestFactoryTests to reflect what the tests do.
2012-12-04 14:58:22 +01:00
Rossen Stoyanchev 9643ff3f1d Polish StandaloneMockMvcBuilder
Issue: SPR-10053
2012-12-03 15:11:12 -05:00
Rob Winch 157a1d6ee2 Rename MvcAsyncTask to WebAsyncTask
The name MvcAsyncTask is misleading because the class is part of Spring
Web as apposed to Spring MVC. This is also inconsistent with the other
async classes which use Web instead of Mvc.

This commit changes MvcAsyncTask to WebAsyncTask making it more
consistent with the jar it is found in and the other async classes.

Issue: SPR-10051
2012-11-28 16:55:45 -05:00
Rossen Stoyanchev 79edf627db Fix failing test from last commit
Issue: SPR-9917
2012-11-26 15:31:21 -05:00
Rossen Stoyanchev 3a50dafc90 Add MockMvcClientHttpRequestFactory
Issue: SPR-9917
2012-11-26 14:23:12 -05:00
Rossen Stoyanchev f30d33d32e Add spring-test-mvc tests with Spring HATEOAS links
Issue: SPR-9886
2012-11-26 13:00:00 -05:00
Rossen Stoyanchev 92ca8b32fb Add DefaultMvcResultTests 2012-11-16 09:48:12 -05:00
Rossen Stoyanchev f8bf577eff Fix failures in PrintingResultHandlerTests 2012-11-15 11:26:14 -05:00
Rossen Stoyanchev 8afcf717e2 Fix failing test from previous commit 2012-11-15 10:15:34 -05:00
Rossen Stoyanchev 1f2e89e3ed Print async result in Spring MVC Test ResultHandler 2012-11-15 09:45:38 -05:00
Rossen Stoyanchev 9e22ac496d Remove a couple more dependencies on hamcrest-lib
Issue: SPR-9961
2012-11-07 17:13:20 -05:00
Rossen Stoyanchev 4812fcccc4 Remove dependency on hamcrest-lib from spring-mvc-test
The change removes the use of concrete Matcher implementations and thus
the dependency on hamcrest-lib leaving hamcrest-core as the only
(optional) hamcrest dependency.

Issue: SPR-9961
2012-11-07 17:06:56 -05:00
Rossen Stoyanchev c348be2511 Add RequestBuilder for async dispatches
This change enanbles performing async dispatches via Spring MVC Test.
2012-11-05 21:18:06 -05:00
Rossen Stoyanchev 38cf91922c Fix intermittent test failure in AsyncTests 2012-11-05 11:51:02 -05:00
Rossen Stoyanchev 242bf7c4e3 Refine hamcrest dependency in spring-test-mvc project
1) removed the hamcrest-all dependency requirement and replaced it with
the more focused hamcrest-library dependency

2) added MatcherAssertionErrors as a replacement of
org.hamcrest.MatcherAssert, which in hamcrest 1.1 is only available
through the hamcrest-all dependency (and not in hamcrest-core nor in
the hamcrest embedded in JUnit 4.4 through 4.8)

3) changed the required hamcrest version from 1.1 to 1.3 and made sure
the spring-test-mvc project does not rely on newer hamcrest
functionality without checking if it is available first

Applications that already depend on older versions of hamcrest
(in particular 1.1) via hamcrest-library, hamcrest-all or as part of
junit 4.4 through 4.8 should not be disrupted if they add spring-test
but may wish to exclude the hamcrest-library transitive dependency
from spring-test in order to avoid extra jars in the classpath

Applications that depend on hamcrest 1.3 should not have to do anything

Issue: SPR-9940
2012-11-01 23:58:50 -04:00
Sam Brannen 462605987d Delete unused import 2012-10-31 17:46:24 +01:00
Sam Brannen 0b45daf5e9 Assess claims made in SPR-9799
This commit validates the claims made in SPR-9799.

 - Spr9799XmlConfigTests demonstrates that a WAC is not always necessary
   when integration testing with XML configuration that uses
   <mvc:annotation-driven />.

 - Spr9799AnnotationConfigTests demonstrates that a WAC is in fact
   necessary when integration testing with a configuration class that
   uses @EnableWebMvc.

Issue: SPR-9799
2012-10-31 17:41:25 +01:00
Rossen Stoyanchev d701464517 Add onTimeout/onCompletion callbacks to DeferredResult
Issue: SPR-9914
2012-10-30 21:58:44 -04:00
Phillip Webb 39682b7d3f Upgrade to Hamcrest 1.3 2012-10-30 15:52:46 -07:00
Rossen Stoyanchev f7ec738857 Sync up MockAsyncContext implementations in src/test 2012-10-28 12:10:38 -04:00
Rossen Stoyanchev fe77c3d5fe Fix failing test 2012-10-26 22:01:35 -04:00
Rossen Stoyanchev f036ed639f Polish (major) MVC async processing interceptors
New afterTimeout and afterCompletion callbacks

afterTimeout can provide a concurrent result to be used instead of the
one that could not be set or returned on time

Interceptor exceptions cause async processing to resume treating the
exception as the concurrent result

Adapter classes for convenient implementation of the interfaces

Issue: SPR-9914
2012-10-26 18:04:27 -04:00
Rossen Stoyanchev 3bb515bec7 Improve async support in Spring MVC Test
When obtaining an async result, tests will now await concurrent
processing to complete for the exact amount of time equal to the
actual async timeout value.

Issue: SPR-9875
2012-10-22 21:28:43 -04:00
Rossen Stoyanchev 8270d82bda Fix failing test
Issue: SPR-7905
2012-10-22 20:09:38 -04:00
Rossen Stoyanchev 0a10f95e18 Shorten package name for Spring MVC Test framework 2012-10-18 14:20:45 -04:00
Rossen Stoyanchev caf2af077a Polish MockHttpServletRequestBuilder 2012-10-17 11:22:06 -04:00
Rossen Stoyanchev 300ab4537b Add Spring 32 methods to StandaloneMockMvcBuilder 2012-10-15 12:17:39 -04:00
Rossen Stoyanchev 365a42da64 Add file upload test to Spring MVC Test 2012-10-12 09:17:27 -04:00
Rossen Stoyanchev f7943786de Polish Spring MVC Test code
Remove use of UriTemplate in MockMvcRequestBuilders.
Rely on UriComponentsBuilder instead.

Decode query params before setting them on MockHttpServletRequest.

Add more options to model result matching for the count of errors.

Ignore white spaces and comments when comparing XML.
2012-10-11 22:18:22 -04:00
Rossen Stoyanchev 2748f2b8eb Remove deprecated methods in spring-test-mvc 2012-10-10 16:10:49 -04:00
Rossen Stoyanchev e7a7f751b6 Prefix REST client test support classes w/ "MockRest"
Add "MockRest-" prefix to RequestMatchers and ResponseCreators to
make it easy to find classes with static imports with
Ctrl+Shift+T "MockRest" - similar to the "MockMvc"
prefix on the server-side.
2012-10-10 15:44:51 -04:00