language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/ConstructorBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomCallbackBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ public class CustomCallbackBean { public void init() { System.getProperties(); } - + public void destroy() { System.setProperty("security.destroy", "true"); }
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomFactoryBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/DestroyBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/FactoryBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,12 +19,12 @@ * @author Costin Leau */ public class FactoryBean { - + public static Object makeStaticInstance() { System.getProperties(); return new Object(); } - + protected static Object protectedStaticInstance() { return "protectedStaticInstance"; }
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/InitBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/PropertyBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2006-2009 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,6 +25,6 @@ public void setSecurityProperty(Object property) { } public void setProperty(Object property) { - + } }
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/wiring/BeanConfigurerSupportTests.java
@@ -102,7 +102,7 @@ public void testConfigureBeanPerformsAutowiringByNameIfAppropriateBeanWiringInfo configurer.setBeanWiringInfoResolver(resolver); configurer.configureBean(beanInstance); assertEquals("Bean is evidently not being configured (for some reason)", "David Gavurin", beanInstance.getSpouse().getName()); - + mock.verify(); } @@ -126,7 +126,7 @@ public void testConfigureBeanPerformsAutowiringByTypeIfAppropriateBeanWiringInfo configurer.setBeanWiringInfoResolver(resolver); configurer.configureBean(beanInstance); assertEquals("Bean is evidently not being configured (for some reason)", "David Gavurin", beanInstance.getSpouse().getName()); - + mock.verify(); }
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java
@@ -58,5 +58,5 @@ public void testNaming() { assertFalse(child1.getBeanName().equals(child2.getBeanName())); } - + }
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/ConstructorDependenciesBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,11 +28,11 @@ * @since 09.11.2003 */ public class ConstructorDependenciesBean implements Serializable { - + private int age; - + private String name; - + private TestBean spouse1; private TestBean spouse2;
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/DependenciesBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,11 +28,11 @@ * @since 04.09.2003 */ public class DependenciesBean implements BeanFactoryAware { - + private int age; - + private String name; - + private TestBean spouse; private BeanFactory beanFactory;
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/DummyReferencer.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/DuplicateBeanIdTests.java
@@ -31,11 +31,11 @@ * With Spring 3.1, bean id attributes (and all other id attributes across the * core schemas) are no longer typed as xsd:id, but as xsd:string. This allows * for using the same bean id within nested <beans> elements. - * + * * Duplicate ids *within the same level of nesting* will still be treated as an * error through the ProblemReporter, as this could never be an intended/valid * situation. - * + * * @author Chris Beams * @since 3.1 * @see org.springframework.beans.factory.xml.XmlBeanFactoryTests#testWithDuplicateName
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethods.java
@@ -29,7 +29,7 @@ * @author Juergen Hoeller */ public class FactoryMethods { - + public static FactoryMethods nullInstance() { return null; } @@ -39,21 +39,21 @@ public static FactoryMethods defaultInstance() { tb.setName("defaultInstance"); return new FactoryMethods(tb, "default", 0); } - + /** * Note that overloaded methods are supported. */ public static FactoryMethods newInstance(TestBean tb) { return new FactoryMethods(tb, "default", 0); } - + protected static FactoryMethods newInstance(TestBean tb, int num, String name) { if (name == null) { throw new IllegalStateException("Should never be called with null value"); } return new FactoryMethods(tb, name, num); } - + static FactoryMethods newInstance(TestBean tb, int num, Integer something) { if (something != null) { throw new IllegalStateException("Should never be called with non-null value"); @@ -81,35 +81,35 @@ private FactoryMethods(TestBean tb, String name, int num) { this.name = name; this.num = num; } - + public void setStringValue(String stringValue) { this.stringValue = stringValue; } - + public String getStringValue() { return this.stringValue; } - + public TestBean getTestBean() { return this.tb; } - + protected TestBean protectedGetTestBean() { return this.tb; } - + private TestBean privateGetTestBean() { return this.tb; } - + public int getNum() { return num; } - + public String getName() { return name; } - + /** * Set via Setter Injection once instance is created. */
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/InstanceFactory.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,26 +37,26 @@ public InstanceFactory() { public void setFactoryBeanProperty(String s) { this.factoryBeanProperty = s; } - + public String getFactoryBeanProperty() { return this.factoryBeanProperty; } - + public FactoryMethods defaultInstance() { TestBean tb = new TestBean(); tb.setName(this.factoryBeanProperty); return FactoryMethods.newInstance(tb); } - + /** * Note that overloaded methods are supported. */ public FactoryMethods newInstance(TestBean tb) { return FactoryMethods.newInstance(tb); } - + public FactoryMethods newInstance(TestBean tb, int num, String name) { return FactoryMethods.newInstance(tb, num, name); } - + }
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/TestBeanCreator.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,18 +21,18 @@ /** * Test class for Spring's ability to create * objects using static factory methods, rather - * than constructors. + * than constructors. * @author Rod Johnson */ public class TestBeanCreator { - + public static TestBean createTestBean(String name, int age) { TestBean tb = new TestBean(); tb.setName(name); tb.setAge(age); return tb; } - + public static TestBean createTestBean() { TestBean tb = new TestBean(); tb.setName("Tristan");
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java
@@ -454,7 +454,7 @@ public Object getObject() { * @since 05.06.2003 */ class HasMap { - + private Map map; private IdentityHashMap identityMap; @@ -464,11 +464,11 @@ class HasMap { private CopyOnWriteArraySet concurrentSet; private Properties props; - + private Object[] objectArray; - + private Class[] classArray; - + private Integer[] intArray; public Map getMap() {
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReaderTests.java
@@ -106,7 +106,7 @@ public void testWithInputSource() { catch (BeanDefinitionStoreException expected) { } } - + public void testWithInputSourceAndExplicitValidationMode() { SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();; InputSource resource = new InputSource(getClass().getResourceAsStream("test.xml"));
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/factory/xml/support/DefaultNamespaceHandlerResolverTests.java
@@ -25,7 +25,7 @@ /** * Unit and integration tests for the {@link DefaultNamespaceHandlerResolver} class. - * + * * @author Rob Harrop * @author Rick Evans */
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/propertyeditors/ByteArrayPropertyEditorTests.java
@@ -46,7 +46,7 @@ public void testSunnyDaySetAsText() throws Exception { public void testGetAsTextReturnsEmptyStringIfValueIsNull() throws Exception { PropertyEditor byteEditor = new ByteArrayPropertyEditor(); assertEquals("", byteEditor.getAsText()); - + byteEditor.setAsText(null); assertEquals("", byteEditor.getAsText()); }
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomEditorTests.java
@@ -59,7 +59,7 @@ * @author Rob Harrop * @author Arjen Poutsma * @author Chris Beams - * + * * @since 10.06.2003 */ public class CustomEditorTests { @@ -511,7 +511,7 @@ public void testCharacterEditor() { bw.setPropertyValue("myChar", "\\u0022"); assertEquals('"', cb.getMyChar()); - + CharacterEditor editor = new CharacterEditor(false); editor.setAsText("M"); assertEquals("M", editor.getAsText()); @@ -672,7 +672,7 @@ public void testPatternEditor() { patternEditor = new PatternEditor(); assertEquals("", patternEditor.getAsText()); - + patternEditor = new PatternEditor(); patternEditor.setAsText(null); assertEquals("", patternEditor.getAsText());
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/propertyeditors/PropertiesEditorTests.java
@@ -40,7 +40,7 @@ public void testOneProperty() { assertTrue("contains one entry", p.entrySet().size() == 1); assertTrue("foo=bar", p.get("foo").equals("bar")); } - + public void testTwoProperties() { String s = "foo=bar with whitespace\n" + "me=mi"; @@ -51,7 +51,7 @@ public void testTwoProperties() { assertTrue("foo=bar with whitespace", p.get("foo").equals("bar with whitespace")); assertTrue("me=mi", p.get("me").equals("mi")); } - + public void testHandlesEqualsInValue() { String s = "foo=bar\n" + "me=mi\n" + @@ -64,7 +64,7 @@ public void testHandlesEqualsInValue() { assertTrue("me=mi", p.get("me").equals("mi")); assertTrue("x='y=z'", p.get("x").equals("y=z")); } - + public void testHandlesEmptyProperty() { String s = "foo=bar\nme=mi\nx="; PropertiesEditor pe= new PropertiesEditor(); @@ -75,7 +75,7 @@ public void testHandlesEmptyProperty() { assertTrue("me=mi", p.get("me").equals("mi")); assertTrue("x='y=z'", p.get("x").equals("")); } - + public void testHandlesEmptyPropertyWithoutEquals() { String s = "foo\nme=mi\nx=x"; PropertiesEditor pe= new PropertiesEditor(); @@ -85,7 +85,7 @@ public void testHandlesEmptyPropertyWithoutEquals() { assertTrue("foo is empty", p.get("foo").equals("")); assertTrue("me=mi", p.get("me").equals("mi")); } - + /** * Comments begin with # */ @@ -124,14 +124,14 @@ public void testIgnoresLeadingSpacesAndTabs() { assertTrue("foo is bar", p.get("foo").equals("bar")); assertTrue("me=mi", p.get("me").equals("mi")); } - + public void testNull() { PropertiesEditor pe= new PropertiesEditor(); pe.setAsText(null); Properties p = (Properties) pe.getValue(); assertEquals(0, p.size()); } - + public void testEmptyString() { PropertiesEditor pe = new PropertiesEditor(); pe.setAsText("");
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java
@@ -23,9 +23,9 @@ /** * Unit tests for {@link PropertyComparator} - * + * * @see org.springframework.util.comparator.ComparatorTests - * + * * @author Keith Donald * @author Chris Beams */
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/test/beans/BooleanTestBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/test/beans/DummyBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2010 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ public class DummyBean { private String name; private int age; private TestBean spouse; - + public DummyBean(Object value) { this.value = value; }
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/test/beans/INestedTestBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/test/beans/IOther.java
@@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/test/beans/NestedTestBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/test/beans/NumberTestBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/test/beans/PackageLevelVisibleBean.java
@@ -25,5 +25,5 @@ class PackageLevelVisibleBean { public static final String CONSTANT = "Wuby"; - + }
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-beans/src/test/java/test/util/TestResourceUtils.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2008 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,12 +30,12 @@ public class TestResourceUtils { /** * Loads a {@link ClassPathResource} qualified by the simple name of clazz, * and relative to the package for clazz. - * + * * <p>Example: given a clazz 'com.foo.BarTests' and a resourceSuffix of 'context.xml', * this method will return a ClassPathResource representing com/foo/BarTests-context.xml - * + * * <p>Intended for use loading context configuration XML files within JUnit tests. - * + * * @param clazz * @param resourceSuffix */
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context-support/src/main/java/org/springframework/mail/MailSender.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,7 +30,7 @@ * @see org.springframework.mail.javamail.JavaMailSender */ public interface MailSender { - + /** * Send the given simple mail message. * @param simpleMessage the message to send
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context-support/src/main/java/org/springframework/mail/SimpleMailMessage.java
@@ -67,7 +67,7 @@ public SimpleMailMessage() { /** * Copy constructor for creating a new <code>SimpleMailMessage</code> from the state * of an existing <code>SimpleMailMessage</code> instance. - * @throws IllegalArgumentException if the supplied message is <code>null</code> + * @throws IllegalArgumentException if the supplied message is <code>null</code> */ public SimpleMailMessage(SimpleMailMessage original) { Assert.notNull(original, "The 'original' message argument cannot be null"); @@ -168,7 +168,7 @@ public String getText() { /** * Copy the contents of this message to the given target message. * @param target the <code>MailMessage</code> to copy to - * @throws IllegalArgumentException if the supplied <code>target</code> is <code>null</code> + * @throws IllegalArgumentException if the supplied <code>target</code> is <code>null</code> */ public void copyTo(MailMessage target) { Assert.notNull(target, "The 'target' message argument cannot be null");
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerTemplateUtils.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context-support/src/test/java/org/springframework/beans/INestedTestBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context-support/src/test/java/org/springframework/beans/IOther.java
@@ -1,13 +1,13 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context-support/src/test/java/org/springframework/beans/NestedTestBean.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/cache/annotation/CacheEvict.java
@@ -38,7 +38,7 @@ /** * Qualifier value for the specified cached operation. - * <p>May be used to determine the target cache (or caches), matching the qualifier + * <p>May be used to determine the target cache (or caches), matching the qualifier * value (or the bean name(s)) of (a) specific bean definition. */ String[] value(); @@ -50,7 +50,7 @@ String key() default ""; /** - * Spring Expression Language (SpEL) attribute used for conditioning the method caching. + * Spring Expression Language (SpEL) attribute used for conditioning the method caching. * <p>Default is "", meaning the method is always cached. */ String condition() default "";
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java
@@ -52,7 +52,7 @@ String key() default ""; /** - * Spring Expression Language (SpEL) attribute used for conditioning the method caching. + * Spring Expression Language (SpEL) attribute used for conditioning the method caching. * <p>Default is "", meaning the method is always cached. */ String condition() default "";
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java
@@ -223,7 +223,7 @@ protected Object execute(Invoker invoker, Object target, Method method, Object[] return invoker.invoke(); } - + private void inspectBeforeCacheEvicts(Collection<CacheOperationContext> evictions) { inspectCacheEvicts(evictions, true); } @@ -326,7 +326,7 @@ private CacheStatus inspectCacheables(Collection<CacheOperationContext> cacheabl } } } - + // return a status only if at least on cacheable matched if (atLeastOnePassed) { return new CacheStatus(cUpdates, updateRequire, retVal);
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/ApplicationContext.java
@@ -22,7 +22,7 @@ import org.springframework.core.env.EnvironmentCapable; import org.springframework.core.io.support.ResourcePatternResolver; -/** +/** * Central interface to provide configuration for an application. * This is read-only while the application is running, but may be * reloaded if the implementation supports this.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/ApplicationContextAware.java
@@ -57,8 +57,8 @@ * @see org.springframework.beans.factory.BeanFactoryAware */ public interface ApplicationContextAware extends Aware { - - /** + + /** * Set the ApplicationContext that this object runs in. * Normally this call will be used to initialize the object. * <p>Invoked after population of normal bean properties but before an init callback such
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/HierarchicalMessageSource.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,8 +24,8 @@ * @author Juergen Hoeller */ public interface HierarchicalMessageSource extends MessageSource { - - /** + + /** * Set the parent that will be used to try to resolve messages * that this object can't resolve. * @param parent the parent MessageSource that will be used to
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/MessageSourceResolvable.java
@@ -19,7 +19,7 @@ /** * Interface for objects that are suitable for message resolution in a * {@link MessageSource}. - * + * * <p>Spring's own validation error classes implement this interface. * * @author Juergen Hoeller
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/NoSuchMessageException.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/Phased.java
@@ -19,7 +19,7 @@ /** * Interface for objects that may participate in a phased * process such as lifecycle management. - * + * * @author Mark Fisher * @since 3.0 * @see SmartLifecycle
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/ResourceLoaderAware.java
@@ -46,7 +46,7 @@ * <p>As alternative to a ResourcePatternResolver dependency, consider exposing * bean properties of type Resource array, populated via pattern Strings with * automatic type conversion by the bean factory. - * + * * @author Juergen Hoeller * @author Chris Beams * @since 10.03.2004
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/access/ContextBeanFactoryReference.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -59,7 +59,7 @@ public BeanFactory getFactory() { public void release() { if (this.applicationContext != null) { ApplicationContext savedCtx; - + // We don't actually guarantee thread-safety, but it's not a lot of extra work. synchronized (this) { savedCtx = this.applicationContext;
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/access/DefaultLocatorFactory.java
@@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/access/package-info.java
@@ -2,7 +2,7 @@ /** * * Helper infrastructure to locate and access shared application contexts. - * + * * <p><b>Note: This package is only relevant for special sharing of application * contexts, for example behind EJB facades. It is <i>not</i> used in a typical * web application or standalone application.</b>
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java
@@ -37,7 +37,7 @@ * {@link org.springframework.stereotype.Component @Component} as a * meta-annotation. For example, Spring's stereotype annotations (such as * {@link org.springframework.stereotype.Repository @Repository}) are - * themselves annotated with + * themselves annotated with * {@link org.springframework.stereotype.Component @Component}. * * <p>Also supports Java EE 6's {@link javax.annotation.ManagedBean} and
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/annotation/Bean.java
@@ -118,7 +118,7 @@ * the invocation via a CGLIB proxy. This is analogous to inter-{@code @Transactional} * method calls where in proxy mode, Spring does not intercept the invocation &mdash; * Spring does so only in AspectJ mode. - * + * * <p>For example: * * <pre class="code">
true
Other
spring-projects
spring-framework
1762157ad1a89ff8778387a2c72a8e36ff341a40.json
Remove trailing whitespace in source files find . -type f -name "*.java" -or -name "*.aj" | \ xargs perl -p -i -e "s/[ \t]*$//g" {} \; Issue: SPR-10127
spring-context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java
@@ -256,7 +256,7 @@ protected Set<BeanDefinitionHolder> doScan(String... basePackages) { beanDefinitions.add(definitionHolder); registerBeanDefinition(definitionHolder, this.registry); } - } + } } return beanDefinitions; }
true
Other
spring-projects
spring-framework
1c306dffcd0b450b4f3d07d07934dd83b89193b3.json
Handle non-void write methods deterministically This change resolves a specific issue with processing java.math.BigDecimal via ExtendedBeanInfo. BigDecimal has a particular constellation of #setScale methods that, prior to this change, had the potential to cause ExtendedBeanInfo to throw an IntrospectionException depending on the order in which the methods were processed. Because JDK 7 no longer returns deterministic results from Class#getDeclaredMethods, it became a genuine possibility - indeed a statistical certainty that the 'wrong' setScale method handling order happens sooner or later. Typically one could observe this failure once out of every four test runs. This commit introduces deterministic method ordering of all discovered non-void returning write methods in such a way that solves the problem for BigDecimal as well as for any other class having a similar method arrangement. Also: - Remove unnecessary cast - Pass no method information to PropertyDescriptor superclasses when invoking super(...). This ensures that any 'type mismatch' IntrospectionExceptions are handled locally in ExtendedBeanInfo and its Simple* PropertyDescriptor variants where we have full control. Issue: SPR-10111, SPR-9702
spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java
@@ -31,6 +31,7 @@ import java.lang.reflect.Modifier; import java.util.ArrayList; +import java.util.Collections; import java.util.Comparator; import java.util.Enumeration; import java.util.List; @@ -116,6 +117,14 @@ private List<Method> findNonVoidWriteMethods(MethodDescriptor[] methodDescriptor matches.add(method); } } + // sort non-void returning write methods to guard against the ill effects of + // non-deterministic sorting of methods returned from Class#getDeclaredMethods + // under JDK 7. See http://bugs.sun.com/view_bug.do?bug_id=7023180 + Collections.sort(matches, new Comparator<Method>() { + public int compare(Method m1, Method m2) { + return m2.toString().compareTo(m1.toString()); + } + }); return matches; } @@ -261,7 +270,7 @@ public SimpleNonIndexedPropertyDescriptor(PropertyDescriptor original) public SimpleNonIndexedPropertyDescriptor(String propertyName, Method readMethod, Method writeMethod) throws IntrospectionException { - super(propertyName, readMethod, writeMethod); + super(propertyName, null, null); this.setReadMethod(readMethod); this.setWriteMethod(writeMethod); this.propertyType = findPropertyType(readMethod, writeMethod); @@ -350,7 +359,7 @@ public SimpleIndexedPropertyDescriptor(String propertyName, Method indexedReadMethod, Method indexedWriteMethod) throws IntrospectionException { - super(propertyName, readMethod, writeMethod, indexedReadMethod, indexedWriteMethod); + super(propertyName, null, null, null, null); this.setReadMethod(readMethod); this.setWriteMethod(writeMethod); this.propertyType = findPropertyType(readMethod, writeMethod); @@ -495,7 +504,7 @@ public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDe // copy all attributes (emulating behavior of private FeatureDescriptor#addTable) Enumeration<String> keys = source.attributeNames(); while (keys.hasMoreElements()) { - String key = (String)keys.nextElement(); + String key = keys.nextElement(); target.setValue(key, source.getValue(key)); }
true
Other
spring-projects
spring-framework
1c306dffcd0b450b4f3d07d07934dd83b89193b3.json
Handle non-void write methods deterministically This change resolves a specific issue with processing java.math.BigDecimal via ExtendedBeanInfo. BigDecimal has a particular constellation of #setScale methods that, prior to this change, had the potential to cause ExtendedBeanInfo to throw an IntrospectionException depending on the order in which the methods were processed. Because JDK 7 no longer returns deterministic results from Class#getDeclaredMethods, it became a genuine possibility - indeed a statistical certainty that the 'wrong' setScale method handling order happens sooner or later. Typically one could observe this failure once out of every four test runs. This commit introduces deterministic method ordering of all discovered non-void returning write methods in such a way that solves the problem for BigDecimal as well as for any other class having a similar method arrangement. Also: - Remove unnecessary cast - Pass no method information to PropertyDescriptor superclasses when invoking super(...). This ensures that any 'type mismatch' IntrospectionExceptions are handled locally in ExtendedBeanInfo and its Simple* PropertyDescriptor variants where we have full control. Issue: SPR-10111, SPR-9702
spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
@@ -23,6 +23,7 @@ import java.beans.PropertyDescriptor; import java.lang.reflect.Method; +import java.math.BigDecimal; import org.junit.Test; @@ -582,6 +583,20 @@ class C { } } + /** + * Prior to SPR-10111 (a follow-up fix for SPR-9702), this method would throw an + * IntrospectionException regarding a "type mismatch between indexed and non-indexed + * methods" intermittently (approximately one out of every four times) under JDK 7 + * due to non-deterministic results from {@link Class#getDeclaredMethods()}. + * See http://bugs.sun.com/view_bug.do?bug_id=7023180 + * @see #cornerSpr9702() + */ + @Test + public void cornerSpr10111() throws Exception { + new ExtendedBeanInfo(Introspector.getBeanInfo(BigDecimal.class)); + } + + @Test public void subclassWriteMethodWithCovariantReturnType() throws IntrospectionException { @SuppressWarnings("unused") class B { @@ -692,7 +707,7 @@ public void overloadedNonStandardWriteMethodsOnly_orderB() throws IntrospectionE for (PropertyDescriptor pd : ebi.getPropertyDescriptors()) { if (pd.getName().equals("foo")) { - assertThat(pd.getWriteMethod(), is(C.class.getMethod("setFoo", int.class))); + assertThat(pd.getWriteMethod(), is(C.class.getMethod("setFoo", String.class))); return; } } @@ -730,7 +745,7 @@ public void reproSpr8522() throws IntrospectionException { assertThat(hasReadMethodForProperty(ebi, "dateFormat"), is(false)); assertThat(hasWriteMethodForProperty(ebi, "dateFormat"), is(true)); assertThat(hasIndexedReadMethodForProperty(ebi, "dateFormat"), is(false)); - assertThat(hasIndexedWriteMethodForProperty(ebi, "dateFormat"), is(true)); + assertThat(hasIndexedWriteMethodForProperty(ebi, "dateFormat"), is(trueUntilJdk17())); } @Test @@ -941,4 +956,5 @@ public void setAddress(int index, String addr) { } assertThat(hasIndexedWriteMethodForProperty(bi, "address"), is(true)); } } + }
true
Other
spring-projects
spring-framework
155aecf5573c5298360741f811c7d49651b243d8.json
Fix typo in 3.2 migration guide - @WebApplicationContext --> @WebAppConfiguration Backport-Commit: 62e9d6b105feffcd3b9d8b25e8661f993d703c26
src/reference/docbook/migration-3.2.xml
@@ -124,10 +124,10 @@ <para>You will no longer be able to use the <classname>MockMvcBuilders</classname> <code>annotationConfigSetup</code> and <code>xmlConfigSetup</code> options. Instead you'll need to switch - to using the <interfacename>@WebApplicationContext</interfacename> support + to using the <interfacename>@WebAppConfiguration</interfacename> support of <filename>spring-test</filename> for loading Spring configuration, then inject a <interfacename>WebApplicationContext</interfacename> into - the test and use it to create a <classname>MockMvc</classname>. + the test and use it to create a <classname>MockMvc</classname>. See <xref linkend="spring-mvc-test-framework" /> for details.</para> </section>
false
Other
spring-projects
spring-framework
ccb1153440e87c57f229f559f7754e7096a70b11.json
Fix JavaDoc in MockRestServiceServer
spring-test-mvc/src/main/java/org/springframework/test/web/client/MockRestServiceServer.java
@@ -50,6 +50,7 @@ * &#47;&#47; Use the hotel instance... * * mockServer.verify(); + * </pre> * * <p>To create an instance of this class, use {@link #createServer(RestTemplate)} * and provide the {@code RestTemplate} to set up for the mock testing.
false
Other
spring-projects
spring-framework
bf8a33902f170ef7bcef73dbef0db7c66eb33153.json
Fix JavaDoc in MockRestServiceServer
spring-test-mvc/src/main/java/org/springframework/test/web/client/MockRestServiceServer.java
@@ -50,6 +50,7 @@ * &#47;&#47; Use the hotel instance... * * mockServer.verify(); + * </pre> * * <p>To create an instance of this class, use {@link #createServer(RestTemplate)} * and provide the {@code RestTemplate} to set up for the mock testing.
false
Other
spring-projects
spring-framework
62e9d6b105feffcd3b9d8b25e8661f993d703c26.json
Fix typo in 3.2 migration guide - @WebApplicationContext --> @WebAppConfiguration
src/reference/docbook/migration-3.2.xml
@@ -124,10 +124,10 @@ <para>You will no longer be able to use the <classname>MockMvcBuilders</classname> <code>annotationConfigSetup</code> and <code>xmlConfigSetup</code> options. Instead you'll need to switch - to using the <interfacename>@WebApplicationContext</interfacename> support + to using the <interfacename>@WebAppConfiguration</interfacename> support of <filename>spring-test</filename> for loading Spring configuration, then inject a <interfacename>WebApplicationContext</interfacename> into - the test and use it to create a <classname>MockMvc</classname>. + the test and use it to create a <classname>MockMvc</classname>. See <xref linkend="spring-mvc-test-framework" /> for details.</para> </section>
false
Other
spring-projects
spring-framework
abdcefb460fcbc1348ef04505a78381a2c69a643.json
Release version 3.2.0.RELEASE
gradle.properties
@@ -1 +1 @@ -version=3.2.0.BUILD-SNAPSHOT +version=3.2.0.RELEASE
false
Other
spring-projects
spring-framework
b472fe361da229b0aef0eac2d91dbcb5ea4dfa22.json
Restore 3.2.0.RELEASE url paths in migration guide
src/reference/docbook/migration-3.2.xml
@@ -173,183 +173,183 @@ <para>The following packages and types have been wholly or partially deprecated in Spring Framework 3.2 and may be removed in a future version. Click through to the linked Javadoc for each item for exact details. See also the - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/deprecated-list.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/deprecated-list.html"> complete list of deprecations</link> in the framework.</para> <itemizedlist> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/orm/ibatis/package-summary.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/orm/ibatis/package-summary.html"> org.springframework.orm.ibatis</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/scheduling/backportconcurrent/package-summary.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/scheduling/backportconcurrent/package-summary.html"> org.springframework.scheduling.backportconcurrent</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/ejb/support/package-summary.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/ejb/support/package-summary.html"> org.springframework.ejb.support</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/http/converter/xml/XmlAwareFormHttpMessageConverter.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/http/converter/xml/XmlAwareFormHttpMessageConverter.html"> org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/jsf/DelegatingVariableResolver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/jsf/DelegatingVariableResolver.html"> org.springframework.web.jsf.DelegatingVariableResolver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/jsf/SpringBeanVariableResolver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/jsf/SpringBeanVariableResolver.html"> org.springframework.web.jsf.SpringBeanVariableResolver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/ui/velocity/CommonsLoggingLogSystem.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/ui/velocity/CommonsLoggingLogSystem.html"> org.springframework.ui.velocity.CommonsLoggingLogSystem</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/ui/velocity/VelocityEngineUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/ui/velocity/VelocityEngineUtils.html"> org.springframework.ui.velocity.VelocityEngineUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/config/BeanReferenceFactoryBean.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/beans/factory/config/BeanReferenceFactoryBean.html"> org.springframework.beans.factory.config.BeanReferenceFactoryBean</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/config/CommonsLogFactoryBean.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/beans/factory/config/CommonsLogFactoryBean.html"> org.springframework.beans.factory.config.CommonsLogFactoryBean</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/instrument/classloading/oc4j/OC4JLoadTimeWeaver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/instrument/classloading/oc4j/OC4JLoadTimeWeaver.html"> org.springframework.beans.instrument.classloading.oc4j.OC4JLoadTimeWeaver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/transaction/jta/OC4JJtaTransactionManager.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/transaction/jta/OC4JJtaTransactionManager.html"> org.springframework.transaction.jta.OC4JJtaTransactionManager</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/util/ExpressionEvaluationUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/util/ExpressionEvaluationUtils.html"> org.springframework.web.util.ExpressionEvaluationUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.html"> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.html"> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/mvc/annotation/DefaultAnnotationHandlerMapping.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/mvc/annotation/DefaultAnnotationHandlerMapping.html"> org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtils.html"> org.springframework.web.servlet.mvc.annotation.ServletAnnotationMappingUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/jmx/support/MBeanRegistrationSupport.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/jmx/support/MBeanRegistrationSupport.html"> org.springframework.jmx.support.MBeanRegistrationSupport</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/context/ContextConfigurationAttributes.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/test/context/ContextConfigurationAttributes.html"> org.springframework.test.context.ContextConfigurationAttributes</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.html"> org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests</link>: use of the <varname>simpleJdbcTemplate</varname> instance variable has been deprecated in favor of the new <varname>jdbcTemplate</varname> instance variable.</para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.html"> org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests</link>: use of the <varname>simpleJdbcTemplate</varname> instance variable has been deprecated in favor of the new <varname>jdbcTemplate</varname> instance variable.</para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/jdbc/SimpleJdbcTestUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/test/jdbc/SimpleJdbcTestUtils.html"> org.springframework.test.jdbc.SimpleJdbcTestUtils</link> has been deprecated in favor of <classname>JdbcTestUtils</classname> which now contains all of the functionality previously available in <classname>SimpleJdbcTestUtils</classname>.</para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/view/ContentNegotiatingViewResolver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/view/ContentNegotiatingViewResolver.html"> org.springframework.web.servlet.view.ContentNegotiatingViewResolver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/transaction/interceptor/TransactionAspectUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/transaction/interceptor/TransactionAspectUtils.html"> org.springframework.transaction.interceptor.TransactionAspectUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/http/HttpStatus.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/http/HttpStatus.html"> org.springframework.http.HttpStatus</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/util/UriUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/util/UriUtils.html"> org.springframework.web.util.UriUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/orm/jpa/vendor/TopLinkJpaDialect.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/orm/jpa/vendor/TopLinkJpaDialect.html"> org.springframework.orm.jpa.vendor.TopLinkJpaDialect</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/orm/jpa/vendor/TopLinkJpaVendorAdapter.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/orm/jpa/vendor/TopLinkJpaVendorAdapter.html"> org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/util/CachingMapDecorator.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/util/CachingMapDecorator.html"> org.springframework.orm.util.CachingMapDecorator</link> </para> </listitem>
false
Other
spring-projects
spring-framework
57468aded9ce8edb721e0df0235e61d6c6036abd.json
Upgrade reference plugin to version 0.2.4 Pick up fix for regression in version 0.2.3 that caused project-specific images, e.g. diagrams not to be copied into the images/ folder, thereby causing broken image links online and in the PDF.
build.gradle
@@ -4,7 +4,7 @@ buildscript { } dependencies { classpath("org.springframework.build.gradle:propdeps-plugin:0.0.1") - classpath("org.springframework.build.gradle:docbook-reference-plugin:0.2.3") + classpath("org.springframework.build.gradle:docbook-reference-plugin:0.2.4") } }
false
Other
spring-projects
spring-framework
c5c464c8850d3022afd18507989561a5980ddef5.json
Remove previousVersion from 'jdiff' Gradle task
gradle.properties
@@ -1,2 +1 @@ -previousVersion=3.2.0.RC2 version=3.2.0.BUILD-SNAPSHOT
true
Other
spring-projects
spring-framework
c5c464c8850d3022afd18507989561a5980ddef5.json
Remove previousVersion from 'jdiff' Gradle task
gradle/jdiff.gradle
@@ -2,12 +2,12 @@ * Generate a JDiff report between the current version and an older version. * * Usage: - * gradle jdiff [-D OLD_VERSION=3.1.3.RELEASE] -D OLD_VERSION_ROOT=/path/to/3.1.3.RELEASE + * gradle jdiff -D OLD_VERSION=3.1.3.RELEASE -D OLD_VERSION_ROOT=/path/to/3.1.3.RELEASE * * View generated report at: * build/reports/jdiff/changes.html * - * @param OLD_VERSION optional, defaulting to value of `previousVersion` in gradle.properties + * @param OLD_VERSION required * @param OLD_VERSION_ROOT required, typically pointing to a separate git clone dir */ task jdiff { @@ -21,17 +21,18 @@ task jdiff { classname: "jdiff.JDiffAntTask", classpath: "${jdiffHome}/antjdiff.jar") - def previousVersion = rootProject.previousVersion - def currentVersion = rootProject.version def currentVersionRoot = rootProject.rootDir - def oldVersion = System.getProperty("OLD_VERSION") ?: previousVersion + def oldVersion = System.getProperty("OLD_VERSION") def oldVersionRoot = System.getProperty("OLD_VERSION_ROOT") def outputDir = "${rootProject.buildDir}/reports/jdiff/${oldVersion}_to_${currentVersion}" doLast { + if (oldVersion == null) + throw new IllegalArgumentException( + "Set OLD_VERSION property to indicate older of the two versions being compared") if (oldVersionRoot == null) throw new IllegalArgumentException( "Set OLD_VERSION_ROOT property to indicate the root directory for ${oldVersion}")
true
Other
spring-projects
spring-framework
59a8da3eff57f51a6903ef934cf96c3ed4cf7d44.json
Polish the migration guide - Added missing <para> tags to the JDiff reports section. - Converted tabs to spaces.
src/reference/docbook/migration-3.2.xml
@@ -148,6 +148,7 @@ <section xml:id="migration-3.2-api-changes"> <title>JDiff reports</title> + <para> Select JDiff reports are now being published to provide users with a convenient means of understanding what's changed between versions. Going forward these will be published between each minor version, e.g. from 3.1.3.RELEASE to 3.1.4.RELEASE; from @@ -157,6 +158,7 @@ and/or RC for users who are tracking next-generation development, e.g. <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RC2_to_3.2.0.RELEASE"> 3.2.0.RC2 to 3.2.0.RELEASE</link>. + </para> </section> <section xml:id="migration-3.2-removals-and-deprecations"> @@ -292,8 +294,8 @@ <para> <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.html"> org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests</link>: - use of the <varname>simpleJdbcTemplate</varname> instance variable has been deprecated - in favor of the new <varname>jdbcTemplate</varname> instance variable.</para> + use of the <varname>simpleJdbcTemplate</varname> instance variable has been deprecated + in favor of the new <varname>jdbcTemplate</varname> instance variable.</para> </listitem> <listitem> <para>
false
Other
spring-projects
spring-framework
2775862c5083da345ea06ecaeed2875abc8e4c97.json
Update migration guide regarding spring-test This commit adds information to the 3.2 migration guide regarding deprecations and Maven dependencies in the spring-test module.
src/reference/docbook/migration-3.2.xml
@@ -9,7 +9,7 @@ http://www.w3.org/1999/xlink http://www.docbook.org/xml/5.0/xsd/xlink.xsd"> <title>Migrating to Spring Framework 3.2</title> - <para>In this appendix we discuss discuss what users will want to know when upgrading to + <para>In this appendix we discuss what users will want to know when upgrading to Spring Framework 3.2. For a general overview of features, please see <xref linkend="new-in-3.2"/></para> @@ -124,6 +124,25 @@ <xref linkend="spring-mvc-test-framework" /> for details.</para> </section> + <section xml:id="migration-3.2-compatibility-spring-test"> + <title>Spring Test Dependencies</title> + + <para>The <literal>spring-test</literal> module has been upgraded to + depend on JUnit 4.11 (<literal>junit:junit</literal>), TestNG 6.5.2 + (<literal>org.testng:testng</literal>), and Hamcrest Core 1.3 + (<literal>org.hamcrest:hamcrest-core</literal>). Each of these + dependencies is declared as an <emphasis>optional</emphasis> dependency + in the Maven POM. Furthermore, it is important to note that the JUnit + team has stopped inlining Hamcrest Core within the + <literal>junit:junit</literal> Maven artifact as of JUnit 4.11. Thus, if + your existing JUnit-based tests make use of Hamcrest matchers that were + previously available directly within the <literal>junit:junit</literal> + JAR, you will now need to explicitly declare a dependency on + <literal>org.hamcrest:hamcrest-core</literal>, + <literal>org.hamcrest:hamcrest-library</literal>, or + <literal>org.hamcrest:hamcrest-all</literal>.</para> + </section> + <section xml:id="migration-3.2-changes"> <title>Public API changes</title> @@ -265,20 +284,23 @@ <listitem> <para> <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.html"> - org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests</link> - </para> + org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests</link>: + use of the <varname>simpleJdbcTemplate</varname> instance variable has been deprecated + in favor of the new <varname>jdbcTemplate</varname> instance variable.</para> </listitem> <listitem> <para> <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.html"> - org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests</link> - </para> + org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests</link>: + use of the <varname>simpleJdbcTemplate</varname> instance variable has been deprecated + in favor of the new <varname>jdbcTemplate</varname> instance variable.</para> </listitem> <listitem> <para> <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/jdbc/SimpleJdbcTestUtils.html"> - org.springframework.test.jdbc.SimpleJdbcTestUtils</link> - </para> + org.springframework.test.jdbc.SimpleJdbcTestUtils</link> has been deprecated in + favor of <classname>JdbcTestUtils</classname> which now contains all of the + functionality previously available in <classname>SimpleJdbcTestUtils</classname>.</para> </listitem> <listitem> <para>
false
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/beans-annotation-config.xml
@@ -77,14 +77,14 @@ &lt;/beans&gt;</programlisting> <para>(The implicitly registered post-processors include <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.html" ><classname>AutowiredAnnotationBeanPostProcessor</classname></link>, <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.html" ><classname>CommonAnnotationBeanPostProcessor</classname></link>, <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.html" ><classname>PersistenceAnnotationBeanPostProcessor</classname></link>, as well as the aforementioned <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.html" ><classname>RequiredAnnotationBeanPostProcessor</classname></link>.)</para> <note> @@ -643,7 +643,7 @@ public @interface MovieQualifier { <title><classname>CustomAutowireConfigurer</classname></title> <para>The <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.html" ><classname>CustomAutowireConfigurer</classname></link> is a <interfacename>BeanFactoryPostProcessor</interfacename> that enables you to register your own custom qualifier annotation types even if they are @@ -724,7 +724,7 @@ public @interface MovieQualifier { the <interfacename>ApplicationContext</interfacename> of which the <classname>CommonAnnotationBeanPostProcessor</classname> is aware. The names can be resolved through JNDI if you configure Spring's <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/jndi/support/SimpleJndiBeanFactory.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/jndi/support/SimpleJndiBeanFactory.html" ><classname>SimpleJndiBeanFactory</classname></link> explicitly. However, it is recommended that you rely on the default behavior and simply use Spring's JNDI lookup capabilities to preserve the level of
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/beans-classpath-scanning.xml
@@ -402,7 +402,7 @@ public class MovieFinderImpl implements MovieFinder { <note> <para>If you do not want to rely on the default bean-naming strategy, you can provide a custom bean-naming strategy. First, implement the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/beans/factory/support/BeanNameGenerator.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/support/BeanNameGenerator.html" ><interfacename>BeanNameGenerator</interfacename></link> interface, and be sure to include a default no-arg constructor. Then, provide the fully-qualified class name when configuring the scanner:</para> @@ -439,7 +439,7 @@ public class MovieFinderImpl implements MovieFinder { <note> <para>To provide a custom strategy for scope resolution rather than relying on the annotation-based approach, implement the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/context/annotation/ScopeMetadataResolver.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/ScopeMetadataResolver.html" ><interfacename>ScopeMetadataResolver</interfacename></link> interface, and be sure to include a default no-arg constructor. Then, provide the fully-qualified class name when configuring the scanner:</para>
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/beans-context-additional.xml
@@ -17,7 +17,7 @@ functionality for managing and manipulating beans, including in a programmatic way. The <literal>org.springframework.context</literal> package adds the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/context/ApplicationContext.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/context/ApplicationContext.html" ><interfacename>ApplicationContext</interfacename></link> interface, which extends the <interfacename>BeanFactory</interfacename> interface, in addition to extending other interfaces to provide additional functionality @@ -639,7 +639,7 @@ argument.required=Ebagum lad, the '{0}' argument is required, I say, required.</ <interfacename>TaskExecutor</interfacename> abstraction.</para> <para>Check out the JavaDoc of the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/jca/context/SpringContextResourceAdapter.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/jca/context/SpringContextResourceAdapter.html" >SpringContextResourceAdapter</link> class for the configuration details involved in RAR deployment.</para>
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/beans-scopes.xml
@@ -545,7 +545,7 @@ implement your own scopes, see the <interfacename>Scope</interfacename> implementations that are supplied with the Spring Framework itself and the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/beans/factory/config/Scope.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/config/Scope.html" >Scope Javadoc</link>, which explains the methods you need to implement in more detail.</para>
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/beans.xml
@@ -33,11 +33,11 @@ The footnote should x-ref to first section in that chapter but I can't find the <para>The <literal>org.springframework.beans</literal> and <literal>org.springframework.context</literal> packages are the basis for Spring Framework's IoC container. The <interfacename><link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/beans/factory/BeanFactory.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/BeanFactory.html" >BeanFactory</link></interfacename> interface provides an advanced configuration mechanism capable of managing any type of object. <literal><link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/context/ApplicationContext.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/context/ApplicationContext.html" >ApplicationContext</link></literal> is a sub-interface of <interfacename>BeanFactory.</interfacename> It adds easier integration with Spring's AOP features; message resource handling (for use in
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/migration-3.2.xml
@@ -145,180 +145,180 @@ <para>The following packages and types have been wholly or partially deprecated in Spring Framework 3.2 and may be removed in a future version. Click through to the linked Javadoc for each item for exact details. See also the - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/deprecated-list.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/deprecated-list.html"> complete list of deprecations</link> in the framework.</para> <itemizedlist> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/orm/ibatis/package-summary.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/orm/ibatis/package-summary.html"> org.springframework.orm.ibatis</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/scheduling/backportconcurrent/package-summary.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/scheduling/backportconcurrent/package-summary.html"> org.springframework.scheduling.backportconcurrent</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/ejb/support/package-summary.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/ejb/support/package-summary.html"> org.springframework.ejb.support</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/http/converter/xml/XmlAwareFormHttpMessageConverter.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/http/converter/xml/XmlAwareFormHttpMessageConverter.html"> org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/jsf/DelegatingVariableResolver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/jsf/DelegatingVariableResolver.html"> org.springframework.web.jsf.DelegatingVariableResolver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/jsf/SpringBeanVariableResolver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/jsf/SpringBeanVariableResolver.html"> org.springframework.web.jsf.SpringBeanVariableResolver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/ui/velocity/CommonsLoggingLogSystem.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/ui/velocity/CommonsLoggingLogSystem.html"> org.springframework.ui.velocity.CommonsLoggingLogSystem</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/ui/velocity/VelocityEngineUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/ui/velocity/VelocityEngineUtils.html"> org.springframework.ui.velocity.VelocityEngineUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/beans/factory/config/BeanReferenceFactoryBean.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/config/BeanReferenceFactoryBean.html"> org.springframework.beans.factory.config.BeanReferenceFactoryBean</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/beans/factory/config/CommonsLogFactoryBean.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/config/CommonsLogFactoryBean.html"> org.springframework.beans.factory.config.CommonsLogFactoryBean</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/instrument/classloading/oc4j/OC4JLoadTimeWeaver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/instrument/classloading/oc4j/OC4JLoadTimeWeaver.html"> org.springframework.beans.instrument.classloading.oc4j.OC4JLoadTimeWeaver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/transaction/jta/OC4JJtaTransactionManager.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/transaction/jta/OC4JJtaTransactionManager.html"> org.springframework.transaction.jta.OC4JJtaTransactionManager</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/util/ExpressionEvaluationUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/util/ExpressionEvaluationUtils.html"> org.springframework.web.util.ExpressionEvaluationUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.html"> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.html"> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/mvc/annotation/DefaultAnnotationHandlerMapping.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/mvc/annotation/DefaultAnnotationHandlerMapping.html"> org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtils.html"> org.springframework.web.servlet.mvc.annotation.ServletAnnotationMappingUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/jmx/support/MBeanRegistrationSupport.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/jmx/support/MBeanRegistrationSupport.html"> org.springframework.jmx.support.MBeanRegistrationSupport</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/test/context/ContextConfigurationAttributes.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/context/ContextConfigurationAttributes.html"> org.springframework.test.context.ContextConfigurationAttributes</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.html"> org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.html"> org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/test/jdbc/SimpleJdbcTestUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/test/jdbc/SimpleJdbcTestUtils.html"> org.springframework.test.jdbc.SimpleJdbcTestUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/servlet/view/ContentNegotiatingViewResolver.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/view/ContentNegotiatingViewResolver.html"> org.springframework.web.servlet.view.ContentNegotiatingViewResolver</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/transaction/interceptor/TransactionAspectUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/transaction/interceptor/TransactionAspectUtils.html"> org.springframework.transaction.interceptor.TransactionAspectUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/http/HttpStatus.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/http/HttpStatus.html"> org.springframework.http.HttpStatus</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/web/util/UriUtils.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/util/UriUtils.html"> org.springframework.web.util.UriUtils</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/orm/jpa/vendor/TopLinkJpaDialect.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/orm/jpa/vendor/TopLinkJpaDialect.html"> org.springframework.orm.jpa.vendor.TopLinkJpaDialect</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/orm/jpa/vendor/TopLinkJpaVendorAdapter.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/orm/jpa/vendor/TopLinkJpaVendorAdapter.html"> org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter</link> </para> </listitem> <listitem> <para> - <link xl:href="http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/javadoc-api/org/springframework/util/CachingMapDecorator.html"> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/util/CachingMapDecorator.html"> org.springframework.orm.util.CachingMapDecorator</link> </para> </listitem>
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/scheduling.xml
@@ -884,7 +884,7 @@ public class ExampleJob extends QuartzJobBean { <classname>SchedulerFactoryBean</classname> for you to set, such as the calendars used by the job details, properties to customize Quartz with, etc. Have a look at the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/scheduling/quartz/SchedulerFactoryBean.html">SchedulerFactoryBean + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/scheduling/quartz/SchedulerFactoryBean.html">SchedulerFactoryBean Javadoc</link> for more information.</para> </section> </section>
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/validation.xml
@@ -215,9 +215,9 @@ <para>More information on the <interfacename>MessageCodesResolver</interfacename> and the default strategy can be found online with the Javadocs for <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/validation/MessageCodesResolver.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/validation/MessageCodesResolver.html" >MessageCodesResolver</link> and <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/validation/DefaultMessageCodesResolver.html" + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/validation/DefaultMessageCodesResolver.html" >DefaultMessageCodesResolver</link> respectively.</para> </section>
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/view.xml
@@ -1147,7 +1147,7 @@ findOwnersForm.url=/WEB-INF/jsp/findOwners.jsp &lt;/bean&gt;</programlisting> <para>Refer to the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/ui/velocity/VelocityEngineFactory.html">API + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/ui/velocity/VelocityEngineFactory.html">API documentation</link> for Spring configuration of Velocity, or the Velocity documentation for examples and definitions of the <filename>'velocity.properties'</filename> file itself.</para>
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/web-integration.xml
@@ -88,7 +88,7 @@ contains all of the 'business beans' in one's application.</para> <para>On to specifics: all that one need do is to declare a <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/context/ContextLoaderListener.html"><classname>ContextLoaderListener</classname></link> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/context/ContextLoaderListener.html"><classname>ContextLoaderListener</classname></link> in the standard Java EE servlet <literal>web.xml</literal> file of one's web application, and add a <literal>contextConfigLocation</literal> &lt;context-param/&gt; section (in the same file) that defines which set @@ -111,7 +111,7 @@ context parameter, the <classname>ContextLoaderListener</classname> will look for a file called <literal>/WEB-INF/applicationContext.xml</literal> to load. Once the context files are loaded, Spring creates a <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/context/WebApplicationContext.html"><classname>WebApplicationContext</classname></link> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/context/WebApplicationContext.html"><classname>WebApplicationContext</classname></link> object based on the bean definitions and stores it in the <interfacename>ServletContext</interfacename> of the web application.</para> @@ -123,7 +123,7 @@ <programlisting language="java">WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext);</programlisting> <para>The <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/context/support/WebApplicationContextUtils.html"><classname>WebApplicationContextUtils</classname></link> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/context/support/WebApplicationContextUtils.html"><classname>WebApplicationContextUtils</classname></link> class is for convenience, so you don't have to remember the name of the <interfacename>ServletContext</interfacename> attribute. Its <emphasis>getWebApplicationContext()</emphasis> method will return @@ -181,7 +181,7 @@ <para>The easiest way to integrate one's Spring middle-tier with one's JSF web layer is to use the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/jsf/DelegatingVariableResolver.html"> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/jsf/DelegatingVariableResolver.html"> <classname>DelegatingVariableResolver</classname></link> class. To configure this variable resolver in one's application, one will need to edit one's <emphasis>faces-context.xml</emphasis> file. After the @@ -279,7 +279,7 @@ well when mapping one's properties to beans in <emphasis>faces-config.xml</emphasis>, but at times one may need to grab a bean explicitly. The <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/jsf/FacesContextUtils.html"> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/jsf/FacesContextUtils.html"> <classname>FacesContextUtils</classname></link> class makes this easy. It is similar to <classname>WebApplicationContextUtils</classname>, except that it takes a <classname>FacesContext</classname> parameter @@ -338,7 +338,7 @@ <title>ContextLoaderPlugin</title> <para>The <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/struts/ContextLoaderPlugIn.html"><classname>ContextLoaderPlugin</classname></link> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/struts/ContextLoaderPlugIn.html"><classname>ContextLoaderPlugin</classname></link> is a Struts 1.1+ plug-in that loads a Spring context file for the Struts <classname>ActionServlet</classname>. This context refers to the root <classname>WebApplicationContext</classname> (loaded by the @@ -409,7 +409,7 @@ <title>DelegatingRequestProcessor</title> <para>To configure the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/struts/DelegatingRequestProcessor.html"> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/struts/DelegatingRequestProcessor.html"> <literal>DelegatingRequestProcessor</literal></link> in your <emphasis>struts-config.xml</emphasis> file, override the "processorClass" property in the &lt;controller&gt; element. These @@ -437,7 +437,7 @@ <note> <para>If you are using Tiles in your Struts application, you must configure your &lt;controller&gt; with the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/struts/DelegatingTilesRequestProcessor.html"><classname>DelegatingTilesRequestProcessor</classname></link> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/struts/DelegatingTilesRequestProcessor.html"><classname>DelegatingTilesRequestProcessor</classname></link> instead.</para> </note> </section> @@ -449,7 +449,7 @@ can't use the <classname>DelegatingRequestProcessor</classname> or <classname>DelegatingTilesRequestProcessor</classname> approaches, you can use the <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/struts/DelegatingActionProxy.html"> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/struts/DelegatingActionProxy.html"> <classname>DelegatingActionProxy</classname></link> as the type in your action-mapping.</para> @@ -487,7 +487,7 @@ is to extend Spring's <classname>Action</classname> classes for Struts. For example, instead of subclassing Struts' <classname>Action</classname> class, you can subclass Spring's <link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/struts/ActionSupport.html"> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/struts/ActionSupport.html"> <classname>ActionSupport</classname></link> class.</para> <para>The <classname>ActionSupport</classname> class provides additional @@ -516,23 +516,23 @@ to the name: <itemizedlist spacing="compact"> <listitem> <para><link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/struts/ActionSupport.html"><classname>ActionSupport</classname></link>,</para> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/struts/ActionSupport.html"><classname>ActionSupport</classname></link>,</para> </listitem> <listitem> <para><link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/struts/DispatchActionSupport.html"><literal>DispatchActionSupport</literal></link>,</para> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/struts/DispatchActionSupport.html"><literal>DispatchActionSupport</literal></link>,</para> </listitem> <listitem> <para><link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/struts/LookupDispatchActionSupport.html"><literal>LookupDispatchActionSupport</literal></link> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/struts/LookupDispatchActionSupport.html"><literal>LookupDispatchActionSupport</literal></link> and</para> </listitem> <listitem> <para><link - xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/web/struts/MappingDispatchActionSupport.html"><literal>MappingDispatchActionSupport</literal></link>.</para> + xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/web/struts/MappingDispatchActionSupport.html"><literal>MappingDispatchActionSupport</literal></link>.</para> </listitem> </itemizedlist></para>
true
Other
spring-projects
spring-framework
b3b1fe1566e2e15a3d1751d19c9a6a7163dac6dd.json
Update API links in reference documentation Replace all API links with the correct springsource.org URL
src/reference/docbook/xsd-configuration.xml
@@ -144,7 +144,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem <section xml:id="xsd-config-body-schemas-util-frfb"> <title>Setting a bean property or constructor arg from a field value</title> <para> - <link xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.html"><classname>FieldRetrievingFactoryBean</classname></link> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.html"><classname>FieldRetrievingFactoryBean</classname></link> is a <interfacename>FactoryBean</interfacename> which retrieves a <literal>static</literal> or non-static field value. It is typically used for retrieving <literal>public</literal> <literal>static</literal> @@ -153,7 +153,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem </para> <para> Find below an example which shows how a <literal>static</literal> field is exposed, by - using the <link xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.html#setStaticField(java.lang.String)"><literal>staticField</literal></link> + using the <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.html#setStaticField(java.lang.String)"><literal>staticField</literal></link> property: </para> <programlisting language="xml"><![CDATA[<bean id="myField" @@ -180,7 +180,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem <para> It is also possible to access a non-static (instance) field of another bean, as described in the API documentation for the - <link xl:href="http://static.springframework.org/spring/docs/current/api/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.html"><classname>FieldRetrievingFactoryBean</classname></link> + <link xl:href="http://static.springsource.org/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.html"><classname>FieldRetrievingFactoryBean</classname></link> class. </para> <para>
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
build.gradle
@@ -548,6 +548,48 @@ project('spring-test') { } } +project('spring-test-mvc') { + description = 'Spring Test MVC Framework' + apply from: 'test-mvc.gradle' + dependencies { + compile project(":spring-context") + compile project(":spring-webmvc") + compile project(":spring-test").sourceSets.main.output + compile("org.apache.tomcat:tomcat-servlet-api:7.0.8", provided) + compile "org.hamcrest:hamcrest-all:1.1" + compile("com.jayway.jsonpath:json-path:0.8.1", optional) + compile("xmlunit:xmlunit:1.2", optional) + testCompile("org.slf4j:jcl-over-slf4j:1.6.1") + testCompile("org.slf4j:slf4j-log4j12:1.6.1") { + exclude group: 'log4j', module: 'log4j' + } + testCompile("log4j:log4j:1.2.15") { + exclude group: 'javax.mail', module: 'mail' + exclude group: 'javax.jms', module: 'jms' + exclude group: 'com.sun.jdmk', module: 'jmxtools' + exclude group: 'com.sun.jmx', module: 'jmxri' + } + testCompile "javax.servlet:jstl:1.2" + testCompile "org.apache.tiles:tiles-jsp:2.2.2" + testCompile "org.hibernate:hibernate-validator:4.2.0.Final" + testCompile "org.codehaus.jackson:jackson-mapper-asl:1.4.2" + testCompile project(":spring-oxm") + testCompile "com.thoughtworks.xstream:xstream:1.3.1" + testCompile "cglib:cglib-nodep:2.2" + testCompile "rome:rome:1.0" + testCompile "javax.xml.bind:jaxb-api:2.2.6" + testCompile("org.springframework.security:spring-security-core:3.1.2.RELEASE") { + exclude group: 'org.springframework' + } + testCompile("org.springframework.security:spring-security-web:3.1.2.RELEASE") { + exclude group: 'org.springframework' + } + testCompile("org.springframework.security:spring-security-config:3.1.2.RELEASE") { + exclude group: 'org.springframework' + } + } +} + project('spring-struts') { description = 'Spring Struts' dependencies {
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
merge-dist.gradle
@@ -0,0 +1,72 @@ +import org.gradle.plugins.ide.eclipse.model.ProjectDependency + +/** + * Will merge the distributions of the current project into mergeIntoProject. For + * example, to bundle spring-test-mvc in spring-test's jars. This script will perform the + * following steps: + * <ul> + * <li>Ensure that jar tasks of the project being merged from will execute the tasks of + * the project being merged into</li> + * <li>Add the project being merged into to the classpath of the project being merged + * from</li> + * <li>Update the pom.xml of the project being merged into to contain the entries from + * the project being merged from</li> + * </ul> + * + * Example Usage: + * + * ext.mergeIntoProject = project(':spring-test') + * apply from: "${rootProject.projectDir}/merge-dist.gradle" + */ + +def mergeFromProject = project + +// invoking a task on mergeFromProject will invoke the task with the same name on mergeIntoProject +def taskNamesToMerge = ['sourcesJar','jar','javadocJar','javadoc','install'] +taskNamesToMerge.each { taskName -> + def taskToRemove = tasks.getByPath(taskName) + taskToRemove.enabled = false + taskToRemove.dependsOn mergeIntoProject."$taskName" +} + +// update mergeIntoProject artifacts to contain the mergeFromProject artifact contents +mergeIntoProject."sourcesJar" { + from mergeFromProject.sourcesJar.source +} +mergeIntoProject."jar" { + from mergeFromProject.jar.source +} +mergeIntoProject."javadoc" { + source += mergeFromProject.javadoc.source + classpath += mergeFromProject.javadoc.classpath +} + +// GRADLE-1116 +mergeFromProject.eclipse.classpath.file.whenMerged { classpath -> + classpath.entries.removeAll { entry -> entry.path.contains("/${mergeIntoProject.name}/build/") } + def dependency = new ProjectDependency("/${mergeIntoProject.name}", mergeIntoProject.path) + dependency.exported = true + classpath.entries.add(dependency) +} + +// Update mergeIntoProject to contain additional configurations that contains all the dependencies from mergeFromProject +// so that Maven pom generation works +gradle.taskGraph.whenReady { + mergeFromProject.configurations.archives.artifacts.clear() + + mergeFromProject.configurations.each { config-> + def mapping = mergeFromProject.conf2ScopeMappings.getMapping([config]) + if(mapping.scope) { + def newConfigName = mergeFromProject.name + "-"+ config.name + mergeIntoProject.configurations.add(newConfigName) + config.dependencies.each { dependency -> + mergeIntoProject.dependencies.add(newConfigName, dependency) + } + configure(mergeIntoProject.install.repositories.mavenInstaller.pom.scopeMappings) { + addMapping(mapping.priority + 100, mergeIntoProject.configurations."$newConfigName", mapping.scope) + } + mergeIntoProject.optionalDeps += mergeFromProject.optionalDeps + mergeIntoProject.providedDeps += mergeFromProject.providedDeps + } + } +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
settings.gradle
@@ -15,6 +15,7 @@ include 'spring-orm' include 'spring-oxm' include 'spring-struts' include 'spring-test' +include 'spring-test-mvc' include 'spring-tx' include 'spring-web' include 'spring-webmvc'
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/AssertionErrors.java
@@ -0,0 +1,79 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock; + +/** + * JUnit independent assertion class. + * + * @author Lukas Krecan + * @author Arjen Poutsma + * @since 3.2 + */ +public abstract class AssertionErrors { + + private AssertionErrors() { + } + + /** + * Fails a test with the given message. + * + * @param message the message + */ + public static void fail(String message) { + throw new AssertionError(message); + } + + /** + * Fails a test with the given message passing along expected and actual values to be added to the message. + * + * @param message the message + * @param expected the expected value + * @param actual the actual value + */ + public static void fail(String message, Object expected, Object actual) { + throw new AssertionError(message + " expected:<" + expected + "> but was:<" + actual + ">"); + } + + /** + * Asserts that a condition is {@code true}. If not, throws an {@link AssertionError} with the given message. + * + * @param message the message + * @param condition the condition to test for + */ + public static void assertTrue(String message, boolean condition) { + if (!condition) { + fail(message); + } + } + + /** + * Asserts that two objects are equal. If not, an {@link AssertionError} is thrown with the given message. + * + * @param message the message + * @param expected the expected value + * @param actual the actual value + */ + public static void assertEquals(String message, Object expected, Object actual) { + if (expected == null && actual == null) { + return; + } + if (expected != null && expected.equals(actual)) { + return; + } + fail(message, expected, actual); + } + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/MockRestServiceServer.java
@@ -0,0 +1,207 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client; + +import java.io.IOException; +import java.net.URI; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.springframework.http.HttpMethod; +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.test.web.mock.client.match.RequestMatchers; +import org.springframework.test.web.mock.client.response.ResponseCreators; +import org.springframework.util.Assert; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.client.support.RestGatewaySupport; + +/** + * <strong>Main entry point for client-side REST testing</strong>. Used for tests + * that involve direct or indirect (through client code) use of the + * {@link RestTemplate}. Provides a way to set up fine-grained expectations + * on the requests that will be performed through the {@code RestTemplate} and + * a way to define the responses to send back removing the need for an + * actual running server. + * + * <p>Below is an example: + * <pre> + * RestTemplate restTemplate = new RestTemplate() + * MockRestServiceServer mockServer = MockRestServiceServer.createServer(restTemplate); + * + * mockServer.expect(requestTo("/hotels/42")).andExpect(method(HttpMethod.GET)) + * .andRespond(withSuccess("{ \"id\" : \"42\", \"name\" : \"Holiday Inn\"}", MediaType.APPLICATION_JSON)); + * + * Hotel hotel = restTemplate.getForObject("/hotels/{id}", Hotel.class, 42); + * &#47;&#47; Use the hotel instance... + * + * mockServer.verify(); + * + * <p>To create an instance of this class, use {@link #createServer(RestTemplate)} + * and provide the {@code RestTemplate} to set up for the mock testing. + * + * <p>After that use {@link #expect(RequestMatcher)} and fluent API methods + * {@link ResponseActions#andExpect(RequestMatcher) andExpect(RequestMatcher)} and + * {@link ResponseActions#andRespond(ResponseCreator) andRespond(ResponseCreator)} + * to set up request expectations and responses, most likely relying on the default + * {@code RequestMatcher} implementations provided in {@link RequestMatchers} + * and the {@code ResponseCreator} implementations provided in + * {@link ResponseCreators} both of which can be statically imported. + * + * <p>At the end of the test use {@link #verify()} to ensure all expected + * requests were actually performed. + * + * <p>Note that because of the fluent API offered by this class (and related + * classes), you can typically use the Code Completion features (i.e. + * ctrl-space) in your IDE to set up the mocks. + * + * <p><strong>Credits:</strong> The client-side REST testing support was + * inspired by and initially based on similar code in the Spring WS project for + * client-side tests involving the {@code WebServiceTemplate}. + * + * @author Craig Walls + * @author Rossen Stoyanchev + * @since 3.2 + */ +public class MockRestServiceServer { + + private final List<RequestMatcherClientHttpRequest> expectedRequests = + new LinkedList<RequestMatcherClientHttpRequest>(); + + private final List<RequestMatcherClientHttpRequest> actualRequests = + new LinkedList<RequestMatcherClientHttpRequest>(); + + + /** + * Private constructor. + * @see #createServer(RestTemplate) + * @see #createServer(RestGatewaySupport) + */ + private MockRestServiceServer() { + } + + /** + * Create a {@code MockRestServiceServer} and set up the given + * {@code RestTemplate} with a mock {@link ClientHttpRequestFactory}. + * + * @param restTemplate the RestTemplate to set up for mock testing + * @return the created mock server + */ + public static MockRestServiceServer createServer(RestTemplate restTemplate) { + Assert.notNull(restTemplate, "'restTemplate' must not be null"); + + MockRestServiceServer mockServer = new MockRestServiceServer(); + RequestMatcherClientHttpRequestFactory factory = mockServer.new RequestMatcherClientHttpRequestFactory(); + + restTemplate.setRequestFactory(factory); + + return mockServer; + } + + /** + * Create a {@code MockRestServiceServer} and set up the given + * {@code RestGatewaySupport} with a mock {@link ClientHttpRequestFactory}. + * + * @param restGateway the REST gateway to set up for mock testing + * @return the created mock server + */ + public static MockRestServiceServer createServer(RestGatewaySupport restGateway) { + Assert.notNull(restGateway, "'gatewaySupport' must not be null"); + return createServer(restGateway.getRestTemplate()); + } + + /** + * Set up a new HTTP request expectation. The returned {@link ResponseActions} + * is used to set up further expectations and to define the response. + * + * <p>This method may be invoked multiple times before starting the test, i.e. + * before using the {@code RestTemplate}, to set up expectations for multiple + * requests. + * + * @param requestMatcher a request expectation, see {@link RequestMatchers} + * @return used to set up further expectations or to define a response + */ + public ResponseActions expect(RequestMatcher requestMatcher) { + Assert.state(this.actualRequests.isEmpty(), "Can't add more expected requests with test already underway"); + RequestMatcherClientHttpRequest request = new RequestMatcherClientHttpRequest(requestMatcher); + this.expectedRequests.add(request); + return request; + } + + /** + * Verify that all expected requests set up via + * {@link #expect(RequestMatcher)} were indeed performed. + * + * @throws AssertionError when some expectations were not met + */ + public void verify() { + if (this.expectedRequests.isEmpty() || this.expectedRequests.equals(this.actualRequests)) { + return; + } + throw new AssertionError(getVerifyMessage()); + } + + private String getVerifyMessage() { + StringBuilder sb = new StringBuilder("Further request(s) expected\n"); + + if (this.actualRequests.size() > 0) { + sb.append("The following "); + } + sb.append(this.actualRequests.size()).append(" out of "); + sb.append(this.expectedRequests.size()).append(" were executed"); + + if (this.actualRequests.size() > 0) { + sb.append(":\n"); + for (RequestMatcherClientHttpRequest request : this.actualRequests) { + sb.append(request.toString()).append("\n"); + } + } + + return sb.toString(); + } + + + /** + * Mock ClientHttpRequestFactory that creates requests by iterating + * over the list of expected {@link RequestMatcherClientHttpRequest}'s. + */ + private class RequestMatcherClientHttpRequestFactory implements ClientHttpRequestFactory { + + private Iterator<RequestMatcherClientHttpRequest> requestIterator; + + public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException { + Assert.notNull(uri, "'uri' must not be null"); + Assert.notNull(httpMethod, "'httpMethod' must not be null"); + + if (this.requestIterator == null) { + this.requestIterator = MockRestServiceServer.this.expectedRequests.iterator(); + } + if (!this.requestIterator.hasNext()) { + throw new AssertionError("No further requests expected"); + } + + RequestMatcherClientHttpRequest request = this.requestIterator.next(); + request.setURI(uri); + request.setMethod(httpMethod); + + MockRestServiceServer.this.actualRequests.add(request); + + return request; + } + } + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/RequestMatcher.java
@@ -0,0 +1,39 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client; + +import java.io.IOException; + +import org.springframework.http.client.ClientHttpRequest; + +/** + * A contract for matching requests to expectations. + * + * @author Craig Walls + * @since 3.2 + */ +public interface RequestMatcher { + + /** + * Match the given request against some expectations. + * + * @param request the request to make assertions on + * @throws IOException in case of I/O errors + * @throws AssertionError if expectations are not met + */ + void match(ClientHttpRequest request) throws IOException, AssertionError; + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/RequestMatcherClientHttpRequest.java
@@ -0,0 +1,79 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; + +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.mock.http.client.MockClientHttpRequest; +import org.springframework.util.Assert; + +/** + * A specialization of {@code MockClientHttpRequest} that matches the request + * against a set of expectations, via {@link RequestMatcher} instances. The + * expectations are checked when the request is executed. This class also uses a + * {@link ResponseCreator} to create the response. + * + * @author Craig Walls + * @author Rossen Stoyanchev + * @since 3.2 + */ +class RequestMatcherClientHttpRequest extends MockClientHttpRequest implements ResponseActions { + + private final List<RequestMatcher> requestMatchers = new LinkedList<RequestMatcher>(); + + private ResponseCreator responseCreator; + + + public RequestMatcherClientHttpRequest(RequestMatcher requestMatcher) { + Assert.notNull(requestMatcher, "RequestMatcher is required"); + this.requestMatchers.add(requestMatcher); + } + + public ResponseActions andExpect(RequestMatcher requestMatcher) { + Assert.notNull(requestMatcher, "RequestMatcher is required"); + this.requestMatchers.add(requestMatcher); + return this; + } + + public void andRespond(ResponseCreator responseCreator) { + Assert.notNull(responseCreator, "ResponseCreator is required"); + this.responseCreator = responseCreator; + } + + public ClientHttpResponse execute() throws IOException { + + if (this.requestMatchers.isEmpty()) { + throw new AssertionError("No request expectations to execute"); + } + + if (this.responseCreator == null) { + throw new AssertionError("No ResponseCreator was set up. Add it after request expectations, " + + "e.g. MockRestServiceServer.expect(requestTo(\"/foo\")).andRespond(withSuccess())"); + } + + for (RequestMatcher requestMatcher : this.requestMatchers) { + requestMatcher.match(this); + } + + setResponse(this.responseCreator.createResponse(this)); + + return super.execute(); + } + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/ResponseActions.java
@@ -0,0 +1,39 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client; + +/** + * A contract for setting up request expectations and defining a response. + * Implementations can be obtained through {@link MockRestServiceServer#expect(RequestMatcher)}. + * + * @author Craig Walls + * @since 3.2 + */ +public interface ResponseActions { + + /** + * Add a request expectation. + * @return the expectation + */ + ResponseActions andExpect(RequestMatcher requestMatcher); + + /** + * Define the response. + * @param responseCreator the creator of the response + */ + void andRespond(ResponseCreator responseCreator); + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/ResponseCreator.java
@@ -0,0 +1,39 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client; + +import java.io.IOException; + +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.test.web.mock.client.response.ResponseCreators; + +/** + * A contract for creating a {@link ClientHttpResponse}. + * Implementations can be obtained via {@link ResponseCreators}. + * + * @author Craig Walls + * @since 3.2 + */ +public interface ResponseCreator { + + /** + * Create a response for the given request. + * @param request the request + */ + ClientHttpResponse createResponse(ClientHttpRequest request) throws IOException; + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/match/ContentRequestMatchers.java
@@ -0,0 +1,170 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client.match; + +import static org.springframework.test.web.mock.AssertionErrors.assertEquals; +import static org.springframework.test.web.mock.AssertionErrors.assertTrue; + +import java.io.IOException; + +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMSource; + +import org.hamcrest.Matcher; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; +import org.springframework.http.MediaType; +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.mock.http.client.MockClientHttpRequest; +import org.springframework.test.web.mock.client.RequestMatcher; +import org.springframework.test.web.mock.support.XmlExpectationsHelper; +import org.w3c.dom.Node; + +/** + * Factory for request content {@code RequestMatcher}'s. An instance of this + * class is typically accessed via {@link RequestMatchers#content()}. + * + * @author Rossen Stoyanchev + * @since 3.2 + */ +public class ContentRequestMatchers { + + private final XmlExpectationsHelper xmlHelper; + + + /** + * Class constructor, not for direct instantiation. + * Use {@link RequestMatchers#content()}. + */ + protected ContentRequestMatchers() { + this.xmlHelper = new XmlExpectationsHelper(); + } + + /** + * Assert the request content type as a String. + */ + public RequestMatcher mimeType(String expectedContentType) { + return mimeType(MediaType.parseMediaType(expectedContentType)); + } + + /** + * Assert the request content type as a {@link MediaType}. + */ + public RequestMatcher mimeType(final MediaType expectedContentType) { + return new RequestMatcher() { + public void match(ClientHttpRequest request) throws IOException, AssertionError { + MediaType actualContentType = request.getHeaders().getContentType(); + assertTrue("Content type not set", actualContentType != null); + assertEquals("Content type", expectedContentType, actualContentType); + } + }; + } + + /** + * Get the body of the request as a UTF-8 string and appply the given {@link Matcher}. + */ + public RequestMatcher string(final Matcher<? super String> matcher) { + return new RequestMatcher() { + public void match(ClientHttpRequest request) throws IOException, AssertionError { + MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; + MatcherAssert.assertThat("Request content", mockRequest.getBodyAsString(), matcher); + } + }; + } + + /** + * Get the body of the request as a UTF-8 string and compare it to the given String. + */ + public RequestMatcher string(String expectedContent) { + return string(Matchers.equalTo(expectedContent)); + } + + /** + * Compare the body of the request to the given byte array. + */ + public RequestMatcher bytes(final byte[] expectedContent) { + return new RequestMatcher() { + public void match(ClientHttpRequest request) throws IOException, AssertionError { + MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; + byte[] content = mockRequest.getBodyAsBytes(); + MatcherAssert.assertThat("Request content", content, Matchers.equalTo(expectedContent)); + } + }; + } + + /** + * Parse the request body and the given String as XML and assert that the + * two are "similar" - i.e. they contain the same elements and attributes + * regardless of order. + * + * <p>Use of this matcher assumes the + * <a href="http://xmlunit.sourceforge.net/">XMLUnit<a/> library is available. + * + * @param expectedXmlContent the expected XML content + */ + public RequestMatcher xml(final String expectedXmlContent) { + return new AbstractXmlRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws Exception { + xmlHelper.assertXmlEqual(expectedXmlContent, request.getBodyAsString()); + } + }; + } + + /** + * Parse the request content as {@link Node} and apply the given {@link Matcher}. + */ + public RequestMatcher node(final Matcher<? super Node> matcher) { + return new AbstractXmlRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws Exception { + xmlHelper.assertNode(request.getBodyAsString(), matcher); + } + }; + } + + /** + * Parse the request content as {@link DOMSource} and apply the given {@link Matcher}. + * @see <a href="http://code.google.com/p/xml-matchers/">http://code.google.com/p/xml-matchers/</a> + */ + public RequestMatcher source(final Matcher<? super Source> matcher) { + return new AbstractXmlRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws Exception { + xmlHelper.assertSource(request.getBodyAsString(), matcher); + } + }; + } + + /** + * Abstract base class for XML {@link RequestMatcher}'s. + */ + private abstract static class AbstractXmlRequestMatcher implements RequestMatcher { + + public final void match(ClientHttpRequest request) throws IOException, AssertionError { + try { + MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; + matchInternal(mockRequest); + } + catch (Exception e) { + throw new AssertionError("Failed to parse expected or actual XML request content: " + e.getMessage()); + } + } + + protected abstract void matchInternal(MockClientHttpRequest request) throws Exception; + + } +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/match/JsonPathRequestMatchers.java
@@ -0,0 +1,128 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client.match; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.instanceOf; + +import java.io.IOException; +import java.text.ParseException; +import java.util.List; + +import org.hamcrest.Matcher; +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.mock.http.client.MockClientHttpRequest; +import org.springframework.test.web.mock.client.RequestMatcher; +import org.springframework.test.web.mock.support.JsonPathExpectationsHelper; + +/** + * Factory methods for request content {@code RequestMatcher}'s using a <a + * href="http://goessner.net/articles/JsonPath/">JSONPath</a> expression. + * An instance of this class is typically accessed via + * {@code RequestMatchers.jsonPath(..)}. + * + * @author Rossen Stoyanchev + * @since 3.2 + */ +public class JsonPathRequestMatchers { + + private JsonPathExpectationsHelper jsonPathHelper; + + + /** + * Class constructor, not for direct instantiation. Use + * {@link RequestMatchers#jsonPath(String, Matcher)} or + * {@link RequestMatchers#jsonPath(String, Object...)}. + * + * @param expression the JSONPath expression + * @param args arguments to parameterize the JSONPath expression with using + * the formatting specifiers defined in + * {@link String#format(String, Object...)} + */ + protected JsonPathRequestMatchers(String expression, Object ... args) { + this.jsonPathHelper = new JsonPathExpectationsHelper(expression, args); + } + + /** + * Evaluate the JSONPath and assert the resulting value with the given {@code Matcher}. + */ + public <T> RequestMatcher value(final Matcher<T> matcher) { + return new AbstractJsonPathRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws IOException, ParseException { + jsonPathHelper.assertValue(request.getBodyAsString(), matcher); + } + }; + } + + /** + * Apply the JSONPath and assert the resulting value. + */ + public RequestMatcher value(Object expectedValue) { + return value(equalTo(expectedValue)); + } + + /** + * Apply the JSONPath and assert the resulting value. + */ + public RequestMatcher exists() { + return new AbstractJsonPathRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws IOException, ParseException { + jsonPathHelper.exists(request.getBodyAsString()); + } + }; + } + + /** + * Evaluate the JSON path and assert the resulting content exists. + */ + public RequestMatcher doesNotExist() { + return new AbstractJsonPathRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws IOException, ParseException { + jsonPathHelper.doesNotExist(request.getBodyAsString()); + } + }; + } + + /** + * Assert the content at the given JSONPath is an array. + */ + public RequestMatcher isArray() { + return value(instanceOf(List.class)); + } + + + /** + * Abstract base class for JSONPath {@link RequestMatcher}'s. + */ + private abstract static class AbstractJsonPathRequestMatcher implements RequestMatcher { + + public final void match(ClientHttpRequest request) throws IOException, AssertionError { + try { + MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; + matchInternal(mockRequest); + } + catch (ParseException e) { + throw new AssertionError("Failed to parse JSON request content: " + e.getMessage()); + } + } + + protected abstract void matchInternal(MockClientHttpRequest request) throws IOException, ParseException; + + } +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/match/RequestMatchers.java
@@ -0,0 +1,263 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client.match; + +import java.io.IOException; +import java.net.URI; +import java.util.List; +import java.util.Map; + +import javax.xml.xpath.XPathExpressionException; + +import org.hamcrest.Matcher; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; +import org.hamcrest.core.IsEqual; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.mock.http.client.MockClientHttpRequest; +import org.springframework.test.web.mock.AssertionErrors; +import org.springframework.test.web.mock.client.MockRestServiceServer; +import org.springframework.test.web.mock.client.RequestMatcher; +import org.springframework.util.Assert; + +/** + * Static, factory methods for {@link RequestMatcher} classes. Typically used to + * provide input for {@link MockRestServiceServer#expect(RequestMatcher)}. + * + * <p><strong>Eclipse users:</strong> consider adding this class as a Java editor + * favorite. To navigate, open the Preferences and type "favorites". + * + * @author Craig Walls + * @author Rossen Stoyanchev + * @since 3.2 + */ +public abstract class RequestMatchers { + + + /** + * Private class constructor. + */ + private RequestMatchers() { + } + + /** + * Match to any request. + */ + public static RequestMatcher anything() { + return new RequestMatcher() { + public void match(ClientHttpRequest request) throws AssertionError { + } + }; + } + + /** + * Assert the request URI string with the given matcher. + * + * @param matcher String matcher for the expected URI + * @return the request matcher + */ + public static RequestMatcher requestTo(final Matcher<String> matcher) { + Assert.notNull(matcher, "'matcher' must not be null"); + return new RequestMatcher() { + public void match(ClientHttpRequest request) throws IOException, AssertionError { + MatcherAssert.assertThat("Request URI", request.getURI().toString(), matcher); + } + }; + } + + /** + * Assert the request URI string. + * + * @param uri the expected URI + * @return the request matcher + */ + public static RequestMatcher requestTo(String uri) { + Assert.notNull(uri, "'uri' must not be null"); + return requestTo(Matchers.equalTo(uri)); + } + + /** + * Assert the {@link HttpMethod} of the request. + * + * @param method the HTTP method + * @return the request matcher + */ + public static RequestMatcher method(final HttpMethod method) { + Assert.notNull(method, "'method' must not be null"); + return new RequestMatcher() { + public void match(ClientHttpRequest request) throws AssertionError { + AssertionErrors.assertEquals("Unexpected HttpMethod", method, request.getMethod()); + } + }; + } + + /** + * Expect a request to the given URI. + * + * @param uri the expected URI + * @return the request matcher + */ + public static RequestMatcher requestTo(final URI uri) { + Assert.notNull(uri, "'uri' must not be null"); + return new RequestMatcher() { + public void match(ClientHttpRequest request) throws IOException, AssertionError { + AssertionErrors.assertEquals("Unexpected request", uri, request.getURI()); + } + }; + } + + /** + * Assert request header values with the given Hamcrest matcher. + */ + public static RequestMatcher header(final String name, final Matcher<? super String>... matchers) { + return new RequestMatcher() { + public void match(ClientHttpRequest request) { + HttpHeaders headers = request.getHeaders(); + List<String> values = headers.get(name); + AssertionErrors.assertTrue("Expected header <" + name + ">", values != null); + AssertionErrors.assertTrue("Expected header <" + name + "> to have at least <" + matchers.length + + "> values but it has only <" + values.size() + ">", matchers.length <= values.size()); + for (int i = 0 ; i < matchers.length; i++) { + MatcherAssert.assertThat("Request header", headers.get(name).get(i), matchers[i]); + } + } + }; + } + + /** + * Assert request header values. + */ + public static RequestMatcher header(String name, String... values) { + @SuppressWarnings("unchecked") + Matcher<? super String>[] matchers = new IsEqual[values.length]; + for (int i = 0; i < values.length; i++) { + matchers[i] = Matchers.equalTo(values[i]); + } + return header(name, matchers); + } + + /** + * Access to request body matchers. + */ + public static ContentRequestMatchers content() { + return new ContentRequestMatchers(); + } + + /** + * Access to request body matchers using a <a + * href="http://goessner.net/articles/JsonPath/">JSONPath</a> expression to + * inspect a specific subset of the body. The JSON path expression can be a + * parameterized string using formatting specifiers as defined in + * {@link String#format(String, Object...)}. + * + * @param expression the JSON path optionally parameterized with arguments + * @param args arguments to parameterize the JSON path expression with + */ + public static JsonPathRequestMatchers jsonPath(String expression, Object ... args) { + return new JsonPathRequestMatchers(expression, args); + } + + /** + * Access to request body matchers using a <a + * href="http://goessner.net/articles/JsonPath/">JSONPath</a> expression to + * inspect a specific subset of the body and a Hamcrest match for asserting + * the value found at the JSON path. + * + * @param expression the JSON path expression + * @param matcher a matcher for the value expected at the JSON path + */ + public static <T> RequestMatcher jsonPath(String expression, Matcher<T> matcher) { + return new JsonPathRequestMatchers(expression).value(matcher); + } + + /** + * Access to request body matchers using an XPath to inspect a specific + * subset of the body. The XPath expression can be a parameterized string + * using formatting specifiers as defined in + * {@link String#format(String, Object...)}. + * + * @param expression the XPath optionally parameterized with arguments + * @param args arguments to parameterize the XPath expression with + */ + public static XpathRequestMatchers xpath(String expression, Object... args) throws XPathExpressionException { + return new XpathRequestMatchers(expression, null, args); + } + + /** + * Access to response body matchers using an XPath to inspect a specific + * subset of the body. The XPath expression can be a parameterized string + * using formatting specifiers as defined in + * {@link String#format(String, Object...)}. + * + * @param expression the XPath optionally parameterized with arguments + * @param namespaces namespaces referenced in the XPath expression + * @param args arguments to parameterize the XPath expression with + */ + public static XpathRequestMatchers xpath(String expression, Map<String, String> namespaces, Object... args) + throws XPathExpressionException { + + return new XpathRequestMatchers(expression, namespaces, args); + } + + + // Deprecated methods .. + + /** + * Expect that the specified request header contains a subtring + * + * @deprecated in favor of {@link #header(String, Matcher...)} + */ + public static RequestMatcher headerContains(final String header, final String substring) { + Assert.notNull(header, "'header' must not be null"); + Assert.notNull(substring, "'substring' must not be null"); + return new RequestMatcher() { + public void match(ClientHttpRequest request) throws AssertionError { + List<String> actualHeaders = request.getHeaders().get(header); + AssertionErrors.assertTrue("Expected header <" + header + "> in request", actualHeaders != null); + + boolean foundMatch = false; + for (String headerValue : actualHeaders) { + if (headerValue.contains(substring)) { + foundMatch = true; + break; + } + } + + AssertionErrors.assertTrue("Expected value containing <" + substring + "> in header <" + header + ">", + foundMatch); + } + }; + } + + /** + * Expect the given request body content. + * + * @deprecated in favor of {@link #content()} as well as {@code jsonPath(..)}, + * and {@code xpath(..)} methods in this class + */ + public static RequestMatcher body(final String body) { + Assert.notNull(body, "'body' must not be null"); + return new RequestMatcher() { + public void match(ClientHttpRequest request) throws AssertionError, IOException { + MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; + AssertionErrors.assertEquals("Unexpected body content", body, mockRequest.getBodyAsString()); + } + }; + } + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/match/XpathRequestMatchers.java
@@ -0,0 +1,178 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client.match; + +import java.io.IOException; +import java.util.Map; + +import javax.xml.xpath.XPathExpressionException; + +import org.hamcrest.Matcher; +import org.hamcrest.Matchers; +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.mock.http.client.MockClientHttpRequest; +import org.springframework.test.web.mock.client.RequestMatcher; +import org.springframework.test.web.mock.support.XpathExpectationsHelper; +import org.w3c.dom.Node; + +/** + * Factory methods for request content {@code RequestMatcher}'s using an XPath + * expression. An instance of this class is typically accessed via + * {@code RequestMatchers.xpath(..)}. + * + * @author Rossen Stoyanchev + * @since 3.2 + */ +public class XpathRequestMatchers { + + private final XpathExpectationsHelper xpathHelper; + + + /** + * Class constructor, not for direct instantiation. Use + * {@link RequestMatchers#xpath(String, Object...)} or + * {@link RequestMatchers#xpath(String, Map, Object...)}. + * + * @param expression the XPath expression + * @param namespaces XML namespaces referenced in the XPath expression, or {@code null} + * @param args arguments to parameterize the XPath expression with using the + * formatting specifiers defined in {@link String#format(String, Object...)} + * + * @throws XPathExpressionException + */ + protected XpathRequestMatchers(String expression, Map<String, String> namespaces, Object ... args) + throws XPathExpressionException { + + this.xpathHelper = new XpathExpectationsHelper(expression, namespaces, args); + } + + /** + * Apply the XPath and assert it with the given {@code Matcher<Node>}. + */ + public <T> RequestMatcher node(final Matcher<? super Node> matcher) { + return new AbstractXpathRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws Exception { + xpathHelper.assertNode(request.getBodyAsString(), matcher); + } + }; + } + + /** + * Assert that content exists at the given XPath. + */ + public <T> RequestMatcher exists() { + return node(Matchers.notNullValue()); + } + + /** + * Assert that content does not exist at the given XPath. + */ + public <T> RequestMatcher doesNotExist() { + return node(Matchers.nullValue()); + } + + /** + * Apply the XPath and assert the number of nodes found with the given + * {@code Matcher<Integer>}. + */ + public <T> RequestMatcher nodeCount(final Matcher<Integer> matcher) { + return new AbstractXpathRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws Exception { + xpathHelper.assertNodeCount(request.getBodyAsString(), matcher); + } + }; + } + + /** + * Apply the XPath and assert the number of nodes found. + */ + public <T> RequestMatcher nodeCount(int expectedCount) { + return nodeCount(Matchers.equalTo(expectedCount)); + } + + /** + * Apply the XPath and assert the String content found with the given matcher. + */ + public <T> RequestMatcher string(final Matcher<? super String> matcher) { + return new AbstractXpathRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws Exception { + xpathHelper.assertString(request.getBodyAsString(), matcher); + } + }; + } + + /** + * Apply the XPath and assert the String content found. + */ + public RequestMatcher string(String value) { + return string(Matchers.equalTo(value)); + } + + /** + * Apply the XPath and assert the number found with the given matcher. + */ + public <T> RequestMatcher number(final Matcher<? super Double> matcher) { + return new AbstractXpathRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws Exception { + xpathHelper.assertNumber(request.getBodyAsString(), matcher); + } + }; + } + + /** + * Apply the XPath and assert the number of nodes found. + */ + public RequestMatcher number(Double value) { + return number(Matchers.equalTo(value)); + } + + /** + * Apply the XPath and assert the boolean value found. + */ + public <T> RequestMatcher booleanValue(final Boolean value) { + return new AbstractXpathRequestMatcher() { + @Override + protected void matchInternal(MockClientHttpRequest request) throws Exception { + xpathHelper.assertBoolean(request.getBodyAsString(), value); + } + }; + } + + + /** + * Abstract base class for XPath {@link RequestMatcher}'s. + */ + private abstract static class AbstractXpathRequestMatcher implements RequestMatcher { + + public final void match(ClientHttpRequest request) throws IOException, AssertionError { + try { + MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; + matchInternal(mockRequest); + } + catch (Exception e) { + throw new AssertionError("Failed to parse XML request content: " + e.getMessage()); + } + } + + protected abstract void matchInternal(MockClientHttpRequest request) throws Exception; + + } + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/match/package-info.java
@@ -0,0 +1,23 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Contains built-in {@link org.springframework.test.web.mock.client.RequestMatcher} + * implementations. Use + * {@link org.springframework.test.web.mock.client.match.RequestMatchers} + * to gain access to instances of those implementations. + */ +package org.springframework.test.web.mock.client.match;
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/package-info.java
@@ -0,0 +1,21 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Contains client-side REST testing support. + * @see org.springframework.test.web.mock.client.MockRestServiceServer + */ +package org.springframework.test.web.mock.client;
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/response/DefaultResponseCreator.java
@@ -0,0 +1,132 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client.response; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import org.springframework.core.io.Resource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.mock.http.client.MockClientHttpResponse; +import org.springframework.test.web.mock.client.ResponseCreator; +import org.springframework.util.Assert; + +/** + * A {@code ResponseCreator} with builder-style methods for adding response details. + * + * @author Rossen Stoyanchev + * @since 3.2 + */ +public class DefaultResponseCreator implements ResponseCreator { + + private byte[] content; + + private Resource contentResource; + + private final HttpHeaders headers = new HttpHeaders(); + + private HttpStatus statusCode; + + + /** + * Protected constructor. + * Use static factory methods in {@link ResponseCreators}. + */ + protected DefaultResponseCreator(HttpStatus statusCode) { + Assert.notNull(statusCode); + this.statusCode = statusCode; + } + + public ClientHttpResponse createResponse(ClientHttpRequest request) throws IOException { + MockClientHttpResponse response; + if (this.contentResource != null ){ + InputStream stream = this.contentResource.getInputStream(); + response = new MockClientHttpResponse(stream, this.statusCode); + } + else { + response = new MockClientHttpResponse(this.content, this.statusCode); + } + response.getHeaders().putAll(this.headers); + return response; + } + + /** + * Set the body as a UTF-8 String. + */ + public DefaultResponseCreator body(String content) { + try { + this.content = content.getBytes("UTF-8"); + } + catch (UnsupportedEncodingException e) { + // should not happen, UTF-8 is always supported + throw new IllegalStateException(e); + } + return this; + } + + /** + * Set the body as a byte array. + */ + public DefaultResponseCreator body(byte[] content) { + this.content = content; + return this; + } + + /** + * Set the body as a {@link Resource}. + */ + public DefaultResponseCreator body(Resource resource) { + this.contentResource = resource; + return this; + } + + /** + * Set the {@code Content-Type} header. + */ + public DefaultResponseCreator contentType(MediaType mediaType) { + if (mediaType != null) { + this.headers.setContentType(mediaType); + } + return this; + } + + /** + * Set the {@code Location} header. + */ + public DefaultResponseCreator location(URI location) { + this.headers.setLocation(location); + return this; + } + + /** + * Copy all given headers. + */ + public DefaultResponseCreator headers(HttpHeaders headers) { + for (String headerName : headers.keySet()) { + for (String headerValue : headers.get(headerName)) { + this.headers.add(headerName, headerValue); + } + } + return this; + } + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/response/ResponseCreators.java
@@ -0,0 +1,189 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.client.response; + +import java.io.IOException; +import java.net.URI; + +import org.springframework.core.io.Resource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.mock.http.client.MockClientHttpResponse; +import org.springframework.test.web.mock.client.ResponseCreator; + +/** + * Static factory methods for obtaining a {@link ResponseCreator} instance. + * + * <p><strong>Eclipse users:</strong> consider adding this class as a Java editor + * favorite. To navigate, open the Preferences and type "favorites". + * + * @author Rossen Stoyanchev + * @since 3.2 + */ +public abstract class ResponseCreators { + + + private ResponseCreators() { + } + + /** + * {@code ResponseCreator} for a 200 response (OK). + */ + public static DefaultResponseCreator withSuccess() { + return new DefaultResponseCreator(HttpStatus.OK); + } + + /** + * {@code ResponseCreator} for a 200 response (OK) with String body. + * @param body the response body, a "UTF-8" string + * @param mediaType the type of the content, may be {@code null} + */ + public static DefaultResponseCreator withSuccess(String body, MediaType mediaType) { + return new DefaultResponseCreator(HttpStatus.OK).body(body).contentType(mediaType); + } + + /** + * {@code ResponseCreator} for a 200 response (OK) with byte[] body. + * @param body the response body + * @param mediaType the type of the content, may be {@code null} + */ + public static DefaultResponseCreator withSuccess(byte[] body, MediaType contentType) { + return new DefaultResponseCreator(HttpStatus.OK).body(body).contentType(contentType); + } + + /** + * {@code ResponseCreator} for a 200 response (OK) content with {@link Resource}-based body. + * @param body the response body + * @param mediaType the type of the content, may be {@code null} + */ + public static DefaultResponseCreator withSuccess(Resource body, MediaType contentType) { + return new DefaultResponseCreator(HttpStatus.OK).body(body).contentType(contentType); + } + + /** + * {@code ResponseCreator} for a 201 response (CREATED) with a 'Location' header. + * @param location the value for the {@code Location} header + */ + public static DefaultResponseCreator withCreatedEntity(URI location) { + return new DefaultResponseCreator(HttpStatus.CREATED).location(location); + } + + /** + * {@code ResponseCreator} for a 204 response (NO_CONTENT). + */ + public static DefaultResponseCreator withNoContent() { + return new DefaultResponseCreator(HttpStatus.NO_CONTENT); + } + + /** + * {@code ResponseCreator} for a 400 response (BAD_REQUEST). + */ + public static DefaultResponseCreator withBadRequest() { + return new DefaultResponseCreator(HttpStatus.BAD_REQUEST); + } + + /** + * {@code ResponseCreator} for a 401 response (UNAUTHORIZED). + */ + public static DefaultResponseCreator withUnauthorizedRequest() { + return new DefaultResponseCreator(HttpStatus.UNAUTHORIZED); + } + + /** + * {@code ResponseCreator} for a 500 response (SERVER_ERROR). + */ + public static DefaultResponseCreator withServerError() { + return new DefaultResponseCreator(HttpStatus.INTERNAL_SERVER_ERROR); + } + + /** + * {@code ResponseCreator} with a specific HTTP status. + * @param status the response status + */ + public static DefaultResponseCreator withStatus(HttpStatus status) { + return new DefaultResponseCreator(status); + } + + /** + * Respond with a given body, headers, status code, and status text. + * + * @param body the body of the response "UTF-8" encoded + * @param headers the response headers + * @param statusCode the response status code + * @param statusText the response status text + * + * @deprecated in favor of methods returning DefaultResponseCreator + */ + public static ResponseCreator withResponse(final String body, final HttpHeaders headers, + final HttpStatus statusCode, final String statusText) { + + return new ResponseCreator() { + public MockClientHttpResponse createResponse(ClientHttpRequest request) throws IOException { + MockClientHttpResponse response = new MockClientHttpResponse(body.getBytes("UTF-8"), statusCode); + response.getHeaders().putAll(headers); + return response; + } + }; + } + + /** + * Respond with the given body, headers, and a status code of 200 (OK). + * + * @param body the body of the response "UTF-8" encoded + * @param headers the response headers + * + * @deprecated in favor of methods 'withXyz' in this class returning DefaultResponseCreator + */ + public static ResponseCreator withResponse(String body, HttpHeaders headers) { + return withResponse(body, headers, HttpStatus.OK, ""); + } + + /** + * Respond with a given body, headers, status code, and text. + * + * @param body a {@link Resource} containing the body of the response + * @param headers the response headers + * @param statusCode the response status code + * @param statusText the response status text + * + * @deprecated in favor of methods 'withXyz' in this class returning DefaultResponseCreator + */ + public static ResponseCreator withResponse(final Resource body, final HttpHeaders headers, + final HttpStatus statusCode, String statusText) { + + return new ResponseCreator() { + public MockClientHttpResponse createResponse(ClientHttpRequest request) throws IOException { + MockClientHttpResponse response = new MockClientHttpResponse(body.getInputStream(), statusCode); + response.getHeaders().putAll(headers); + return response; + } + }; + } + + /** + * Respond with the given body, headers, and a status code of 200 (OK). + * @param body the body of the response + * @param headers the response headers + * + * @deprecated in favor of methods 'withXyz' in this class returning DefaultResponseCreator + */ + public static ResponseCreator withResponse(final Resource body, final HttpHeaders headers) { + return withResponse(body, headers, HttpStatus.OK, ""); + } + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/response/package-info.java
@@ -0,0 +1,23 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Contains built-in {@link org.springframework.test.web.mock.client.ResponseCreator} + * implementations. Use + * {@link org.springframework.test.web.mock.client.response.ResponseCreators} + * to gain access to instances of those implementations. + */ +package org.springframework.test.web.mock.client.response;
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/DefaultMvcResult.java
@@ -0,0 +1,99 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.test.web.mock.servlet; + +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.web.servlet.FlashMap; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.support.RequestContextUtils; + +/** + * A simple implementation of {@link MvcResult} with setters. + * + * @author Rossen Stoyanchev + * @author Rob Winch + * @since 3.2 + */ +class DefaultMvcResult implements MvcResult { + + private final MockHttpServletRequest mockRequest; + + private final MockHttpServletResponse mockResponse; + + private Object handler; + + private HandlerInterceptor[] interceptors; + + private ModelAndView modelAndView; + + private Exception resolvedException; + + + /** + * Create a new instance with the given request and response. + */ + public DefaultMvcResult(MockHttpServletRequest request, MockHttpServletResponse response) { + this.mockRequest = request; + this.mockResponse = response; + } + + public MockHttpServletResponse getResponse() { + return mockResponse; + } + + public MockHttpServletRequest getRequest() { + return mockRequest; + } + + public Object getHandler() { + return this.handler; + } + + public void setHandler(Object handler) { + this.handler = handler; + } + + public HandlerInterceptor[] getInterceptors() { + return this.interceptors; + } + + public void setInterceptors(HandlerInterceptor[] interceptors) { + this.interceptors = interceptors; + } + + public Exception getResolvedException() { + return this.resolvedException; + } + + public void setResolvedException(Exception resolvedException) { + this.resolvedException = resolvedException; + } + + public ModelAndView getModelAndView() { + return this.modelAndView; + } + + public void setModelAndView(ModelAndView mav) { + this.modelAndView = mav; + } + + public FlashMap getFlashMap() { + return RequestContextUtils.getOutputFlashMap(mockRequest); + } + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/MockMvc.java
@@ -0,0 +1,167 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.test.web.mock.servlet; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.ServletContext; + +import org.springframework.beans.Mergeable; +import org.springframework.mock.web.MockFilterChain; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.util.Assert; + +/** + * <strong>Main entry point for server-side Spring MVC test support.</strong> + * + * <p>Below is an example: + * + * <pre> + * static imports: + * MockMvcBuilders.*, MockMvcRequestBuilders.*, MockMvcResultMatchers.* + * + * WebApplicationContext wac = ...; + * + * MockMvc mockMvc = webAppContextSetup(wac).configureWarRootDir("src/main/webapp", false).build() + * + * mockMvc.perform(get("/form")) + * .andExpect(status().isOk()) + * .andExpect(content().mimeType("text/html")) + * .andExpect(forwardedUrl("/WEB-INF/layouts/main.jsp")); + * </pre> + * + * @author Rossen Stoyanchev + * @author Rob Winch + * @since 3.2 + */ +public final class MockMvc { + + static String MVC_RESULT_ATTRIBUTE = MockMvc.class.getName().concat(".MVC_RESULT_ATTRIBUTE"); + + private final MockFilterChain filterChain; + + private final ServletContext servletContext; + + private RequestBuilder defaultRequestBuilder; + + private List<ResultMatcher> defaultResultMatchers = new ArrayList<ResultMatcher>(); + + private List<ResultHandler> defaultResultHandlers = new ArrayList<ResultHandler>(); + + + /** + * Private constructor, not for direct instantiation. + * @see org.springframework.test.web.mock.servlet.setup.MockMvcBuilders + */ + MockMvc(MockFilterChain filterChain, ServletContext servletContext) { + Assert.notNull(servletContext, "A ServletContext is required"); + Assert.notNull(filterChain, "A MockFilterChain is required"); + + this.filterChain = filterChain; + this.servletContext = servletContext; + } + + /** + * A default request builder merged into every performed request. + * @see org.springframework.test.web.mock.servlet.setup.DefaultMockMvcBuilder#defaultRequest(RequestBuilder) + */ + void setDefaultRequest(RequestBuilder requestBuilder) { + this.defaultRequestBuilder = requestBuilder; + } + + /** + * Expectations to assert after every performed request. + * @see org.springframework.test.web.mock.servlet.setup.DefaultMockMvcBuilder#alwaysExpect(ResultMatcher) + */ + void setGlobalResultMatchers(List<ResultMatcher> resultMatchers) { + Assert.notNull(resultMatchers, "resultMatchers is required"); + this.defaultResultMatchers = resultMatchers; + } + + /** + * General actions to apply after every performed request. + * @see org.springframework.test.web.mock.servlet.setup.DefaultMockMvcBuilder#alwaysDo(ResultHandler) + */ + void setGlobalResultHandlers(List<ResultHandler> resultHandlers) { + Assert.notNull(resultHandlers, "resultHandlers is required"); + this.defaultResultHandlers = resultHandlers; + } + + /** + * Perform a request and return a type that allows chaining further + * actions, such as asserting expectations, on the result. + * + * @param requestBuilder used to prepare the request to execute; + * see static factory methods in + * {@link org.springframework.test.web.mock.servlet.request.MockMvcRequestBuilders} + * + * @return an instance of {@link ResultActions}; never {@code null} + * + * @see org.springframework.test.web.mock.servlet.request.MockMvcRequestBuilders + * @see org.springframework.test.web.mock.servlet.result.MockMvcResultMatchers + */ + public ResultActions perform(RequestBuilder requestBuilder) throws Exception { + + if (this.defaultRequestBuilder != null) { + if (requestBuilder instanceof Mergeable) { + requestBuilder = (RequestBuilder) ((Mergeable) requestBuilder).merge(this.defaultRequestBuilder); + } + } + + MockHttpServletRequest request = requestBuilder.buildRequest(this.servletContext); + MockHttpServletResponse response = new MockHttpServletResponse(); + + final MvcResult mvcResult = new DefaultMvcResult(request, response); + request.setAttribute(MVC_RESULT_ATTRIBUTE, mvcResult); + + this.filterChain.reset(); + this.filterChain.doFilter(request, response); + + applyDefaultResultActions(mvcResult); + + return new ResultActions() { + + public ResultActions andExpect(ResultMatcher matcher) throws Exception { + matcher.match(mvcResult); + return this; + } + + public ResultActions andDo(ResultHandler printer) throws Exception { + printer.handle(mvcResult); + return this; + } + + public MvcResult andReturn() { + return mvcResult; + } + }; + } + + private void applyDefaultResultActions(MvcResult mvcResult) throws Exception { + + for (ResultMatcher matcher : this.defaultResultMatchers) { + matcher.match(mvcResult); + } + + for (ResultHandler handler : this.defaultResultHandlers) { + handler.handle(mvcResult); + } + } + +}
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/MockMvcBuilder.java
@@ -0,0 +1,35 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.test.web.mock.servlet; + +/** + * Builds a {@link MockMvc}. + * + * <p>See static, factory methods in + * {@code org.springframework.test.web.server.setup.MockMvcBuilders}. + * + * @author Rossen Stoyanchev + * @since 3.2 + */ +public interface MockMvcBuilder { + + /** + * Build a {@link MockMvc} instance. + */ + MockMvc build(); + +} \ No newline at end of file
true
Other
spring-projects
spring-framework
22bcb54ab66c952d1c122526729b64d77a77280b.json
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/MockMvcBuilderSupport.java
@@ -0,0 +1,77 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.test.web.mock.servlet; + +import java.util.List; + +import javax.servlet.Filter; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; + +import org.springframework.core.NestedRuntimeException; +import org.springframework.mock.web.MockFilterChain; +import org.springframework.mock.web.MockServletConfig; +import org.springframework.web.context.WebApplicationContext; + +/** + * Base class for MockMvc builder implementations, providing the capability to + * create a {@link MockMvc} instance. + * + * <p>{@link org.springframework.test.web.mock.servlet.setup.DefaultMockMvcBuilder}, + * which derives from this class, provides a concrete {@code build} method, + * and delegates to abstract methods to obtain a {@link WebApplicationContext}. + * + * @author Rossen Stoyanchev + * @author Rob Winch + * @since 3.2 + */ +public abstract class MockMvcBuilderSupport { + + protected final MockMvc createMockMvc(Filter[] filters, MockServletConfig servletConfig, + WebApplicationContext webAppContext, RequestBuilder defaultRequestBuilder, + List<ResultMatcher> globalResultMatchers, List<ResultHandler> globalResultHandlers) { + + ServletContext servletContext = webAppContext.getServletContext(); + + TestDispatcherServlet dispatcherServlet = new TestDispatcherServlet(webAppContext); + try { + dispatcherServlet.init(servletConfig); + } + catch (ServletException ex) { + // should never happen.. + throw new MockMvcBuildException("Failed to initialize TestDispatcherServlet", ex); + } + + MockFilterChain filterChain = new MockFilterChain(dispatcherServlet, filters); + + MockMvc mockMvc = new MockMvc(filterChain, servletContext); + mockMvc.setDefaultRequest(defaultRequestBuilder); + mockMvc.setGlobalResultMatchers(globalResultMatchers); + mockMvc.setGlobalResultHandlers(globalResultHandlers); + + return mockMvc; + } + + @SuppressWarnings("serial") + private static class MockMvcBuildException extends NestedRuntimeException { + + public MockMvcBuildException(String msg, Throwable cause) { + super(msg, cause); + } + } + +}
true