use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class PropertyPathFactoryBeanTests method testPropertyPathFactoryBeanAsInnerBean.
@Test
public void testPropertyPathFactoryBeanAsInnerBean() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
TestBean spouse = (TestBean) xbf.getBean("otb.spouse");
TestBean tbWithInner = (TestBean) xbf.getBean("tbWithInner");
assertSame(spouse, tbWithInner.getSpouse());
assertTrue(!tbWithInner.getFriends().isEmpty());
assertSame(spouse, tbWithInner.getFriends().iterator().next());
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class PropertyPathFactoryBeanTests method testPropertyPathFactoryBeanWithPrototypeResult.
@Test
public void testPropertyPathFactoryBeanWithPrototypeResult() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertNull(xbf.getType("tb.spouse"));
assertEquals(TestBean.class, xbf.getType("propertyPath3"));
Object result1 = xbf.getBean("tb.spouse");
Object result2 = xbf.getBean("propertyPath3");
Object result3 = xbf.getBean("propertyPath3");
assertTrue(result1 instanceof TestBean);
assertTrue(result2 instanceof TestBean);
assertTrue(result3 instanceof TestBean);
assertEquals(11, ((TestBean) result1).getAge());
assertEquals(11, ((TestBean) result2).getAge());
assertEquals(11, ((TestBean) result3).getAge());
assertTrue(result1 != result2);
assertTrue(result1 != result3);
assertTrue(result2 != result3);
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class PropertyPathFactoryBeanTests method testPropertyPathFactoryBeanWithNullResult.
@Test
public void testPropertyPathFactoryBeanWithNullResult() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertNull(xbf.getType("tb.spouse.spouse"));
assertNull(xbf.getBean("tb.spouse.spouse"));
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class FieldRetrievingFactoryBeanTests method testBeanNameSyntaxWithBeanFactory.
@Test
public void testBeanNameSyntaxWithBeanFactory() throws Exception {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT);
TestBean testBean = (TestBean) bf.getBean("testBean");
assertEquals(new Integer(Connection.TRANSACTION_SERIALIZABLE), testBean.getSomeIntegerArray()[0]);
assertEquals(new Integer(Connection.TRANSACTION_SERIALIZABLE), testBean.getSomeIntegerArray()[1]);
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class ObjectFactoryCreatingFactoryBeanTests method setUp.
@Before
public void setUp() {
this.beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(CONTEXT);
this.beanFactory.setSerializationId("test");
}
Aggregations