polishing .beans tests

This commit is contained in:
Chris Beams
2008-12-24 19:34:04 +00:00
parent 670bfd5ee2
commit 751daf95a1
83 changed files with 252 additions and 236 deletions

View File

@@ -1,40 +0,0 @@
/*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package common.beans.core;
/**
* Bean that changes state on a business invocation, so that
* we can check whether it's been invoked
* @author Rod Johnson
*/
public class SideEffectBean {
private int count;
public void setCount(int count) {
this.count = count;
}
public int getCount() {
return this.count;
}
public void doWork() {
++count;
}
}

View File

@@ -31,6 +31,8 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceEditor;
import test.beans.DerivedTestBean;
import test.beans.ITestBean;
import test.beans.TestBean;
/**
* Unit tests for {@link BeanUtils}.

View File

@@ -39,6 +39,9 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import test.beans.GenericBean;
import test.beans.GenericIntegerBean;
import test.beans.GenericSetOfIntegerBean;
import test.beans.TestBean;
/**
* @author Juergen Hoeller

View File

@@ -49,6 +49,10 @@ import org.springframework.util.StopWatch;
import org.springframework.util.StringUtils;
import test.beans.BooleanTestBean;
import test.beans.ITestBean;
import test.beans.IndexedTestBean;
import test.beans.NumberTestBean;
import test.beans.TestBean;
/**
* @author Rod Johnson

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* 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.
@@ -21,6 +21,8 @@ import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.core.OverridingClassLoader;
import test.beans.TestBean;
/**
* @author Juergen Hoeller
* @author Chris Beams
@@ -35,7 +37,7 @@ public final class CachedIntrospectionResultsTests {
assertTrue(CachedIntrospectionResults.classCache.containsKey(TestBean.class));
ClassLoader child = new OverridingClassLoader(getClass().getClassLoader());
Class<?> tbClass = child.loadClass("org.springframework.beans.TestBean");
Class<?> tbClass = child.loadClass("test.beans.TestBean");
assertFalse(CachedIntrospectionResults.classCache.containsKey(tbClass));
CachedIntrospectionResults.acceptClassLoader(child);
bw = new BeanWrapperImpl(tbClass);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2005 the original author or authors.
* 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 the original author or authors.
* 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.
@@ -39,7 +39,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
* @author Chris Beams
* @since 2.0
*/
public class RequiredAnnotationBeanPostProcessorTests {
public final class RequiredAnnotationBeanPostProcessorTests {
@Test
public void testWithRequiredPropertyOmitted() {

View File

@@ -24,9 +24,10 @@ import junit.framework.Assert;
import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyBatchUpdateException;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import test.beans.TestBean;
/**
* Subclasses must implement setUp() to initialize bean factory
* and any other variables they need.

View File

@@ -18,7 +18,7 @@ package org.springframework.beans.factory;
import junit.framework.Assert;
import org.springframework.beans.TestBean;
import test.beans.TestBean;
/**
* @author Rod Johnson

View File

@@ -26,15 +26,16 @@ import net.sf.cglib.proxy.NoOp;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.ITestBean;
import org.springframework.beans.IndexedTestBean;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.ObjectUtils;
import test.beans.ITestBean;
import test.beans.IndexedTestBean;
import test.beans.TestBean;
/**
* @author Rod Johnson
* @author Juergen Hoeller

View File

@@ -16,7 +16,7 @@
package org.springframework.beans.factory;
import org.springframework.beans.TestBean;
import test.beans.TestBean;
/**
* @author Juergen Hoeller

View File

@@ -39,14 +39,11 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.springframework.beans.BeansException;
import org.springframework.beans.ITestBean;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.NestedTestBean;
import org.springframework.beans.NotWritablePropertyException;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.beans.PropertyEditorRegistry;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.TestBean;
import org.springframework.beans.TypeConverter;
import org.springframework.beans.TypeMismatchException;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
@@ -73,8 +70,9 @@ import org.springframework.core.io.UrlResource;
import org.springframework.util.StopWatch;
import test.beans.DerivedTestBean;
import common.beans.core.SideEffectBean;
import test.beans.ITestBean;
import test.beans.NestedTestBean;
import test.beans.TestBean;
/**
* Tests properties population and autowire behavior.
@@ -452,7 +450,7 @@ public class DefaultListableBeanFactoryTests {
public void testPropertiesPopulationWithNullPrefix() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty("test.(class)", "org.springframework.beans.TestBean");
p.setProperty("test.(class)", TestBean.class.getName());
p.setProperty("test.name", "Tony");
p.setProperty("test.age", "48");
int count = (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
@@ -465,7 +463,7 @@ public class DefaultListableBeanFactoryTests {
String PREFIX = "beans.";
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty(PREFIX + "test.(class)", "org.springframework.beans.TestBean");
p.setProperty(PREFIX + "test.(class)", TestBean.class.getName());
p.setProperty(PREFIX + "test.name", "Tony");
p.setProperty(PREFIX + "test.age", "0x30");
int count = (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p, PREFIX);
@@ -479,10 +477,10 @@ public class DefaultListableBeanFactoryTests {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty(PREFIX + "rod.(class)", "org.springframework.beans.TestBean");
p.setProperty(PREFIX + "rod.(class)", TestBean.class.getName());
p.setProperty(PREFIX + "rod.name", "Rod");
p.setProperty(PREFIX + "kerry.(class)", "org.springframework.beans.TestBean");
p.setProperty(PREFIX + "kerry.(class)", TestBean.class.getName());
p.setProperty(PREFIX + "kerry.name", "Kerry");
p.setProperty(PREFIX + "kerry.age", "35");
p.setProperty(PREFIX + "kerry.spouse(ref)", "rod");
@@ -502,7 +500,7 @@ public class DefaultListableBeanFactoryTests {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty("tb.(class)", "org.springframework.beans.TestBean");
p.setProperty("tb.(class)", TestBean.class.getName());
p.setProperty("tb.someMap[my.key]", "my.value");
int count = (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
@@ -520,7 +518,7 @@ public class DefaultListableBeanFactoryTests {
Properties p = new Properties();
try {
p.setProperty(PREFIX + "kerry.(class)", "org.springframework.beans.TestBean");
p.setProperty(PREFIX + "kerry.(class)", TestBean.class.getName());
p.setProperty(PREFIX + "kerry.name", "Kerry");
p.setProperty(PREFIX + "kerry.age", "35");
p.setProperty(PREFIX + "kerry.spouse(ref)", "rod");
@@ -569,7 +567,7 @@ public class DefaultListableBeanFactoryTests {
public void testPrototype() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty("kerry.(class)", "org.springframework.beans.TestBean");
p.setProperty("kerry.(class)", TestBean.class.getName());
p.setProperty("kerry.age", "35");
(new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
TestBean kerry1 = (TestBean) lbf.getBean("kerry");
@@ -579,7 +577,7 @@ public class DefaultListableBeanFactoryTests {
lbf = new DefaultListableBeanFactory();
p = new Properties();
p.setProperty("kerry.(class)", "org.springframework.beans.TestBean");
p.setProperty("kerry.(class)", TestBean.class.getName());
p.setProperty("kerry.(scope)", "prototype");
p.setProperty("kerry.age", "35");
(new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
@@ -590,7 +588,7 @@ public class DefaultListableBeanFactoryTests {
lbf = new DefaultListableBeanFactory();
p = new Properties();
p.setProperty("kerry.(class)", "org.springframework.beans.TestBean");
p.setProperty("kerry.(class)", TestBean.class.getName());
p.setProperty("kerry.(scope)", "singleton");
p.setProperty("kerry.age", "35");
(new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
@@ -604,11 +602,11 @@ public class DefaultListableBeanFactoryTests {
public void testPrototypeCircleLeadsToException() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty("kerry.(class)", "org.springframework.beans.TestBean");
p.setProperty("kerry.(class)", TestBean.class.getName());
p.setProperty("kerry.(singleton)", "false");
p.setProperty("kerry.age", "35");
p.setProperty("kerry.spouse", "*rod");
p.setProperty("rod.(class)", "org.springframework.beans.TestBean");
p.setProperty("rod.(class)", TestBean.class.getName());
p.setProperty("rod.(singleton)", "false");
p.setProperty("rod.age", "34");
p.setProperty("rod.spouse", "*kerry");
@@ -628,7 +626,7 @@ public class DefaultListableBeanFactoryTests {
public void testPrototypeExtendsPrototype() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty("wife.(class)", "org.springframework.beans.TestBean");
p.setProperty("wife.(class)", TestBean.class.getName());
p.setProperty("wife.name", "kerry");
p.setProperty("kerry.(parent)", "wife");
@@ -642,7 +640,7 @@ public class DefaultListableBeanFactoryTests {
lbf = new DefaultListableBeanFactory();
p = new Properties();
p.setProperty("wife.(class)", "org.springframework.beans.TestBean");
p.setProperty("wife.(class)", TestBean.class.getName());
p.setProperty("wife.name", "kerry");
p.setProperty("wife.(singleton)", "false");
p.setProperty("kerry.(parent)", "wife");
@@ -657,7 +655,7 @@ public class DefaultListableBeanFactoryTests {
lbf = new DefaultListableBeanFactory();
p = new Properties();
p.setProperty("kerry.(class)", "org.springframework.beans.TestBean");
p.setProperty("kerry.(class)", TestBean.class.getName());
p.setProperty("kerry.(singleton)", "true");
p.setProperty("kerry.age", "35");
(new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
@@ -696,7 +694,7 @@ public class DefaultListableBeanFactoryTests {
public void testNameAlreadyBound() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty("kerry.(class)", "org.springframework.beans.TestBean");
p.setProperty("kerry.(class)", TestBean.class.getName());
p.setProperty("kerry.age", "35");
(new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
try {
@@ -883,7 +881,7 @@ public class DefaultListableBeanFactoryTests {
public void testRegisterExistingSingletonWithReference() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty("test.(class)", "org.springframework.beans.TestBean");
p.setProperty("test.(class)", TestBean.class.getName());
p.setProperty("test.name", "Tony");
p.setProperty("test.age", "48");
p.setProperty("test.spouse(ref)", "singletonObject");
@@ -910,11 +908,11 @@ public class DefaultListableBeanFactoryTests {
public void testRegisterExistingSingletonWithNameOverriding() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
Properties p = new Properties();
p.setProperty("test.(class)", "org.springframework.beans.TestBean");
p.setProperty("test.(class)", TestBean.class.getName());
p.setProperty("test.name", "Tony");
p.setProperty("test.age", "48");
p.setProperty("test.spouse(ref)", "singletonObject");
p.setProperty("singletonObject.(class)", "org.springframework.beans.factory.config.PropertiesFactoryBean");
p.setProperty("singletonObject.(class)", org.springframework.beans.factory.config.PropertiesFactoryBean.class.getName());
(new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
Object singletonObject = new TestBean();
lbf.registerSingleton("singletonObject", singletonObject);
@@ -2348,5 +2346,28 @@ public class DefaultListableBeanFactoryTests {
return this.userName;
}
}
/**
* Bean that changes state on a business invocation, so that
* we can check whether it's been invoked
* @author Rod Johnson
*/
private static class SideEffectBean {
private int count;
public void setCount(int count) {
this.count = count;
}
public int getCount() {
return this.count;
}
public void doWork() {
++count;
}
}
}

View File

@@ -17,9 +17,10 @@
package org.springframework.beans.factory;
import org.springframework.beans.BeansException;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import test.beans.TestBean;
/**
* Simple factory to allow testing of FactoryBean support in AbstractBeanFactory.
* Depending on whether its singleton property is set, it will return a singleton

View File

@@ -21,10 +21,10 @@ import java.util.Arrays;
import junit.framework.TestCase;
import org.springframework.beans.BeansException;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.support.DefaultSingletonBeanRegistry;
import test.beans.DerivedTestBean;
import test.beans.TestBean;
/**
* @author Juergen Hoeller

View File

@@ -26,10 +26,6 @@ import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.springframework.beans.ITestBean;
import org.springframework.beans.IndexedTestBean;
import org.springframework.beans.NestedTestBean;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.FactoryBean;
@@ -38,6 +34,11 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;
import test.beans.ITestBean;
import test.beans.IndexedTestBean;
import test.beans.NestedTestBean;
import test.beans.TestBean;
/**
* @author Juergen Hoeller
* @author Mark Fisher

View File

@@ -30,11 +30,12 @@ import org.springframework.beans.FatalBeanException;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.beans.PropertyEditorRegistry;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import test.beans.TestBean;
/**
* @author Juergen Hoeller
* @since 31.07.2004

View File

@@ -20,11 +20,12 @@ import java.sql.Connection;
import junit.framework.TestCase;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;
import test.beans.TestBean;
/**
* @author Juergen Hoeller
* @since 31.07.2004

View File

@@ -18,11 +18,12 @@ package org.springframework.beans.factory.config;
import junit.framework.TestCase;
import org.springframework.beans.ITestBean;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import test.beans.ITestBean;
import test.beans.TestBean;
/**
* @author Juergen Hoeller
* @since 04.10.2004

View File

@@ -28,9 +28,7 @@ import java.util.prefs.Preferences;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.IndexedTestBean;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
@@ -43,6 +41,9 @@ import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import test.beans.IndexedTestBean;
import test.beans.TestBean;
/**
* Unit tests for various {@link PropertyResourceConfigurer} implementations including:
* {@link PropertyPlaceholderConfigurer}, {@link PropertyOverrideConfigurer} and

View File

@@ -23,11 +23,12 @@ import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import test.beans.TestBean;
/**
* Simple test to illustrate and verify scope usage.
*

View File

@@ -5,6 +5,6 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<bean id="usesScope" class="org.springframework.beans.TestBean" scope="myScope"/>
<bean id="usesScope" class="test.beans.TestBean" scope="myScope"/>
</beans>

View File

@@ -3,7 +3,7 @@
<beans>
<bean id="test3" class="org.springframework.beans.TestBean" scope="prototype">
<bean id="test3" class="test.beans.TestBean" scope="prototype">
<property name="name"><value>custom</value></property>
<property name="age"><value>25</value></property>
</bean>

View File

@@ -4,7 +4,7 @@
<beans>
<!-- Simple target -->
<bean id="test" class="org.springframework.beans.TestBean">
<bean id="test" class="test.beans.TestBean">
<property name="name"><value>custom</value></property>
<property name="age"><value>666</value></property>
</bean>
@@ -13,7 +13,7 @@
Check that invoker is automatically added to wrap target.
Non pointcut bean name should be wrapped in invoker.
-->
<bean id="numberTestBean" class="org.springframework.beans.NumberTestBean"/>
<bean id="numberTestBean" class="test.beans.NumberTestBean"/>
</beans>

View File

@@ -21,11 +21,12 @@ import java.util.List;
import junit.framework.TestCase;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;
import test.beans.TestBean;
/**
* @author Rob Harrop
* @since 2.0

View File

@@ -6,12 +6,12 @@
<!--
Just included for the count: not to mean anything in particular
-->
<bean id="something" class="org.springframework.beans.GenericIntegerBean"/>
<bean id="something" class="test.beans.GenericIntegerBean"/>
<bean id="indexedBean" class="org.springframework.beans.IndexedTestBean"/>
<bean id="indexedBean" class="test.beans.IndexedTestBean"/>
<!-- Overridden by next factory -->
<bean id="test" class="org.springframework.beans.TestBean">
<bean id="test" class="test.beans.TestBean">
<property name="name"><value>custom</value></property>
<property name="age"><value>25</value></property>
</bean>

View File

@@ -20,7 +20,7 @@ import java.util.Arrays;
import junit.framework.TestCase;
import org.springframework.beans.TestBean;
import test.beans.TestBean;
/**
* @author Rod Johnson

View File

@@ -18,9 +18,10 @@ package org.springframework.beans.factory.support;
import junit.framework.TestCase;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import test.beans.TestBean;
/**
* @author Juergen Hoeller
*/

View File

@@ -31,8 +31,6 @@ import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.springframework.beans.GenericIntegerBean;
import org.springframework.beans.GenericSetOfIntegerBean;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.beans.PropertyEditorRegistry;
import org.springframework.beans.factory.xml.XmlBeanFactory;
@@ -41,6 +39,8 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.UrlResource;
import test.beans.GenericBean;
import test.beans.GenericIntegerBean;
import test.beans.GenericSetOfIntegerBean;
/**
* @author Juergen Hoeller

View File

@@ -18,10 +18,11 @@ package org.springframework.beans.factory.support;
import junit.framework.TestCase;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import test.beans.TestBean;
/**
* @author Rob Harrop
*/

View File

@@ -18,7 +18,8 @@ package org.springframework.beans.factory.support;
import junit.framework.TestCase;
import org.springframework.core.io.ClassPathResource;
import org.springframework.beans.TestBean;
import test.beans.TestBean;
/**
* @author Rob Harrop

View File

@@ -43,7 +43,7 @@
autowire="constructor">
</bean>
<bean id="integerBean" class="org.springframework.beans.GenericIntegerBean">
<bean id="integerBean" class="test.beans.GenericIntegerBean">
<property name="genericProperty" value="10"/>
<property name="genericListProperty">
<list>
@@ -53,7 +53,7 @@
</property>
</bean>
<bean id="setOfIntegerBean" class="org.springframework.beans.GenericSetOfIntegerBean">
<bean id="setOfIntegerBean" class="test.beans.GenericSetOfIntegerBean">
<property name="genericProperty" value="10"/>
<property name="genericListProperty">
<list>

View File

@@ -19,11 +19,12 @@ package org.springframework.beans.factory.wiring;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import test.beans.TestBean;
/**
* @author Rick Evans
* @author Juergen Hoeller

View File

@@ -19,7 +19,6 @@ package org.springframework.beans.factory.xml;
import junit.framework.TestCase;
import junit.framework.Assert;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.CountingFactory;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.beans.factory.config.RuntimeBeanReference;
@@ -28,6 +27,8 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.core.io.ClassPathResource;
import test.beans.TestBean;
/**
* @author Rob Harrop
* @author Juergen Hoeller

View File

@@ -24,11 +24,12 @@ import java.util.Set;
import junit.framework.TestCase;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.support.BeanDefinitionReader;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.core.io.ClassPathResource;
import test.beans.TestBean;
/**
* Unit and integration tests for the collection merging support.
*

View File

@@ -2,7 +2,8 @@ package org.springframework.beans.factory.xml;
import junit.framework.TestCase;
import org.springframework.core.io.ClassPathResource;
import org.springframework.beans.TestBean;
import test.beans.TestBean;
import java.util.List;
import java.util.Set;

View File

@@ -18,8 +18,8 @@ package org.springframework.beans.factory.xml;
import java.io.Serializable;
import org.springframework.beans.IndexedTestBean;
import org.springframework.beans.TestBean;
import test.beans.IndexedTestBean;
import test.beans.TestBean;
/**
* Simple bean used to check constructor dependency checking.

View File

@@ -16,10 +16,11 @@
package org.springframework.beans.factory.xml;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import test.beans.TestBean;
/**
* Simple bean used to test dependency checking.
*

View File

@@ -16,9 +16,10 @@
package org.springframework.beans.factory.xml;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.DummyFactory;
import test.beans.TestBean;
/**
* @author Juergen Hoeller
* @since 21.07.2003

View File

@@ -24,12 +24,13 @@ import java.util.List;
import java.util.Properties;
import org.junit.Test;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.core.io.ClassPathResource;
import test.beans.TestBean;
/**
* @author Juergen Hoeller
* @author Chris Beams

View File

@@ -19,7 +19,7 @@ package org.springframework.beans.factory.xml;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.TestBean;
import test.beans.TestBean;
/**
* Test class for Spring's ability to create objects using static

View File

@@ -16,7 +16,7 @@
package org.springframework.beans.factory.xml;
import org.springframework.beans.TestBean;
import test.beans.TestBean;
/**
* Test class for Spring's ability to create objects using

View File

@@ -20,10 +20,11 @@ import junit.framework.TestCase;
import org.xml.sax.SAXParseException;
import org.springframework.beans.BeansException;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.core.io.ClassPathResource;
import test.beans.TestBean;
/**
* @author Rob Harrop
*/

View File

@@ -18,11 +18,12 @@ package org.springframework.beans.factory.xml;
import junit.framework.TestCase;
import org.springframework.beans.ITestBean;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.core.io.ClassPathResource;
import test.beans.ITestBean;
import test.beans.TestBean;
/**
* @author Rob Harrop
* @author Juergen Hoeller

View File

@@ -16,7 +16,7 @@
package org.springframework.beans.factory.xml;
import org.springframework.beans.TestBean;
import test.beans.TestBean;
/**
* Test class for Spring's ability to create

View File

@@ -25,7 +25,6 @@ import java.util.TreeMap;
import junit.framework.TestCase;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.parsing.CollectingReaderEventListener;
import org.springframework.beans.factory.parsing.ComponentDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
@@ -35,6 +34,8 @@ import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.beans.factory.config.FieldRetrievingFactoryBean;
import org.springframework.core.io.ClassPathResource;
import test.beans.TestBean;
/**
* @author Rob Harrop
* @author Juergen Hoeller

View File

@@ -31,7 +31,6 @@ import java.util.TreeMap;
import java.util.TreeSet;
import org.junit.Test;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.HasMap;
@@ -40,6 +39,8 @@ import org.springframework.beans.factory.config.MapFactoryBean;
import org.springframework.beans.factory.config.SetFactoryBean;
import org.springframework.core.io.ClassPathResource;
import test.beans.TestBean;
/**
* Tests for collections in XML bean definitions.
*

View File

@@ -21,7 +21,6 @@ import java.util.Arrays;
import junit.framework.TestCase;
import org.xml.sax.InputSource;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -30,6 +29,8 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.Resource;
import test.beans.TestBean;
/**
* @author Rick Evans
* @author Juergen Hoeller

View File

@@ -24,9 +24,7 @@ import java.util.Map;
import junit.framework.Assert;
import org.springframework.beans.BeansException;
import org.springframework.beans.ITestBean;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.AbstractListableBeanFactoryTests;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.DummyFactory;
@@ -36,6 +34,9 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.core.io.ClassPathResource;
import test.beans.ITestBean;
import test.beans.TestBean;
/**
* @author Juergen Hoeller
* @since 09.11.2003

View File

@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="jenny" class="org.springframework.beans.TestBean">
<bean id="jenny" class="test.beans.TestBean">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="spouse">
@@ -12,7 +12,7 @@
</property>
</bean>
<bean id="david" class="org.springframework.beans.TestBean">
<bean id="david" class="test.beans.TestBean">
<description>
Simple bean, without any collections.
</description>
@@ -23,7 +23,7 @@
<property name="age"><value>27</value></property>
</bean>
<bean id="rod" class="org.springframework.beans.TestBean">
<bean id="rod" class="test.beans.TestBean">
<property name="name"><value>Rod</value></property>
<property name="age"><value>32</value></property>
<property name="friends">
@@ -35,7 +35,7 @@
</property>
</bean>
<bean id="pJenny" class="org.springframework.beans.TestBean" scope="prototype">
<bean id="pJenny" class="test.beans.TestBean" scope="prototype">
<property name="name"><value>Jenny</value></property>
<property name="age"><value>30</value></property>
<property name="spouse">
@@ -44,12 +44,12 @@
</property>
</bean>
<bean id="pDavid" class="org.springframework.beans.TestBean" scope="prototype">
<bean id="pDavid" class="test.beans.TestBean" scope="prototype">
<property name="name"><value>David</value></property>
<property name="age"><value>27</value></property>
</bean>
<bean id="pRod" class="org.springframework.beans.TestBean" scope="prototype">
<bean id="pRod" class="test.beans.TestBean" scope="prototype">
<property name="name"><value>Rod</value></property>
<property name="age"><value>32</value></property>
<property name="friends">
@@ -63,7 +63,7 @@
<!--
Try setting a collection property to a single value
-->
<bean id="loner" class="org.springframework.beans.TestBean">
<bean id="loner" class="test.beans.TestBean">
<property name="name"><value>loner</value></property>
<property name="age"><value>26</value></property>
<property name="friends">
@@ -97,15 +97,15 @@
</property>
</bean>
<bean id="verbose" class="org.springframework.beans.TestBean">
<bean id="verbose" class="test.beans.TestBean">
<property name="name"><value>verbose</value></property>
</bean>
<bean id="verbose2" class="org.springframework.beans.TestBean">
<bean id="verbose2" class="test.beans.TestBean">
<property name="name"><idref local="verbose"/></property>
</bean>
<bean id="verbose3" class="org.springframework.beans.TestBean">
<bean id="verbose3" class="test.beans.TestBean">
<property name="name"><idref bean="verbose"/></property>
</bean>

View File

@@ -92,7 +92,7 @@
<bean id="listInstance" class="org.springframework.beans.factory.xml.FactoryMethods"
factory-method="listInstance"/>
<bean id="juergen" class="org.springframework.beans.TestBean">
<bean id="juergen" class="test.beans.TestBean">
<property name="name"><value>Juergen</value></property>
</bean>
@@ -117,7 +117,7 @@
<!-- Unnamed bean with factory-bean declaration -->
<bean factory-bean="instanceFactory" factory-method="defaultInstance"/>
<bean id="testBeanWithInnerFactoryMethod" class="org.springframework.beans.TestBean">
<bean id="testBeanWithInnerFactoryMethod" class="test.beans.TestBean">
<property name="friends">
<list>
<!-- Unnamed bean with factory-bean declaration -->

View File

@@ -42,14 +42,14 @@ import org.junit.Test;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.BeansException;
import org.springframework.beans.ITestBean;
import org.springframework.beans.IndexedTestBean;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.NumberTestBean;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.TestBean;
import test.beans.BooleanTestBean;
import test.beans.ITestBean;
import test.beans.IndexedTestBean;
import test.beans.NumberTestBean;
import test.beans.TestBean;
/**
* Unit tests for the various PropertyEditors in Spring.
@@ -572,9 +572,9 @@ public class CustomEditorTests {
@Test
public void testClassEditor() {
PropertyEditor classEditor = new ClassEditor();
classEditor.setAsText("org.springframework.beans.TestBean");
classEditor.setAsText(TestBean.class.getName());
assertEquals(TestBean.class, classEditor.getValue());
assertEquals("org.springframework.beans.TestBean", classEditor.getAsText());
assertEquals(TestBean.class.getName(), classEditor.getAsText());
classEditor.setAsText(null);
assertEquals("", classEditor.getAsText());
@@ -593,9 +593,9 @@ public class CustomEditorTests {
@Test
public void testClassEditorWithArray() {
PropertyEditor classEditor = new ClassEditor();
classEditor.setAsText("org.springframework.beans.TestBean[]");
classEditor.setAsText("test.beans.TestBean[]");
assertEquals(TestBean[].class, classEditor.getValue());
assertEquals("org.springframework.beans.TestBean[]", classEditor.getAsText());
assertEquals("test.beans.TestBean[]", classEditor.getAsText());
}
/*

View File

@@ -27,7 +27,8 @@ import junit.framework.TestCase;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.TestBean;
import test.beans.TestBean;
/**
* @author Juergen Hoeller

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
import org.springframework.core.enums.ShortCodedLabeledEnum;

View File

@@ -18,7 +18,6 @@ package test.beans;
import java.io.Serializable;
import org.springframework.beans.TestBean;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;

View File

@@ -14,9 +14,8 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
import test.beans.GenericBean;
/**
* @author Juergen Hoeller

View File

@@ -14,11 +14,10 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
import java.util.Set;
import test.beans.GenericBean;
/**
* @author Juergen Hoeller

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
public interface INestedTestBean {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
public interface IOther {

View File

@@ -14,12 +14,12 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
import java.io.IOException;
/**
* Interface used for {@link org.springframework.beans.TestBean}.
* Interface used for {@link test.beans.TestBean}.
*
* <p>Two methods are the same as on Person, but if this
* extends person it breaks quite a few tests..

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 the original author or authors.
* 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
import java.util.ArrayList;
import java.util.Collection;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
/**
* Simple nested test bean used for testing bean factories, AOP framework etc.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
import java.math.BigDecimal;
import java.math.BigInteger;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.beans;
package test.beans;
import java.io.IOException;
import java.util.ArrayList;