Skip to content

Commit 961dbdb

Browse files
committed
Merge branch '3.2.x' into master
* 3.2.x: Exclude spring-build-src from maven publish Move spring-build-junit into spring-core Relocate MergePlugin package Develop a gradle plugin to add test dependencies Expose Gradle buildSrc for IDE support Fix [deprecation] compiler warnings Upgrade to xmlunit version 1.3 Improve 'build' folder ignores Fix regression in static setter method support Fix SpEL JavaBean compliance for setters Conflicts: spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
2 parents 70eaf02 + c892b81 commit 961dbdb

184 files changed

Lines changed: 1893 additions & 1282 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ jmx.log
1313
derby.log
1414
spring-test/test-output/
1515
.gradle
16-
build
1716
.classpath
1817
.project
1918
argfile*
2019
pom.xml
2120

21+
/build
22+
buildSrc/build
23+
/spring-*/build
24+
2225
# IDEA artifacts and output dirs
2326
*.iml
2427
*.ipr

build.gradle

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ configure(allprojects) {
2828
apply plugin: "java"
2929
apply plugin: "propdeps-eclipse"
3030
apply plugin: "propdeps-idea"
31+
apply plugin: "test-source-set-dependencies"
3132
apply from: "${gradleScriptDir}/ide.gradle"
3233

3334
group = "org.springframework"
@@ -110,7 +111,7 @@ configure(allprojects.findAll{it.name in ["spring", "spring-jms", "spring-orm",
110111
}
111112
}
112113

113-
configure(subprojects - project(":spring-build-junit")) { subproject ->
114+
configure(subprojects - project(":spring-build-src")) { subproject ->
114115
apply plugin: "merge"
115116
apply from: "${gradleScriptDir}/publish-maven.gradle"
116117

@@ -159,35 +160,26 @@ configure(subprojects - project(":spring-build-junit")) { subproject ->
159160
}
160161
}
161162

162-
configure(allprojects - project(":spring-build-junit")) {
163+
configure(allprojects) {
163164
dependencies {
164-
testCompile(project(":spring-build-junit"))
165-
}
166-
167-
eclipse.classpath.file.whenMerged { classpath ->
168-
classpath.entries.find{it.path == "/spring-build-junit"}.exported = false
165+
testCompile("junit:junit:${junitVersion}")
166+
testCompile("org.hamcrest:hamcrest-all:1.3")
169167
}
170-
171168
test.systemProperties.put("testGroups", properties.get("testGroups"))
172169
}
173170

174-
project("spring-build-junit") {
175-
description = "Build-time JUnit dependencies and utilities"
176-
177-
// NOTE: This is an internal project and is not published.
171+
project("spring-build-src") {
172+
description = "Exposes gradle buildSrc for IDE support"
173+
apply plugin: "groovy"
178174

179175
dependencies {
180-
compile("commons-logging:commons-logging:1.1.1")
181-
compile("junit:junit:${junitVersion}")
182-
compile("org.hamcrest:hamcrest-all:1.3")
183-
compile("org.easymock:easymock:${easymockVersion}")
176+
compile gradleApi()
177+
groovy localGroovy()
184178
}
185179

186-
// Don't actually generate any artifacts
187180
configurations.archives.artifacts.clear()
188181
}
189182

190-
191183
project("spring-core") {
192184
description = "Spring Core"
193185

@@ -258,7 +250,7 @@ project("spring-core") {
258250
optional("org.aspectj:aspectjweaver:${aspectjVersion}")
259251
optional("net.sf.jopt-simple:jopt-simple:3.0")
260252
optional("log4j:log4j:1.2.17")
261-
testCompile("xmlunit:xmlunit:1.2")
253+
testCompile("xmlunit:xmlunit:1.3")
262254
testCompile("org.codehaus.woodstox:wstx-asl:3.2.7")
263255
}
264256

@@ -395,7 +387,7 @@ project("spring-oxm") {
395387
optional("org.apache.xmlbeans:xmlbeans:2.4.0")
396388
optional("org.codehaus.castor:castor-xml:1.3.2")
397389
testCompile("org.codehaus.jettison:jettison:1.0.1")
398-
testCompile("xmlunit:xmlunit:1.2")
390+
testCompile("xmlunit:xmlunit:1.3")
399391
testCompile("xmlpull:xmlpull:1.1.3.4a")
400392
testCompile(files(genCastor.classesDir).builtBy(genCastor))
401393
testCompile(files(genJaxb.classesDir).builtBy(genJaxb))
@@ -500,7 +492,7 @@ project("spring-web") {
500492
}
501493
optional("log4j:log4j:1.2.17")
502494
testCompile(project(":spring-context-support")) // for JafMediaTypeFactory
503-
testCompile("xmlunit:xmlunit:1.2")
495+
testCompile("xmlunit:xmlunit:1.3")
504496
}
505497

506498
// pick up ContextLoader.properties in src/main
@@ -536,7 +528,6 @@ project("spring-orm") {
536528
testCompile("org.eclipse.persistence:org.eclipse.persistence.asm:1.0.1")
537529
testCompile("org.eclipse.persistence:org.eclipse.persistence.antlr:1.0.1")
538530
testCompile("hsqldb:hsqldb:${hsqldbVersion}")
539-
testCompile(project(":spring-web").sourceSets.test.output)
540531
compile(project(":spring-core"))
541532
compile(project(":spring-beans"))
542533
optional(project(":spring-aop"))
@@ -592,7 +583,7 @@ project("spring-webmvc") {
592583
testCompile(project(":spring-aop"))
593584
testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
594585
testCompile("rhino:js:1.7R1")
595-
testCompile("xmlunit:xmlunit:1.2")
586+
testCompile("xmlunit:xmlunit:1.3")
596587
testCompile("dom4j:dom4j:1.6.1") {
597588
exclude group: "xml-apis", module: "xml-apis"
598589
}
@@ -701,7 +692,7 @@ project("spring-test-mvc") {
701692
provided("javax.servlet:javax.servlet-api:3.0.1")
702693
optional("org.hamcrest:hamcrest-core:1.3")
703694
optional("com.jayway.jsonpath:json-path:0.8.1")
704-
optional("xmlunit:xmlunit:1.2")
695+
optional("xmlunit:xmlunit:1.3")
705696
testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}")
706697
testCompile("javax.servlet:jstl:1.2")
707698
testCompile("org.hibernate:hibernate-validator:4.3.0.Final")
@@ -786,6 +777,7 @@ configure(rootProject) {
786777

787778
dependencies { // for integration tests
788779
testCompile(project(":spring-core"))
780+
testCompile(project(":spring-core").sourceSets.test.output)
789781
testCompile(project(":spring-beans"))
790782
testCompile(project(":spring-aop"))
791783
testCompile(project(":spring-expression"))

buildSrc/src/main/groovy/org/springframework/build/gradle/merge/MergePlugin.groovy renamed to buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.build.gradle.merge
17+
package org.springframework.build.gradle
1818

1919
import org.gradle.api.*
2020
import org.gradle.api.artifacts.Configuration
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2002-2012 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.build.gradle
18+
19+
import org.gradle.api.Plugin
20+
import org.gradle.api.Project
21+
import org.gradle.api.artifacts.Configuration;
22+
import org.gradle.api.artifacts.ProjectDependency;
23+
24+
25+
/**
26+
* Gradle plugin that automatically updates testCompile dependencies to include
27+
* the test source sets of project dependencies.
28+
*
29+
* @author Phillip Webb
30+
*/
31+
class TestSourceSetDependenciesPlugin implements Plugin<Project> {
32+
33+
@Override
34+
public void apply(Project project) {
35+
project.afterEvaluate {
36+
Set<ProjectDependency> projectDependencies = new LinkedHashSet<>()
37+
for(def configurationName in ["compile", "optional", "provided"]) {
38+
Configuration configuration = project.getConfigurations().findByName(configurationName)
39+
if(configuration) {
40+
projectDependencies.addAll(
41+
configuration.dependencies.findAll { it instanceof ProjectDependency }
42+
)
43+
}
44+
}
45+
projectDependencies.each {
46+
project.dependencies.add("testCompile", it.dependencyProject.sourceSets.test.output)
47+
}
48+
}
49+
}
50+
51+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
implementation-class=org.springframework.build.gradle.merge.MergePlugin
1+
implementation-class=org.springframework.build.gradle.MergePlugin
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
implementation-class=org.springframework.build.gradle.TestSourceSetDependenciesPlugin

settings.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ include "spring-web"
2222
include "spring-webmvc"
2323
include "spring-webmvc-portlet"
2424
include "spring-webmvc-tiles3"
25-
include "spring-build-junit"
25+
26+
// Exposes gradle buildSrc for IDE support
27+
include "buildSrc"
28+
rootProject.children.find{ it.name == "buildSrc" }.name = "spring-build-src"

spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616

1717
package org.springframework.aop.config;
1818

19-
import static org.junit.Assert.*;
19+
import static org.junit.Assert.assertTrue;
20+
import static org.junit.Assert.fail;
2021
import static test.util.TestResourceUtils.qualifiedResource;
2122

2223
import org.junit.Test;
2324
import org.springframework.beans.factory.BeanDefinitionStoreException;
2425
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
25-
import org.springframework.beans.factory.xml.XmlBeanFactory;
26+
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
27+
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
2628

2729
/**
2830
* @author Mark Fisher
@@ -33,7 +35,9 @@ public final class AopNamespaceHandlerPointcutErrorTests {
3335
@Test
3436
public void testDuplicatePointcutConfig() {
3537
try {
36-
new XmlBeanFactory(qualifiedResource(getClass(), "pointcutDuplication.xml"));
38+
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
39+
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
40+
qualifiedResource(getClass(), "pointcutDuplication.xml"));
3741
fail("parsing should have caused a BeanDefinitionStoreException");
3842
}
3943
catch (BeanDefinitionStoreException ex) {
@@ -44,7 +48,9 @@ public void testDuplicatePointcutConfig() {
4448
@Test
4549
public void testMissingPointcutConfig() {
4650
try {
47-
new XmlBeanFactory(qualifiedResource(getClass(), "pointcutMissing.xml"));
51+
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
52+
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
53+
qualifiedResource(getClass(), "pointcutMissing.xml"));
4854
fail("parsing should have caused a BeanDefinitionStoreException");
4955
}
5056
catch (BeanDefinitionStoreException ex) {

spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
import org.aopalliance.intercept.MethodInterceptor;
2323
import org.aopalliance.intercept.MethodInvocation;
2424
import org.junit.Test;
25-
import org.springframework.beans.factory.xml.XmlBeanFactory;
25+
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
26+
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
2627
import org.springframework.core.io.Resource;
2728

2829
/**
@@ -37,25 +38,27 @@ public final class PrototypeTargetTests {
3738
@Test
3839
public void testPrototypeProxyWithPrototypeTarget() {
3940
TestBeanImpl.constructionCount = 0;
40-
XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT);
41+
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
42+
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT);
4143
for (int i = 0; i < 10; i++) {
42-
TestBean tb = (TestBean) xbf.getBean("testBeanPrototype");
44+
TestBean tb = (TestBean) bf.getBean("testBeanPrototype");
4345
tb.doSomething();
4446
}
45-
TestInterceptor interceptor = (TestInterceptor) xbf.getBean("testInterceptor");
47+
TestInterceptor interceptor = (TestInterceptor) bf.getBean("testInterceptor");
4648
assertEquals(10, TestBeanImpl.constructionCount);
4749
assertEquals(10, interceptor.invocationCount);
4850
}
4951

5052
@Test
5153
public void testSingletonProxyWithPrototypeTarget() {
5254
TestBeanImpl.constructionCount = 0;
53-
XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT);
55+
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
56+
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT);
5457
for (int i = 0; i < 10; i++) {
55-
TestBean tb = (TestBean) xbf.getBean("testBeanSingleton");
58+
TestBean tb = (TestBean) bf.getBean("testBeanSingleton");
5659
tb.doSomething();
5760
}
58-
TestInterceptor interceptor = (TestInterceptor) xbf.getBean("testInterceptor");
61+
TestInterceptor interceptor = (TestInterceptor) bf.getBean("testInterceptor");
5962
assertEquals(1, TestBeanImpl.constructionCount);
6063
assertEquals(10, interceptor.invocationCount);
6164
}

spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616

1717
package org.springframework.aop.interceptor;
1818

19-
import static org.junit.Assert.*;
19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertTrue;
2021
import static test.util.TestResourceUtils.qualifiedResource;
2122

2223
import org.aopalliance.intercept.MethodInvocation;
2324
import org.junit.Test;
24-
import org.springframework.beans.factory.xml.XmlBeanFactory;
25+
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
26+
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
2527
import org.springframework.core.io.Resource;
2628

2729
import test.beans.ITestBean;
@@ -40,7 +42,8 @@ public final class ExposeInvocationInterceptorTests {
4042

4143
@Test
4244
public void testXmlConfig() {
43-
XmlBeanFactory bf = new XmlBeanFactory(CONTEXT);
45+
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
46+
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT);
4447
ITestBean tb = (ITestBean) bf.getBean("proxy");
4548
String name= "tony";
4649
tb.setName(name);

0 commit comments

Comments
 (0)