moving unit tests from .testsuite -> .beans
moving and prepping to move SingletonBeanFactoryLocatorTests and ContextSingletonBeanFactoryLocatorTests to their respective .beans and .context packages
This commit is contained in:
parent
a4c23509e3
commit
f7813b48e1
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||||
|
|
||||||
|
<!-- We are only using one definition file for the purposes of this test, since we do not have multiple
|
||||||
|
classloaders available in the environment to allow combining multiple files of the same name, but
|
||||||
|
of course the contents within could be spread out across multiple files of the same name withing
|
||||||
|
different jars -->
|
||||||
|
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<!-- this definition could be inside one beanRefFactory.xml file -->
|
||||||
|
<bean id="a.qualified.name.of.some.sort"
|
||||||
|
class="org.springframework.beans.factory.xml.XmlBeanFactory">
|
||||||
|
<constructor-arg value="org/springframework/beans/factory/access/beans1.xml"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- while the following two could be inside another, also on the classpath,
|
||||||
|
perhaps coming from another component jar -->
|
||||||
|
|
||||||
|
<bean id="another.qualified.name"
|
||||||
|
class="org.springframework.beans.factory.xml.XmlBeanFactory">
|
||||||
|
<constructor-arg value="org/springframework/beans/factory/access/beans1.xml"/>
|
||||||
|
<constructor-arg ref="a.qualified.name.of.some.sort"/> <!-- parent bean factory -->
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<alias name="another.qualified.name" alias="a.qualified.name.which.is.an.alias"/>
|
||||||
|
|
||||||
|
</beans>
|
||||||
|
|
@ -45,11 +45,9 @@ public class ContextSingletonBeanFactoryLocatorTests extends SingletonBeanFactor
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBasicFunctionality() {
|
public void testBasicFunctionality() {
|
||||||
// Just use definition file from the SingletonBeanFactoryLocator test,
|
|
||||||
// since it is completely valid.
|
|
||||||
ContextSingletonBeanFactoryLocator facLoc = new ContextSingletonBeanFactoryLocator(
|
ContextSingletonBeanFactoryLocator facLoc = new ContextSingletonBeanFactoryLocator(
|
||||||
"classpath*:" + ClassUtils.addResourcePathToPackagePath(
|
"classpath*:" + ClassUtils.addResourcePathToPackagePath(
|
||||||
SingletonBeanFactoryLocatorTests.class, "ref1.xml"));
|
getClass(), "context.xml"));
|
||||||
|
|
||||||
basicFunctionalityTest(facLoc);
|
basicFunctionalityTest(facLoc);
|
||||||
|
|
||||||
|
|
@ -75,18 +73,18 @@ public class ContextSingletonBeanFactoryLocatorTests extends SingletonBeanFactor
|
||||||
// Try with and without 'classpath*:' prefix, and with 'classpath:' prefix.
|
// Try with and without 'classpath*:' prefix, and with 'classpath:' prefix.
|
||||||
BeanFactoryLocator facLoc = ContextSingletonBeanFactoryLocator.getInstance(
|
BeanFactoryLocator facLoc = ContextSingletonBeanFactoryLocator.getInstance(
|
||||||
ClassUtils.addResourcePathToPackagePath(
|
ClassUtils.addResourcePathToPackagePath(
|
||||||
SingletonBeanFactoryLocatorTests.class, "ref1.xml"));
|
getClass(), "context.xml"));
|
||||||
getInstanceTest1(facLoc);
|
getInstanceTest1(facLoc);
|
||||||
|
|
||||||
facLoc = ContextSingletonBeanFactoryLocator.getInstance(
|
facLoc = ContextSingletonBeanFactoryLocator.getInstance(
|
||||||
"classpath*:" + ClassUtils.addResourcePathToPackagePath(
|
"classpath*:" + ClassUtils.addResourcePathToPackagePath(
|
||||||
SingletonBeanFactoryLocatorTests.class, "ref1.xml"));
|
getClass(), "context.xml"));
|
||||||
getInstanceTest2(facLoc);
|
getInstanceTest2(facLoc);
|
||||||
|
|
||||||
// This will actually get another locator instance, as the key is the resource name.
|
// This will actually get another locator instance, as the key is the resource name.
|
||||||
facLoc = ContextSingletonBeanFactoryLocator.getInstance(
|
facLoc = ContextSingletonBeanFactoryLocator.getInstance(
|
||||||
"classpath:" + ClassUtils.addResourcePathToPackagePath(
|
"classpath:" + ClassUtils.addResourcePathToPackagePath(
|
||||||
SingletonBeanFactoryLocatorTests.class, "ref1.xml"));
|
getClass(), "context.xml"));
|
||||||
getInstanceTest3(facLoc);
|
getInstanceTest3(facLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,9 @@
|
||||||
|
|
||||||
<!-- while the following two could be inside another, also on the classpath,
|
<!-- while the following two could be inside another, also on the classpath,
|
||||||
perhaps coming from another component jar -->
|
perhaps coming from another component jar -->
|
||||||
|
|
||||||
<bean id="another.qualified.name"
|
<bean id="another.qualified.name"
|
||||||
class="org.springframework.context.support.ClassPathXmlApplicationContext">
|
class="org.springframework.context.support.ClassPathXmlApplicationContext">
|
||||||
<property name="configLocations" value="org/springframework/beans/factory/access/beans2.xml"/>
|
<property name="configLocation" value="org/springframework/beans/factory/access/beans1.xml"/>
|
||||||
<property name="parent" ref="a.qualified.name.of.some.sort"/>
|
<property name="parent" ref="a.qualified.name.of.some.sort"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
Loading…
Reference in New Issue