Commit Graph

7873 Commits

Author SHA1 Message Date
Chris Beams
2ab2c2e9ce Merge pull request #172 from aclement/SPR-9751
* SPR-9751:
  Add SpEL support for increment/decrement operators
2012-10-24 03:23:04 +02:00
Andy Clement
f64325882d Add SpEL support for increment/decrement operators
With this commit the Spring Expression Language now supports
increment (++) and decrement (--) operators. These can be
used as either prefix or postfix operators. For example:
'somearray[index++]' and 'somearray[--index]' are valid.

In order to support this there are serious changes to the
evaluation process for expressions. The concept of a
value reference for an expression component has been introduced.
Value references can be passed around and at any time the actual
value can be retrieved (via a get) or set (where applicable). This
was needed to avoid double evaluation of expression components.
For example, in evaluating the expression 'somearray[index++]--'
without a value reference SpEL would need to evaluate the
'somearray[index++]' component twice, once to get the value and
then again to determine where to put the new value. If that
component is evaluated twice, index would be double incremented.
A value reference for 'somearray[index++]' avoids this problem.

Many new tests have been introduced into the EvaluationTests
to ensure not only that ++ and -- work but also that the
introduction of value references across the all of SpEL has
not caused regressions.

Issue: SPR-9751
2012-10-24 03:21:30 +02:00
Phillip Webb
33d37e8680 Polish 2012-10-23 07:07:59 -07: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
c7e7e80a3a Update AbstractView with method to set content type
Before this change View implementations set the response content type
to the fixed value they were configured with.

This change makes it possible to configure a View implementation with
a more general media type, e.g. "application/*+xml", and then set the
response type to the more specific requested media type, e.g.
"application/vnd.example-v1+xml".

Issue: SPR-9807.
2012-10-22 17:23:57 -04:00
Rossen Stoyanchev
4f114a657f Merge pull request #130 from tmeighen/SPR-7905
* tmeighen-SPR-7905:
  Support wildcard style media types in JSON converters
2012-10-22 16:41:47 -04:00
Tim Meighen
e16c40359a Support wildcard style media types in JSON converters
Add "application/*+json" to supported media types for both Jackson
message converters.

Issue: SPR-7905
2012-10-22 16:40:02 -04:00
Rossen Stoyanchev
2e1a68893d Update HttpHeaders.getAccept method
Some servlet containers (iPlanet) parse the Accept header and return
multiple values from request.getHeader("Accept"). The HttpHeaders
getAccept method has been updated to accommodate that hopefully
without causing any other issues.

The extra functionality is in effect only if we find only one
MediaType and there is more than one value for the 'Accept' header.

Issue: SPR-9655
2012-10-22 16:09:33 -04:00
Phillip Webb
ae2d24808c Close 'beans' tag in MVC namespace documentation
Issue: SPR-9898
2012-10-22 09:56:07 -07:00
Rossen Stoyanchev
e329698df5 Update changelog 2012-10-22 12:29:44 -04:00
Rossen Stoyanchev
0721146b14 Improve regex for parsing query params
Previously UriComponentsBuilder used a regular expression for parsing
query name-value pairs where both name and value were expected to not
contain neither '&', not '='. The idea is that the presence of reserved
characters makes it impossible to guess correctly how to parse the
query string (e.g. a=b&c).

This change relaxes the constraint on query param values, allowing them
to contain '='. In effect '&' is the ultimate separator of name-value
pairs, and any '=' in values is ignored. For example "q=1USD=?EUR" is
interpreted as "q equals '1USD=?EUR'".

Issue: SPR-9832
2012-10-22 11:04:48 -04:00
Rossen Stoyanchev
2f504dda3a Update remoting chapter (minor)
Issue: SPR-9822
2012-10-22 11:04:48 -04:00
Sam Brannen
4aaf014cc6 Support comments in SQL scripts in JdbcTestUtils
Prior to this commit, utility methods in JdbcTestUtils interpreted SQL
comments as separate statements, resulting in an exception when such a
script is executed.

This commit addresses this issue by introducing a
readScript(lineNumberReader, String) method that accepts a comment
prefix. Comment lines are therefore no longer returned in the parsed
script. Furthermore, the existing readScript(lineNumberReader) method
now delegates to this new readScript() method, supplying "--" as the
default comment prefix.

Issue: SPR-9593
2012-10-22 00:52:01 -04:00
Sam Brannen
7c538bd588 Rename WebTEL to ServletTEL
Renamed WebTestExecutionListener to ServletTestExecutionListener.
2012-10-19 20:29:20 -04:00
Sam Brannen
ff8a6e8fdb Remove code duplication in ModelAndViewAssert
ModelAndViewAssert now uses assertion methods in the newly
introduced AssertionErrors class.
2012-10-19 20:19:03 -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
Sam Brannen
c579cd1ce9 Update changelog regarding major new testing features 2012-10-16 16:07:16 -04:00
Rossen Stoyanchev
dbcbdace9e Parameterize AsyncTask type 2012-10-15 12:17:39 -04:00
Rossen Stoyanchev
e98dc50f99 Fix issue in PatternsRequestCondition 2012-10-15 12:17:39 -04:00
Rossen Stoyanchev
300ab4537b Add Spring 32 methods to StandaloneMockMvcBuilder 2012-10-15 12:17:39 -04:00
Phillip Webb
9582085950 Add DefaultMessageCodesResolverTests
Add unit test for DefaultMessageCodesResolver
2012-10-15 10:06:34 -04:00
Sam Brannen
300d41840b Fix JDK7 method order-dependent issues in SRCCT
SpringRunnerContextCacheTests suffers from JDK7-related non-determinism
in values returned from Class#getDeclaredMethods(), which in turn
affects JUnit and its execution of @Test methods.

This commit addresses this issue by introducing an
OrderedMethodsSpringJUnit4ClassRunner that sorts the test methods
alphabetically, which is actually required for
SpringRunnerContextCacheTests to work properly.

Issue: SPR-9789
2012-10-13 20:29:59 +02:00
Sam Brannen
21ebbb9c02 Support session & request scoped beans in the TCF
This commit introduces RequestAndSessionScopedBeansWacTests which
verifies support for request and session scoped beans in the Spring
TestContext Framework (TCF).

This support was actually introduced as an intentional side effect of
the work performed for SPR-5243 through the addition of the new 
WebTestExecutionListener.

Issue: SPR-4588
2012-10-13 19:50:31 +02:00
Sam Brannen
0bb24f2922 Update documentation TODOs
Issue: SPR-9864
2012-10-13 18:43:50 +02:00
Phillip Webb
6adb49b7a9 Add StringToUUIDConverter
Conversion to and from UUID objects is now supported by the
DefaultConversionService.

Issue: SPR-9765
2012-10-12 14:47:19 -07:00
Phillip Webb
c8c0e827b4 Polish trailing whitespace 2012-10-12 14:47:19 -07:00
Juergen Hoeller
29d60448cd Polishing 2012-10-12 23:34:23 +02:00
Juergen Hoeller
a6ce821ad8 Made AutoProxyCreatorTests less dependent on container's own interrogation of FactoryBeans
Issue: SPR-9857
2012-10-12 23:34:22 +02:00
Juergen Hoeller
3cf5572ee8 LoadTimeWeaverAware beans are consistently being created early for JPA weaving to work reliably
Reverted change for @Bean methods that declare FactoryBean as their return type: The effects of trying to create the FactoryBean to find out about its implementation type are too far-reaching. It's better to recommend declaring a specific return type in the method signature if you want the container to specifically react to your implementation type.

Issue: SPR-9857
2012-10-12 23:34:22 +02:00
Juergen Hoeller
0af9244571 LoadTimeWeaverAware beans are consistently being created early for JPA weaving to work reliably
Includes a change for factory methods that declare their return type as FactoryBean: When asked for a specific type match (e.g. LoadTimeWeaverAware), we do check early singleton instances as well (reusing the instances that we create for getObjectType checks). This is necessary in order to make @Bean method introspection as capable as XML bean definition introspection, even in case of the @Bean method using a generic FactoryBean declaration for its return type (instead of the FactoryBean impl class).

Issue: SPR-9857
2012-10-12 23:34:21 +02:00
Juergen Hoeller
0f11920007 Only cache by-type lookups if configuration has been marked as frozen
Issue: SPR-9448
2012-10-12 23:34:20 +02:00
Juergen Hoeller
d7e2de019f Mention matching bean names in exception message in case of non-unique EntityManagerFactory lookup 2012-10-12 23:34:19 +02:00
Juergen Hoeller
538ce4747d Only cache by-type lookups if configuration has been marked as frozen
Issue: SPR-9448
2012-10-12 23:34:18 +02:00
Juergen Hoeller
3c59725b94 LoadTimeWeaverAware beans are consistently being created early for JPA weaving to work reliably
Includes a change for factory methods that declare their return type as FactoryBean: When asked for a specific type match (e.g. LoadTimeWeaverAware), we do check early singleton instances as well (reusing the instances that we create for getObjectType checks). This is necessary in order to make @Bean method introspection as capable as XML bean definition introspection, even in case of the @Bean method using a generic FactoryBean declaration for its return type (instead of the FactoryBean impl class).

Issue: SPR-9857
2012-10-12 23:34:18 +02:00
Juergen Hoeller
cfdcb54711 Jaxb2Marshaller has non-synchronized access to the JAXBContext once initialized
Issue: SPR-9867
2012-10-12 23:34:17 +02:00
Juergen Hoeller
138fa8af0e OpDivide does not return a TypedValue for its operate result (consistent with OpMultiply)
Issue: SPR-9869
2012-10-12 23:34:16 +02:00
Juergen Hoeller
ff7dcec5f7 BeanWrapper does not fall back to String constructor if ConversionService attempt failed before
Issue: SPR-9865
2012-10-12 23:34:15 +02:00
Juergen Hoeller
65743936ff Provider injection into prototype beans works for method parameters as well
Issue: SPR-9630
2012-10-12 23:34:14 +02:00
Phillip Webb
3f1fb4eeea Merge pull request #155 from philwebb/SPR-9284
* SPR-9284:
  Allow MapToMap conversion to work when the target map does not have a default constructor (as long as a new map copy is not required).
  Polish trailing whitespace
2012-10-12 13:11:02 -07:00
Phillip Webb
38c4393592 Allow MapToMap conversion to work when the target map does not have a
default constructor (as long as a new map copy is not required).

Issue: SPR-9284
2012-10-12 13:10:07 -07:00
Phillip Webb
60afa5ead4 Polish trailing whitespace 2012-10-12 13:09:53 -07:00
Phillip Webb
ea8b1327b4 Merge pull request #136 from philwebb/SPR-9017
* SPR-9017:
  SpEL support for methods and properties on class …
  Remove trailing whitespace
2012-10-12 13:00:56 -07:00
Phillip Webb
d28592a6c6 SpEL support for methods and properties on class …
Update the ReflectiveMethodResolver and ReflectivePropertyAccessor
to allow methods and properties of java.lang.Class to be resolved
when the target object is a class.

Issue: SPR-9017
2012-10-12 13:00:56 -07:00
Phillip Webb
98808347ca Remove trailing whitespace 2012-10-12 13:00:55 -07:00
Chris Beams
27c83710b0 Merge pull request #166 from philwebb/SPR-9851
# By Phillip Webb
* SPR-9851:
  Prevent memory leaks with @Configuration beans
2012-10-12 12:56:25 -07:00
Phillip Webb
c8061393fb Prevent memory leaks with @Configuration beans
Refactor ConfigurationClassEnhancer to allow cglib caching of
generated classes.  Prior to this commit each enhanced @Configuration
class would consume permgen space when created.

The CallbackFilter and Callback Types are now defined as static final
members so that they can be shared by all enhancers.  Only the
callbackInstances remain specific to a @Configuration class and
these are not used by cglib as part of the cache key.

Issue: SPR-9851
2012-10-12 12:33:42 -07:00
Rossen Stoyanchev
365a42da64 Add file upload test to Spring MVC Test 2012-10-12 09:17:27 -04:00
Rossen Stoyanchev
dc01f088f7 Fix issue in message conversion
This change ensures that when the Accept and the Producible media types
are equally specific, we use the one from the Accept header, which may
for example carry a different charset.
2012-10-12 08:49:30 -04:00