From 314952d4a49e8a6db1667031b67b27b0355c0ac2 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 29 Oct 2008 17:59:31 +0000 Subject: [PATCH] Moved tests from testsuite to beans git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@198 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../beans/factory/CountingFactory.java | 64 +++++++++++++++++++ .../xml/AutowireWithExclusionTests.java | 0 .../autowire-constructor-with-exclusion.xml | 22 +++++++ .../factory/xml/autowire-with-exclusion.xml | 26 ++++++++ .../factory/xml/autowire-with-inclusion.xml | 27 ++++++++ .../xml/autowire-with-selective-inclusion.xml | 33 ++++++++++ 6 files changed, 172 insertions(+) create mode 100644 org.springframework.beans/src/test/java/org/springframework/beans/factory/CountingFactory.java rename {org.springframework.testsuite => org.springframework.beans}/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java (100%) create mode 100644 org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml create mode 100644 org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-exclusion.xml create mode 100644 org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-inclusion.xml create mode 100644 org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-selective-inclusion.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 new file mode 100644 index 00000000000..147184f2328 --- /dev/null +++ b/org.springframework.beans/src/test/java/org/springframework/beans/factory/CountingFactory.java @@ -0,0 +1,64 @@ +/* + * Copyright 2002-2006 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.beans.factory; + +import org.springframework.beans.TestBean; + +/** + * @author Juergen Hoeller + */ +public class CountingFactory implements FactoryBean { + + private static int factoryBeanInstanceCount = 0; + + + /** + * Clear static state. + */ + public static void reset() { + factoryBeanInstanceCount = 0; + } + + public static int getFactoryBeanInstanceCount() { + return factoryBeanInstanceCount; + } + + + public CountingFactory() { + factoryBeanInstanceCount++; + } + + public void setTestBean(TestBean tb) { + if (tb.getSpouse() == null) { + throw new IllegalStateException("TestBean needs to have spouse"); + } + } + + + public Object getObject() { + return "myString"; + } + + public Class getObjectType() { + return String.class; + } + + public boolean isSingleton() { + return true; + } + +} diff --git a/org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java b/org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java rename to org.springframework.beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml new file mode 100644 index 00000000000..5952fa0c540 --- /dev/null +++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-constructor-with-exclusion.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + name=props1 + + + + + + name=props2 + + + + \ No newline at end of file diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-exclusion.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-exclusion.xml new file mode 100644 index 00000000000..041092cdd92 --- /dev/null +++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-exclusion.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + name=props1 + + + + + + name=props2 + + + + + + + + diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-inclusion.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-inclusion.xml new file mode 100644 index 00000000000..271e66f5703 --- /dev/null +++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-inclusion.xml @@ -0,0 +1,27 @@ + + + + + + + + + + name=props1 + + + + + + name=props2 + + + + + + + + diff --git a/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-selective-inclusion.xml b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-selective-inclusion.xml new file mode 100644 index 00000000000..c49f3680e8c --- /dev/null +++ b/org.springframework.beans/src/test/resources/org/springframework/beans/factory/xml/autowire-with-selective-inclusion.xml @@ -0,0 +1,33 @@ + + + + + + + + + + name=props1 + + + + + + name=props2 + + + + + + name=someProps + + + + + + + +