1. 04 8月, 2012 4 次提交
    • S
      Introduce new methods in tx base test classes · 015086cb
      Sam Brannen 提交于
      Recently new utility methods were added to JdbcTestUtils, and a
      JdbcTemplate was introduced in abstract transactional base classes in
      the TestContext framework. This presents an easy opportunity to make
      these new utility methods available as convenience methods in the base
      test classes.
      
      This commit introduces new countRowsInTableWhere() and dropTables()
      convenience methods in the abstract transactional base classes in the
      TestContext framework. These new methods internally delegate to methods
      of the same names in JdbcTestUtils.
      
      Issue: SPR-9665
      015086cb
    • S
      Provide JdbcTemplate in tx base classes in the TCF · 8d9637ad
      Sam Brannen 提交于
      Since Spring 2.5, the abstract transactional base classes in the
      TestContext framework have defined and delegated to a protected
      SimpleJdbcTemplate instance variable; however, SimpleJdbcTemplate has
      deprecated since Spring 3.1. Consequently, subclasses of
      AbstractTransactionalJUnit4SpringContextTests and
      AbstractTransactionalTestNGSpringContextTests that use this instance
      variable suffer from seemingly unnecessary deprecation warnings.
      
      This commit addresses this issue by introducing a protected JdbcTemplate
      instance variable in abstract transactional base classes to replace the
      use of the existing SimpleJdbcTemplate. Furthermore, the existing
      simpleJdbcTemplate instance variable has been deprecated, and utility
      methods in the affected base classes now delegate to JdbcTestUtils
      instead of the now deprecated SimpleJdbcTestUtils.
      
      Issue: SPR-8990
      8d9637ad
    • S
      Merge pull request #90 from ianbrandt/SPR-9235 · a7d43773
      Sam Brannen 提交于
      * SPR-9235:
        Deprecate SimpleJdbcTestUtils in favor of JdbcTestUtils
      a7d43773
    • I
      Deprecate SimpleJdbcTestUtils in favor of JdbcTestUtils · bd0c4b4d
      Ian Brandt 提交于
      Several static utility methods in SimpleJdbcTestUtils accept an instance
      of SimpleJdbcTemplate as an argument; however, SimpleJdbcTemplate has
      been deprecated since Spring 3.1 in favor of simply using JdbcTemplate
      which now also supports Java 5 language constructs such as var-args.
      Consequently, use of such methods from SimpleJdbcTestUtils results in
      deprecation warnings without an equivalent API to migrate to.
      
      This commit addresses this issue by migrating all existing methods in
      SimpleJdbcTestUtils to JdbcTestUtils. The migrated methods now accept an
      instance of JdbcTemplate as an argument, thereby avoiding the
      deprecation warnings but maintaining semantic compatibility with the
      functionality previous available in SimpleJdbcTestUtils.
      
      In addition, this commit also introduces two new methods:
      
       - countRowsInTableWhere(): counts the rows in a given table, using
         a provided `WHERE` clause
       - dropTables(): drops the tables with the specified names
      
      Issue: SPR-9235
      bd0c4b4d
  2. 03 8月, 2012 1 次提交
  3. 29 7月, 2012 4 次提交
  4. 28 7月, 2012 2 次提交
    • S
      Support TransactionManagementConfigurer in the TCF · 2b7a6290
      Sam Brannen 提交于
      Currently the Spring TestContext Framework looks up a
      PlatformTransactionManager bean named "transactionManager". The exact
      name of the bean can be overridden via @TransactionConfiguration or
      @Transactional; however, the bean will always be looked up 'by name'.
      
      The TransactionManagementConfigurer interface that was introduced in
      Spring 3.1 provides a programmatic approach to specifying the
      PlatformTransactionManager bean to be used for annotation-driven
      transaction management, and that bean is not required to be named
      "transactionManager". However, as of Spring 3.1.2, using the
      TransactionManagementConfigurer on a @Configuration class has no effect
      on how the TestContext framework looks up the transaction manager.
      Consequently, if an explicit name or qualifier has not been specified,
      the bean must be named "transactionManager" in order for a transactional
      integration test to work.
      
      This commit addresses this issue by refactoring the
      TransactionalTestExecutionListener so that it looks up and delegates to
      a single TransactionManagementConfigurer as part of the algorithm for
      determining the transaction manager.
      
      Issue: SPR-9604
      2b7a6290
    • S
      Support single, unqualified tx manager in the TCF · f21fe33e
      Sam Brannen 提交于
      TransactionalTestExecutionListener currently requires that the
      PlatformTransactionManager bean be named "transactionManager" by
      default. Otherwise, the bean name can only be overridden via the
      transactionManager attribute of @TransactionConfiguration or the value
      attribute of @Transactional.
      
      However, if there is only a single PlatformTransactionManager in the
      test's ApplicationContext, then the requirement to specify the exact
      name of that bean (or to name it exactly "transactionManager") is often
      superfluous.
      
      This commit addresses this issue by refactoring the
      TransactionalTestExecutionListener so that it is comparable to the
      algorithm for determining the transaction manager used in
      TransactionAspectSupport for "production" code. Specifically, the TTEL
      now uses the following algorithm to retrieve the transaction manager.
      
       - look up by type and qualifier from @Transactional
       - else, look up by type and explicit name from
         @TransactionConfiguration
       - else, look up single bean by type
       - else, look up by type and default name from @TransactionConfiguration
      
      Issue: SPR-9645
      f21fe33e
  5. 27 7月, 2012 1 次提交
  6. 26 7月, 2012 3 次提交
    • S
      Support named dispatchers in MockServletContext · 37dc211f
      Sam Brannen 提交于
      Currently the getNamedDispatcher(String) method of MockServletContext
      always returns null. This poses a problem in certain testing scenarios
      since one would always expect at least a default Servlet to be present.
      This is specifically important for web application tests that involve
      the DefaultServletHttpRequestHandler which attempts to forward to the
      default Servlet after retrieving it by name. Furthermore, there is no
      way to register a named RequestDispatcher with the MockServletContext.
      
      This commit addresses these issues by introducing the following in
      MockServletContext.
      
       - a new defaultServletName property for configuring the name of the
         default Servlet, which defaults to "default"
       - named RequestDispatchers can be registered and unregistered
       - a MockRequestDispatcher is registered for the "default" Servlet
         automatically in the constructor
       - when the defaultServletName property is set to a new value the
         the current default RequestDispatcher is unregistered and replaced
         with a MockRequestDispatcher for the new defaultServletName
      
      Issue: SPR-9587
      37dc211f
    • R
      Use a default for INTROSPECT_TYPE_LEVEL_MAPPING · 914557b9
      Rossen Stoyanchev 提交于
      Usually this request attribute is set for all sub-classes of
      AbstractUrlHandlerMapping and therefore whenever
      AnnotationMethodHandlerAdapter is used. However, having a
      default value to fall back on in AnnotationMethodHandlerAdapter
      is still appropriate in general and also considering the Javadoc
      of HandlerMapping.INTROSPECT_TYPE_LEVEL_MAPPING.
      
      Issue: SPR-9629
      914557b9
    • R
      Improve tests for detection of @mvc annotations · 7c6a1a1b
      Rossen Stoyanchev 提交于
      Issue: SPR-9601
      7c6a1a1b
  7. 25 7月, 2012 1 次提交
  8. 21 7月, 2012 5 次提交
    • R
      Add ContentNegotiationManagerFactoryBean · 64d939bb
      Rossen Stoyanchev 提交于
      The new FactoryBean facilitates the creation of a
      ContentNegotiationManager in XML configuration.
      
      Issue: SPR-8420
      64d939bb
    • R
      Add options to configure content negotiation · 028e15fa
      Rossen Stoyanchev 提交于
      The MVC Java config and the MVC namespace now support options to
      configure content negotiation. By default both support checking path
      extensions first and the "Accept" header second. For path extensions
      .json, .xml, .atom, and .rss are recognized out of the box if the
      Jackson, JAXB2, or Rome libraries are available. The ServletContext
      and the Java Activation Framework may be used as fallback options
      for path extension lookups.
      
      Issue: SPR-8420
      028e15fa
    • R
      Add exclude patterns for mapped interceptors · 92759ed1
      Rossen Stoyanchev 提交于
      Add the ability provide exclude patterns for mapped interceptors in the
      MVC namespace and in the MVC Java config.
      
      Issue: SPR-6570
      92759ed1
    • R
      Fix issue with failing test from previous commit · 5a365074
      Rossen Stoyanchev 提交于
      Issue: SPR-9611
      5a365074
    • R
      Ensure async Callables are in sync with the call stack · 6cc512b5
      Rossen Stoyanchev 提交于
      After this change each call stack level pushes and pops an async
      Callable to ensure the AsyncExecutionChain is in sync with the
      call stack. Before this change, a controller returning a "forward:"
      prefixed string caused the AsyncExecutionChain to contain a
      extra Callables that did not match the actual call stack.
      
      Issue: SPR-9611
      6cc512b5
  9. 19 7月, 2012 1 次提交
  10. 18 7月, 2012 3 次提交
  11. 17 7月, 2012 2 次提交
    • S
      Merge pull request #108 from rwinch/SPR-9594 · 35a423a8
      Sam Brannen 提交于
      * SPR-9594:
        Fix minor issue in MockHttpServletRequest
      35a423a8
    • R
      Fix minor issue in MockHttpServletRequest · 59d80ec1
      Rob Winch 提交于
      Previously MockHttpServletRequest#sendRedirect did not set the HTTP status
      or the Location header. This does not conform to the HttpServletRequest
      interface.
      
      MockHttpServletRequest will now:
      
        - Set the HTTP status to 302 on sendRedirect
        - Set the Location header on sendRedirect
        - Ensure the Location header and getRedirectedUrl are kept in synch
      
      Issue: SPR-9594
      59d80ec1
  12. 11 7月, 2012 3 次提交
    • R
      Update section on exception handling MVC chapter · 67a05e41
      Rossen Stoyanchev 提交于
      Update section on exception handling in Spring MVC chapter to include
      more guidance on exception handling when implementing a REST API.
      
      Issue: SPR-9290
      67a05e41
    • R
      Add BindException to DefaultHandlerExceptionResolver · a1b7a314
      Rossen Stoyanchev 提交于
      Previously DefaultHandlerExceptionResolver did not handle BindException
      but after this change it does. A BindException is raised when an
      @ModelAttribute annotated argument is not followed by a BindingResult
      argument. Hence this is unlikely to affect browser rendering.
      For programmatic clients however this change ensures an unhandled
      BindException is at least turned into a 400 error.
      
      Issue: SPR-9310
      a1b7a314
    • R
      Move feed message converters ahead of jackson/jaxb2 · e860fa9a
      Rossen Stoyanchev 提交于
      The Atom/RSS message converters are now registered ahead of the
      Jackson and the JAXB2 message converters by default. Since the Atom
      and RSS converters convert to and from very specific object types
      Feed and Channel respectively, that shouldn't introduce any regressions
      and will work more intuitively when the requested media type is "*/*".
      
      Issue: SPR-9054
      e860fa9a
  13. 10 7月, 2012 4 次提交
    • C
      Merge pull request #104 from poutsma/SPR-9536 · 2b4a5169
      Chris Beams 提交于
      * SPR-9576:
        Include **/*.aj files in *-sources.jar files
      2b4a5169
    • R
      Include **/*.aj files in *-sources.jar files · a681e574
      Rob Winch 提交于
      Previously only **/*.java sources files were included in the sources
      jars. This is not ideal for the spring-aspects jar nor does it match
      prior versions of the sources jars.
      
      Now **/*.aj files are included in addition to the **/*.java files.
      
      Issue: SPR-9576
      a681e574
    • R
      Fix issue with incorrect class import · cf147a82
      Rossen Stoyanchev 提交于
      Issue: SPR-9112
      cf147a82
    • R
      Add support for global @ExceptionHandler methods · c846198e
      Rossen Stoyanchev 提交于
      Before this change @ExceptionHandler methods could be located in and
      apply locally within a controller. The change makes it possible to have
      such methods applicable globally regardless of the controller that
      raised the exception.
      
      The easiest way to do that is to add them to a class annotated with
      `@ExceptionResolver`, a new annotation that is also an `@Component`
      annotation (and therefore works with component scanning). It is also
      possible to register classes containing `@ExceptionHandler` methods
      directly with the ExceptionHandlerExceptionResolver.
      
      When multiple `@ExceptionResolver` classes are detected, or registered
      directly, the order in which they're used depends on the the `@order`
      annotation (if present) or on the value of the order field (if the
      Ordered interface is implemented).
      
      Issue: SPR-9112
      c846198e
  14. 07 7月, 2012 3 次提交
  15. 06 7月, 2012 3 次提交
    • C
      Resolve nested placeholders via PropertyResolver · 2ec78341
      Chris Beams 提交于
      Prior to this change, PropertySourcesPropertyResolver (and therefore
      all AbstractEnvironment) implementations failed to resolve nested
      placeholders as in the following example:
      
          p1=v1
          p2=v2
          p3=${v1}:{$v2}
      
      Calls to PropertySource#getProperty for keys 'p1' and 'v1' would
      successfully return their respective values, but for 'p3' the return
      value would be the unresolved placeholders. This behavior is
      inconsistent with that of PropertyPlaceholderConfigurer.
      
      PropertySourcesPropertyResolver #getProperty variants now resolve any
      nested placeholders recursively, throwing IllegalArgumentException for
      any unresolvable placeholders (as is the default behavior for
      PropertyPlaceholderConfigurer). See SPR-9569 for an enhancement that
      will intoduce an 'ignoreUnresolvablePlaceholders' switch to make this
      behavior configurable.
      
      This commit also improves error output in
      PropertyPlaceholderHelper#parseStringValue by including the original
      string in which an unresolvable placeholder was found.
      
      Issue: SPR-9473, SPR-9569
      2ec78341
    • R
      Fix minor issue in HandlerMethod · b9786cca
      Rossen Stoyanchev 提交于
      Before this change HandlerMethod used ClassUtils.getUserClass(Class<?>)
      to get the real user class, and not one generated by CGlib. However it
      failed to that under all circumstances. This change fixes that.
      
      Issue: SPR-9490
      b9786cca
    • R
      Add defaultCharset field to StringHttpMessageConverter · a4240d28
      Rossen Stoyanchev 提交于
      Before this change the StringHttpMessageConverter used a fixed charset
      "ISO-8859-1" if the requested content type did not specify one. This
      change adds a defaultCharset field and a constructor to configure it in
      StringHttpMessageConverter.
      
      Issue: SPR-9487
      a4240d28