Commit Graph

8393 Commits

Author SHA1 Message Date
Sam Brannen cae50c3a2d Polishing 2014-03-16 17:34:01 +01:00
Sam Brannen bb67cd4657 Fix regression for newline separators in SQL scripts
Changes made in conjunction with SPR-9531, introduced a regression with
regard to support for using a single newline character as the statement
separator within SQL scripts. Investigation of the cause of this issue
resulted in the discovery of another, similar issue: support for
multiple newlines as a statement separator has been broken for years
but has gone unnoticed until now.

The reason that both of these issues have gone unnoticed is a result of
the fact that the test suite only executes SQL script integration tests
against HSQL DB, and HSQL does not care if two statements occur on the
same line; whereas, the H2 database will throw an exception if multiple
statements are included on the same line when executing an update.

This commit addresses both of these issues and provides further
enhancements to Spring's SQL script support as follows.

 - ScriptUtils now properly checks if the supplied script contains the
   custom statement separator or default separator before falling back
   to the 'fallback' separator (i.e., newline).

 - Introduced FALLBACK_STATEMENT_SEPARATOR constant in ScriptUtils.

 - ScriptUtils.readScript() no longer omits empty lines from the input
   file since a statement separator string may in fact be composed of
   multiple newline characters.

 - Introduced overloaded variants of splitSqlScript() and
   executeSqlScript() in ScriptUtils with smaller argument lists for
   common use cases.

 - Extracted AbstractDatabasePopulatorTests from DatabasePopulatorTests
   and introduced concrete HsqlDatabasePopulatorTests and
   H2DatabasePopulatorTests subclasses for testing against HSQL and H2.

 - Split ScriptUtilsTests into ScriptUtilsUnitTests and
   ScriptUtilsIntegrationTests for faster builds.

Issue: SPR-11560
2014-03-16 16:41:08 +01:00
Sam Brannen e7b8a657b4 Add more tests for @ComponentScan as a meta-annotation
Issue: SPR-11557
2014-03-15 15:28:17 +01:00
Juergen Hoeller 189cd663c5 Polishing 2014-03-15 00:46:06 +01:00
Sam Brannen f1fbe85ff1 Investigate issue with @ComponentScan as meta-annotation
This commit introduces unit and integration tests that attempt to
reproduce the issue claimed by the reporter in SPR-11557. However, the
tests pass without any problems.

Issue: SPR-11557
2014-03-15 00:04:53 +01:00
Sam Brannen 3d506eb033 Clean up ConfigurationClassPostProcessorTests 2014-03-14 22:34:11 +01:00
Juergen Hoeller 99ea429fd7 Added specific unit test for scoped-proxy target not being an autowire candidate
Issue: SPR-11548
2014-03-14 20:40:24 +01:00
Juergen Hoeller 5308b3e358 Revised naming for prototype inner beans to avoid excessive unique name calculation
Restored original singleton-only adaptInnerBeanName behavior, avoiding endless unique name calculation for every single prototype instance. Non-named inner BeanDefinition objects now suffixed with an identity hex code analogous to non-named XML bean definitions, largely avoiding naming collisions to begin with. After SPR-11246, post-processors can deal with unstable classes per bean name, so occasional collisions aren't a hard problem anymore.

Issue: SPR-11545
2014-03-14 20:38:09 +01:00
Sam Brannen 9dcd03d862 Clean up imports and warnings 2014-03-14 17:34:21 +01:00
Juergen Hoeller 5ff1c696c8 Check raw Type objects, not ResolvableType instances, during isAssignableFrom recursion
Issue: SPR-11522
2014-03-14 00:45:40 +01:00
Juergen Hoeller 791f58e6be Polishing 2014-03-13 17:31:39 +01:00
Juergen Hoeller 4744180d3d NumberUtils reports overflow when converting from BigInteger/BigDecimal to Long
Issue: SPR-11434
2014-03-13 17:03:55 +01:00
Sam Brannen 01b2f67f11 Introduce constructors in ResourceDatabasePopulator
Issue: SPR-9531
2014-03-13 13:45:05 +01:00
Sam Brannen a006ca2542 Remove trailing whitespace 2014-03-13 12:21:32 +01:00
Sam Brannen 7853e74e78 Merge pull request #485 from cbaldwin74/SPR-9531
* SPR-9531:
  Refactor SQL script support
  Support multi-line comments in SQL scripts
2014-03-13 12:05:49 +01:00
Sam Brannen 2bfd6ddcf4 Refactor SQL script support
This commit continues the work in the previous commit as follows:

 - Introduced an exception hierarchy for exceptions related to SQL
   scripts, with ScriptException as the base.

 - CannotReadScriptException and ScriptStatementFailedException now
   extend ScriptException.

 - Introduced ScriptParseException, used by ScriptUtils.splitSqlScript().

 - DatabasePopulatorUtils.execute() now explicitly throws a
   DataAccessException.

 - Polished Javadoc in ResourceDatabasePopulator.

 - Overhauled Javadoc in ScriptUtils and documented all constants.

 - Added missing @author tags for original authors in ScriptUtils and
   ScriptUtilsTests.

 - ScriptUtils.splitSqlScript() now asserts preconditions.

 - Deleted superfluous methods in ScriptUtils and changed method
   visibility to private or package private as appropriate.

 - Deleted the ScriptStatementExecutor introduced in the previous
   commit; ScriptUtils.executeSqlScript() now accepts a JDBC Connection;
   JdbcTestUtils, AbstractTransactionalJUnit4SpringContextTests, and
   AbstractTransactionalTestNGSpringContextTests now use
   DatabasePopulatorUtils to execute a ResourceDatabasePopulator instead
   of executing a script directly via ScriptUtils.

 - Introduced JdbcTestUtilsIntegrationTests.

Issue: SPR-9531
2014-03-13 12:00:01 +01:00
cbaldwin74 e5c17560db Support multi-line comments in SQL scripts
Prior to this commit neither ResourceDatabasePopulator nor
JdbcTestUtils properly supported multi-line comments (e.g., /* ... */).
Secondarily there has developed a significant amount of code
duplication in these two classes that has led to maintenance issues
over the years.

This commit addresses these issues as follows:

 - Common code has been extracted from ResourceDatabasePopulator and
   JdbcTestUtils and moved to a new ScriptUtils class in the
   spring-jdbc module.

 - Relevant test cases have been migrated from JdbcTestUtilsTests to
   ScriptUtilsTests.

 - ScriptUtils.splitSqlScript() has been modified to ignore multi-line
   comments in scripts during processing.

 - ResourceDatabasePopulator supports configuration of the start and end
   delimiters for multi-line (block) comments.

 - A new test case was added to ScriptUtilsTests for the new multi-line
   comment support.

Issue: SPR-9531
2014-03-13 10:51:08 +01:00
Rossen Stoyanchev 6b31074e4a Add HTTP series check shortcut methods to HttpStatus
Issue: SPR-11424
2014-03-12 17:04:16 -04:00
Rossen Stoyanchev 6a4a2ec6a4 Fix expected and actual argument order
Issue: SPR-11424
2014-03-12 16:52:52 -04:00
Rossen Stoyanchev 3474afb165 Improve suffix pattern check
After this change dots inside URI variables in a request mapping
pattern are ignored and no longer considered an indication that
the pattern contains a suffix itself.

Issue: SPR-11532
2014-03-12 16:42:16 -04:00
Juergen Hoeller 4d3ca4319e Polishing 2014-03-11 22:09:46 +01:00
Brian Clozel 8b2b165777 Fix "relay-port" XSD type in spring-websocket.xsd
Prior to this commit, the `relay-port` attribute of the
`<websocket:stomp-broker-relay />` tag was of type `xsd:int`.
This prevents developers from using `PropertyPlaceholderConfigurer`,
even though this configuration key is a good candidate for such use
(this value depends on prod/staging/etc environment).

This commit changes that type to `xsd:string`.

Issue: SPR-11537
2014-03-11 20:33:13 +01:00
Juergen Hoeller 658a44a620 Upgraded to Apache HttpClient 4.3.3 and Jetty 9.1.3 2014-03-11 12:57:27 +01:00
Juergen Hoeller 27cacf0672 SpEL property-not-found message hints at non-public method/field
Issue: SPR-11535
(cherry picked from commit eeb82c4)
2014-03-11 11:20:29 +01:00
Rossen Stoyanchev 13af188bdc Handle invalid STOMP content-length header value
After this change if a content-length header is provided but is less
than 0 or cannot be parsed as a number, it is ignored and the body
is read sequentially, i.e. until we reach a null byte terminator.

This provides better protection against clients that may set the
content-length header in error.

Issue: SPR-11528
2014-03-10 22:07:39 -04:00
Rossen Stoyanchev cff23b84ae Add messages for number of active sessions/connections
Issue: SPR-11531
2014-03-10 16:58:02 -04:00
Rossen Stoyanchev a473d46e1c Tighten connection management in STOMP broker relay
Fix NPE exception when closing TcpConnection

Ensure a ConnectionHandler is cleared when a TcpConnection is closed
(at the same time), logging an exception if the closing fails.

Improve error messages.

Issue: SPR-11531
2014-03-10 16:46:13 -04:00
Juergen Hoeller bbcb1837c5 Polishing
Issue: SPR-11442
2014-03-10 18:31:03 +01:00
Juergen Hoeller 264d7b9c98 Improved documentation on how to convert collections with ConversionService
Issue: SPR-11432
2014-03-10 18:18:29 +01:00
Stephane Nicoll 7a6ec69523 Fix custom config with older HttpClient
Since HttpClient 4.3, custom configuration such as the connection
timeout and the socket timeout are set in a RequestConfig object
stored in the HttpContext.

Unfortunately, older HttpClients are not supporting this
infrastructure and new clients throw an exception when the
deprecated API is used.

This commit detects if the client is an "old" implementation and
set the configuration through the deprecated means to restore
full backward compatibility with these features.

Issue: SPR-11442
2014-03-10 17:42:09 +01:00
Juergen Hoeller bea94d5302 CollectionToCollectionConverter avoids collection copy for untyped collection when simply returning source anyway
Also uses addAll instead of iteration over untyped collection now, supporting optimized addAll in target collection type, and avoids repeated getElementTypeDescriptor calls.

Issue: SPR-11479
2014-03-10 15:59:19 +01:00
Juergen Hoeller 40b81fcc3e SPR11348 test should use LinkedHashSet since it relies on insertion order of elements 2014-03-10 13:33:56 +01:00
Sam Brannen 241682c117 Update author list in reference manual 2014-03-10 12:31:00 +01:00
Sam Brannen b364599278 Update links to Spring JIRA server 2014-03-10 12:26:29 +01:00
Sam Brannen 220267b830 Update copyright date in reference manual 2014-03-10 12:22:52 +01:00
Stephane Nicoll 542db72ffd Add first draft of IDEA code formatting
This commit provides a first attempt at defining a standard code
formatting scheme for the Spring Framework in Intellij IDEA.

These are the major changes compared to standard settings:

* default indent option to use tab character instead of space for
  all languages
* one space before the left brace of an array initializer
* keep when reformating: multiple expressions in one line,
  simple blocks in one line
* method declaration parameters: do not align when multiline
* else, catch and finally on new line
* keep one space before } (solely use to keep the space between the
  end of the last method and the end of the class)
* minimum blank line after class header 0 (instead of 1)
* Disabled Javadoc formatting
* class count to trigger static import to 50 (to prevent
  import org.foo.*; instead of listing the classes of org.foo)
* changed the import sequence to import in the following order:
  static imports, java.*, javax.*, others, org.springframework.*. Each
  sequence is separated by a space
2014-03-10 11:43:19 +01:00
Sam Brannen 1d57a15e40 Delete unused imports in spring-test 2014-03-07 18:27:34 +01:00
Sam Brannen 1ade9b5433 Polish various test classes 2014-03-07 18:06:30 +01:00
Sam Brannen e865d63c29 Ensure Gradle does not execute inner classes as tests 2014-03-07 17:31:44 +01:00
Juergen Hoeller bcde955ec9 Ignore placeholder resolution failure as well in case of ignoreResourceNotFound=true
Issue: SPR-11524
2014-03-07 13:39:01 +01:00
Juergen Hoeller 3dfa7e9ac0 Avoid stack overflow in case of circular type reference
Issue: SPR-11522
2014-03-07 00:08:15 +01:00
Juergen Hoeller 93c8b7ab04 DefaultListableBeanFactory only puts 'cache-safe' Class keys into its by-type cache
Issue: SPR-11520
2014-03-06 22:41:38 +01:00
Rossen Stoyanchev 07959cb3f7 Merge pull request #484 from sdeleuze/SPR-11504 2014-03-06 12:29:22 -05:00
Rossen Stoyanchev 0036d9a5c9 Polish 2014-03-06 12:28:06 -05:00
Sebastien Deleuze 2f8bc6eec1 Decode target parameter names prior to saving a FlashMap
In addition to the target parameter values (SPR-9657), the target
parameter names must also be decoded to be able to match
them to the parameter names of incoming requests.

Issue: SPR-11504
2014-03-06 11:56:28 -05:00
Stephane Nicoll 519799e1cf Fix double SPeL evaluation of parameter
When a node of an SPeL expression was a call to a bean referenced
 in a method argument, the expression was resolved twice.

 The resolved arguments are now specified to MethodValueRef instead
 of resolving the arguments again in the constructor

 Issue: SPR-11445
2014-03-06 15:11:22 +01:00
Sam Brannen c8f2e07182 Clean up test warnings that show up in Gradle console 2014-03-06 14:50:46 +01:00
Sam Brannen cb59d43a5f Fix typos in Javadoc in AssertThrows 2014-03-06 14:40:41 +01:00
Juergen Hoeller 213d9c4a51 Consistent dependencies on official JTA 1.2 and JMS 1.1 API jars 2014-03-06 14:19:48 +01:00
Juergen Hoeller 3080ff3890 Polishing 2014-03-06 14:18:26 +01:00