From dcaf024e76aec457d38111684d10d2601c830b4f Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 29 Oct 2008 18:03:15 +0000 Subject: [PATCH] Moved tests from testsuite to beans --- .../beans/factory/CountingFactory.java | 4 +- .../xml/AutowireWithExclusionTests.java | 15 +- .../factory/xml/BeanNameGenerationTests.java | 0 .../factory/xml/CollectionMergingTests.java | 0 .../xml/CollectionsWithDefaultTypesTests.java | 0 .../beans/factory/xml/GeneratedNameBean.java | 0 .../beans/factory/xml/beanNameGeneration.xml | 18 ++ .../beans/factory/xml/collectionMerging.xml | 205 ++++++++++++++++++ .../xml/collectionsWithDefaultTypes.xml | 61 ++++++ 9 files changed, 294 insertions(+), 9 deletions(-) rename {org.springframework.testsuite => org.springframework.beans}/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java (100%) rename {org.springframework.testsuite => org.springframework.beans}/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java (100%) rename {org.springframework.testsuite => org.springframework.beans}/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java (100%) rename {org.springframework.testsuite => org.springframework.beans}/src/test/java/org/springframework/beans/factory/xml/GeneratedNameBean.java (100%) create mode 100644 org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/beanNameGeneration.xml create mode 100644 org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collectionMerging.xml create mode 100644 org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml diff --git a/org.springframework.beans/src/test/java/org/springframework/beans/factory/CountingFactory.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/CountingFactory.java index 147184f232..158b3e0d1e 100644 --- a/org.springframework.beans/src/test/java/org/springframework/beans/factory/CountingFactory.java +++ b/org.springframework.beans/src/test/java/org/springframework/beans/factory/CountingFactory.java @@ -22,7 +22,7 @@ import org.springframework.beans.TestBean; * @author Juergen Hoeller */ public class CountingFactory implements FactoryBean { - + private static int factoryBeanInstanceCount = 0; @@ -61,4 +61,4 @@ public class CountingFactory implements FactoryBean { return true; } -} +} \ No newline at end of file diff --git a/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java index a376eac490..8e586b2ae9 100644 --- a/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java +++ b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java @@ -17,6 +17,7 @@ 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; @@ -40,7 +41,7 @@ public class AutowireWithExclusionTests extends TestCase { TestBean rob = (TestBean) beanFactory.getBean("rob"); TestBean sally = (TestBean) beanFactory.getBean("sally"); assertEquals(sally, rob.getSpouse()); - assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); + Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithExclusion() throws Exception { @@ -49,7 +50,7 @@ public class AutowireWithExclusionTests extends TestCase { beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); - assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); + Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithExclusionInParentFactory() throws Exception { @@ -62,7 +63,7 @@ public class AutowireWithExclusionTests extends TestCase { child.registerBeanDefinition("rob2", robDef); TestBean rob = (TestBean) child.getBean("rob2"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); - assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); + Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithPrimaryInParentFactory() throws Exception { @@ -79,7 +80,7 @@ public class AutowireWithExclusionTests extends TestCase { child.registerBeanDefinition("props3", propsDef); TestBean rob = (TestBean) child.getBean("rob2"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); - assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); + Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithPrimaryOverridingParentFactory() throws Exception { @@ -96,7 +97,7 @@ public class AutowireWithExclusionTests extends TestCase { child.registerBeanDefinition("props3", propsDef); TestBean rob = (TestBean) child.getBean("rob2"); assertEquals("props3", rob.getSomeProperties().getProperty("name")); - assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); + Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithInclusion() throws Exception { @@ -105,7 +106,7 @@ public class AutowireWithExclusionTests extends TestCase { beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); - assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); + Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testByTypeAutowireWithSelectiveInclusion() throws Exception { @@ -114,7 +115,7 @@ public class AutowireWithExclusionTests extends TestCase { beanFactory.preInstantiateSingletons(); TestBean rob = (TestBean) beanFactory.getBean("rob"); assertEquals("props1", rob.getSomeProperties().getProperty("name")); - assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); + Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount()); } public void testConstructorAutowireWithAutoSelfExclusion() throws Exception { diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java rename to org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/BeanNameGenerationTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java rename to org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/CollectionMergingTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java rename to org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/GeneratedNameBean.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/GeneratedNameBean.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/GeneratedNameBean.java rename to org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/GeneratedNameBean.java diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/beanNameGeneration.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/beanNameGeneration.xml new file mode 100644 index 0000000000..813049d1a5 --- /dev/null +++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/beanNameGeneration.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collectionMerging.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collectionMerging.xml new file mode 100644 index 0000000000..0bd9225e53 --- /dev/null +++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collectionMerging.xml @@ -0,0 +1,205 @@ + + + + + + + + + Rob Harrop + Rod Johnson + + + + + + + + Juergen Hoeller + + + + + + + + + + + + + + + + Rob Harrop + + + + + + + + Sally Greenwood + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sall + Kerry + + + + + + + + Eva + Sally + + + + + + + + + Rob Harrop + Rod Johnson + + + + + + + + Juergen Hoeller + + + + + + + + + + + + + + + + Rob Harrop + + + + + + + + Sally Greenwood + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sall + Kerry + + + + + + + + Eva + Sally + + + + + diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml new file mode 100644 index 0000000000..584063fde1 --- /dev/null +++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/collectionsWithDefaultTypes.xml @@ -0,0 +1,61 @@ + + + + + + + + 1 + 2 + 3 + + + + + 1 + 2 + 3 + + + + + + + + + + + + + + + + + + 1 + + true + + + + 2 + + false + + + + 3 + + false + + + + 4 + + true + + + + + \ No newline at end of file