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");
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class SimpleScopeTests method setUp.
@Before
public void setUp() {
beanFactory = new DefaultListableBeanFactory();
Scope scope = new NoOpScope() {
private int index;
private List<TestBean> objects = new LinkedList<>();
{
objects.add(new TestBean());
objects.add(new TestBean());
}
@Override
public Object get(String name, ObjectFactory<?> objectFactory) {
if (index >= objects.size()) {
index = 0;
}
return objects.get(index++);
}
};
beanFactory.registerScope("myScope", scope);
String[] scopeNames = beanFactory.getRegisteredScopeNames();
assertEquals(1, scopeNames.length);
assertEquals("myScope", scopeNames[0]);
assertSame(scope, beanFactory.getRegisteredScope("myScope"));
XmlBeanDefinitionReader xbdr = new XmlBeanDefinitionReader(beanFactory);
xbdr.loadBeanDefinitions(CONTEXT);
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-framework by spring-projects.
the class ProxyFactoryBeanTests method testTargetSourceNotAtEndOfInterceptorNamesIsRejected.
@Test
public void testTargetSourceNotAtEndOfInterceptorNamesIsRejected() {
try {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(NOTLAST_TARGETSOURCE_CONTEXT, CLASS));
bf.getBean("targetSourceNotLast");
fail("TargetSource or non-advised object must be last in interceptorNames");
} catch (BeanCreationException ex) {
// Root cause of the problem must be an AOP exception
AopConfigException aex = (AopConfigException) ex.getCause();
assertTrue(aex.getMessage().contains("interceptorNames"));
}
}
Aggregations