Commit Graph

7873 Commits

Author SHA1 Message Date
Sam Brannen
c7c395d0d0 Merge pull request #421 from sbrannen/SPR-11038
* SPR-11038:
  Support meta-annotation attr overrides in the TCF
2013-11-26 15:59:00 -05:00
Sam Brannen
64f593db8f Support meta-annotation attr overrides in the TCF
Prior to this commit, the Spring TestContext Framework (TCF) supported
the use of test-related annotations as meta-annotations for composing
custom test stereotype annotations; however, attributes in custom
stereotypes could not be used to override meta-annotation attributes.

This commit addresses this by allowing attributes from the following
annotations (when used as meta-annotations) to be overridden in custom
stereotypes.

- @ContextConfiguration
- @ActiveProfiles
- @DirtiesContext
- @TransactionConfiguration
- @Timed
- @TestExecutionListeners

This support depends on functionality provided by
AnnotatedElementUtils. See the 'Notes' below for further details and
ramifications.

Notes:

- AnnotatedElementUtils does not support overrides for the 'value'
  attribute of an annotation. It is therefore not possible or not
  feasible to support meta-annotation attribute overrides for some
  test-related annotations.
- @ContextHierarchy, @WebAppConfiguration, @Rollback, @Repeat, and
  @ProfileValueSourceConfiguration define single 'value' attributes
  which cannot be overridden via Spring's meta-annotation attribute
  support.
- Although @IfProfileValue has 'values' and 'name' attributes, the
  typical usage scenario involves the 'value' attribute which is not
  supported for meta-annotation attribute overrides. Furthermore,
  'name' and 'values' are so generic that it is deemed unfeasible to
  provide meta-annotation attribute override support for these.
- @BeforeTransaction and @AfterTransaction do not define any attributes
  that can be overridden.
- Support for meta-annotation attribute overrides for @Transactional is
  provided indirectly via SpringTransactionAnnotationParser.

Implementation Details:

- MetaAnnotationUtils.AnnotationDescriptor now provides access to the
  AnnotationAttributes for the described annotation.
- MetaAnnotationUtils.AnnotationDescriptor now provides access to the
  root declaring class as well as the declaring class.
- ContextLoaderUtils now retrieves AnnotationAttributes from
  AnnotationDescriptor to look up annotation attributes for
  @ContextConfiguration and @ActiveProfiles.
- ContextConfigurationAttributes now provides a constructor to have its
  attributes sourced from an instance of AnnotationAttributes.
- ContextLoaderUtils.resolveContextHierarchyAttributes() now throws an
  IllegalStateException if no class in the class hierarchy declares
  @ContextHierarchy.
- TransactionalTestExecutionListener now uses AnnotatedElementUtils to
  look up annotation attributes for @TransactionConfiguration.
- Implemented missing unit tests for @Rollback resolution in
  TransactionalTestExecutionListener.
- SpringJUnit4ClassRunner now uses AnnotatedElementUtils to look up
  annotation attributes for @Timed.
- TestContextManager now retrieves AnnotationAttributes from
  AnnotationDescriptor to look up annotation attributes for
  @TestExecutionListeners.
- DirtiesContextTestExecutionListener now uses AnnotatedElementUtils to
  look up annotation attributes for @DirtiesContext.

Issue: SPR-11038
2013-11-26 15:56:37 -05:00
Phillip Webb
c5779e2ed6 Remove unused GlassFishLoadTimeWeaverTests
Delete the unused GlassFishLoadTimeWeaverTests and in the process
fix the "Unable to load JUnit4 runner to calculate Ignored test cases"
Gradle error.

Issue: SPR-10563
2013-11-26 10:51:13 -08:00
Juergen Hoeller
ef3a3b03ce @EnableMBeanExport supports empty placeholders as well
Issue: SPR-11105
2013-11-26 14:43:10 +01:00
Rossen Stoyanchev
119e793994 Fix concurrency issue in TestDispatcherServlet
This change fixes a timing issue in tests using Spring MVC Tests where
assertions on an async result may not wait long enough.

The fix involves the use of a new callback in  MockAsyncContext that
allows tests to detect when an async dispatch has been invoked.

Issue: SPR-10838
2013-11-25 21:51:08 -05:00
Rossen Stoyanchev
ce3e55743f Extract IdGenerator into a top-level class 2013-11-25 21:50:47 -05:00
Sam Brannen
a5d87fffd9 Polish Javadoc for @IfProfileValue 2013-11-25 21:22:54 -05:00
Sam Brannen
412f74f679 Provide meta-annotation support for @Rollback
@Rollback now supports ANNOTATION_TYPE as a target, allowing it to be
used as meta-annotation.

Note: this change was accidentally omitted from the original commit for
SPR-7827.

Issue: SPR-7827
2013-11-25 20:17:14 -05:00
Juergen Hoeller
1e6f2e79b9 Adapted getXmlAsSource implementation to avoid compilation failure in IntelliJ IDEA 2013-11-26 01:41:54 +01:00
Juergen Hoeller
1ee816b473 Re-introduced custom StaxSource and StaxResult for Spring Web Services 2013-11-26 01:40:34 +01:00
Phillip Webb
e6952f41b7 Merge pull request #418 from ericdahl/doc-typos
* doc-typos:
  Fix various typos
2013-11-25 15:59:28 -08:00
Eric Dahl
e9f78f6043 Fix various typos
Fix a variety of typos throughout the project, primarily in
comments (javadoc or otherwise) but also in a handful of log messages
and a couple exception messages.

ISSUE: SPR-11123
2013-11-25 15:58:27 -08:00
Rossen Stoyanchev
4e82416ba9 Add SubProtocolCapable interface
The addition of SubProtocolCapable simplifies configuration since it is
no longer necessary to explicitly configure DefaultHandshakeHandler
with a list of supported sub-protocols. We will not also check if the
WebSocketHandler to use for the WebSocket request is an instance of
SubProtocolCapable and obtain the list of sub-protocols that way. The
provided SubProtocolWebSocketHandler does implement this interface.

Issue: SPR-11111
2013-11-25 18:06:01 -05:00
Phillip Webb
59002f2456 Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing
generics or deprecated code.

Also add the `-Werror` compiler option to ensure that any future
warnings will fail the build.

Issue: SPR-11064
2013-11-25 12:52:42 -08:00
Rossen Stoyanchev
4de3291dc7 Consolidate websocket/messaging code
Before this change spring-messaging contained a few WebSocket-related
classes including WebSocket sub-protocol support for STOMP as well
as @EnableWebSocketMessageBroker and related configuration classes.

After this change those classes are located in the spring-websocket
module under org.springframework.web.socket.messaging.

This means the following classes in application configuration must
have their packages updated:

org.springframework.web.socket.messaging.config.EnableWebSocketMessageBroker
org.springframework.web.socket.messaging.config.StompEndpointRegistry
org.springframework.web.socket.messaging.config.WebSocketMessageBrokerConfigurer

MessageBrokerConfigurer has been renamed to MessageBrokerRegistry and
is also located in the above package.
2013-11-23 21:09:17 -05:00
Juergen Hoeller
f888b8816f Re-enabled tests for meta-annotations on interfaces
Issue: SPR-11108
2013-11-23 00:43:29 +01:00
Juergen Hoeller
f39bb02628 Polishing 2013-11-22 23:29:54 +01:00
Juergen Hoeller
70164cb145 Properly handle InvocationTargetException in reflective JtaPlatform implementation 2013-11-22 23:26:09 +01:00
Juergen Hoeller
519f78c3f5 Optimized ImportAware processing to avoid re-reading class files 2013-11-22 23:22:20 +01:00
Juergen Hoeller
009e362709 @EnableMBeanExport supports placeholders for its attributes now
Issue: SPR-11105
2013-11-22 23:18:47 +01:00
Sam Brannen
ad402dcb4a Status quo for composable stereotypes on interfaces
The tests introduced in this commit demonstrate the current lacking
support for composable stereotypes on interfaces (using @Transactional)
as a concrete example.

Issue: SPR-11108
2013-11-22 16:37:48 +01:00
Sam Brannen
44c5eaeaa3 Fix typo in Javadoc 2013-11-22 16:17:20 +01:00
Sam Brannen
a613126be0 Polish AnnotationUtils
- Added explicit reference to “get” and “find” lookup types in the
  class-level Javadoc.
- Updated documentation for the underlying algorithms in
  findAnnotation(Method,Class) and findAnnotation(Class,Class) in line
  with the status quo.
- Reverted recent changes to findAnnotationDeclaringClass() by removing
  meta-annotation support in order to maintain backwards compatibility
  with previous releases.
2013-11-22 14:39:51 +01:00
Sam Brannen
665251fa2f Suppress deprecation warning in StatusResultMatchers 2013-11-22 12:55:12 +01:00
Sam Brannen
127bc07cda Delete unused package import 2013-11-22 12:49:25 +01:00
Phillip Webb
f3504b2fd5 Fix docs sample for ConversionServiceFactoryBean
Fix the reference documentation example for ConversionServiceFactoryBean
to use a `<set>` instead of a `<list>`.

Issue: SPR-10802
2013-11-21 15:53:22 -08:00
Phillip Webb
d9c4470461 Upgrade to HSQLDB 2.3.1
Replace `hsqldb:hsqldb:1.8.0.10` with `org.hsqldb:hsqldb:2.3.1` and
fix breaking tests.

Issue: SPR-10947
2013-11-21 15:48:17 -08:00
Phillip Webb
87e443b429 Merge pull request #80 from giovannidalloglio/SPR-9164
* SPR-9164:
  Add BigDecimal support for SpEl numeric operations
2013-11-21 14:33:13 -08:00
giovannidalloglio
d0ab131a57 Add BigDecimal support for SpEl numeric operations
Prior to this change, SpEL supported numeric operations for int, float,
ect. `new java.math.BigDecimal('0.1') > 0` evaluated to false
(BigDecimal is truncated to int)

This commit introduces support for BigDecimal operations for all
mathematical operators. `new java.math.BigDecimal('0.1') > 0` now
evaluates to true (the comparison is made with BigDecimals)

Issue: SPR-9164
2013-11-21 14:28:29 -08:00
Phillip Webb
a41958435a Merge pull request #406 from aclement/fix-SPR-9194
* fix-SPR-9194:
  Change SpEL equality operators to use .equals
2013-11-21 12:08:40 -08:00
Andy Clement
2a05e6afa1 Change SpEL equality operators to use .equals
Prior to this commit the SpEL operators `==` and `!=` were using the
Java `==` comparison operator as part of their equality checking. It is
more flexible to use the equals() method on Object.

Under this commit the change to .equals() has been made and the equality
checking code has been pushed into a common method in the Operator
superclass. This commit also makes some tweaks to the other operator
classes - the Float case was missing from OpGT.

Issue: SPR-9194
2013-11-21 12:06:31 -08:00
Phillip Webb
7c3cdf82cc Try a different mbean port 2013-11-21 11:49:49 -08:00
Sam Brannen
3200f3e9a7 Polish Javadoc for TestGroup 2013-11-21 10:53:57 +01:00
Sam Brannen
cfe7a525e2 Revert accidental changes to TestGroupTests 2013-11-21 10:52:53 +01:00
Phillip Webb
639b2cb12e Increase performance test timeout 2013-11-20 22:05:34 -08:00
Phillip Webb
4385da7b84 Support for 'all excluding' test groups 2013-11-20 21:26:17 -08:00
Phillip Webb
02f7803860 Upgrade to Gradle 1.9 2013-11-20 13:14:57 -08:00
Phillip Webb
5c7eaaa969 Fix SpEL docs indicating +/- is Supported on Date
Issue: SPR-11057
2013-11-20 13:13:27 -08:00
Sam Brannen
b830d7362d Support non-public anno. attr. values in AnnoUtils
Prior to this commit, the getValue(Annotation, String) method in
AnnotationUtils failed to retrieve the value of the desired annotation
attribute if the annotation itself was not public -- for example if the
annotation was declared as package private.

This commit addresses this issue by ensuring that getValue(Annotation,
String) uses reflection to make the desired annotation attribute method
accessible before attempting to invoke it to retrieve the value.

Issue: SPR-11104
2013-11-20 21:58:36 +01:00
Sam Brannen
45afd4fbe2 Update build in preparation for Gradle 2.0
As of Gradle 1.8, ‘testReport true’ is deprecated. Thus in order to
generate TestNG reports alongside JUnit reports with Gradle 2.0 and
beyond, we are now using:

  getReports().getHtml().setEnabled(true)
2013-11-20 20:10:19 +01:00
Phillip Webb
63c143be61 Merge pull request #409 from cdupuis/SPR-11083
* SPR-11083:
  Allow instrumentation to be used with Attach API
2013-11-20 10:39:33 -08:00
Christian Dupuis
f6f0adf63b Allow instrumentation to be used with Attach API
Update InstrumentationSavingAgent to allow it to be used with the
Attach API

Issue: SPR-11083
2013-11-20 10:39:24 -08:00
Juergen Hoeller
41cdbd292a Defensively handle non-retrievable ApplicationListener bean names 2013-11-20 14:52:25 +01:00
Juergen Hoeller
6a9e116d78 Polishing 2013-11-20 14:50:59 +01:00
Juergen Hoeller
0de112198e Rely on presence of Servlet 2.5's ServletContext.getContextPath() 2013-11-20 14:50:32 +01:00
Brian Clozel
2ea5360b82 Upgrade Jetty to 9.1.0 GA
Issue: SPR-11099
2013-11-19 17:22:33 -08:00
Brian Clozel
cc4faa5990 Fix standard multipart binding + Polish
Fixing standard multipart binding when multiple parts share
the same name.

Uncomment previously @Ignored tests now that Jetty supports
Servlet 3.0 spec.

Issue: SPR-10591
2013-11-19 17:13:31 -08:00
Phillip Webb
6f2004f4f8 Restore multi-page and PDF reference documentation
Generate docbook xml from the asciidoc reference guide and use the
docbook-reference-plugin to generate HTML (single and multi-page) and
PDF documentation.

Issue: SPR-11096
2013-11-19 16:50:56 -08:00
Phillip Webb
e54fc7bbdc Add whitespace to improve asciidoc readability
Issue: SPR-11096
2013-11-19 16:50:46 -08:00
Phillip Webb
5d8b008a8b Remove superfluous spaces in asciidoc
Remove the superfluous spaces that appear in the asciidoc source.

Issue: SPR-11096
2013-11-19 16:39:37 -08:00