Code example for XmlBeanFactory

Methods: getBean

0
        Object bean = this.beanFactory.getBean("classpathPropertyFileDataSource");
        assertEquals("not the correct class", "oracle.jdbc.pool.OracleDataSource", bean.getClass().getName());
    } 
 
    public void testLocalPropertyFileDataSourceDefinition() throws Exception {
        Object bean = this.beanFactory.getBean("localPropertyFileDataSource");
        assertEquals("not the correct class", "oracle.jdbc.pool.OracleDataSource", bean.getClass().getName());
    } 
 
    public void testConectionPropertiesDataSourceDefinition() throws Exception {
        Object bean = this.beanFactory.getBean("connectionPropertiesDataSource");
        assertEquals("not the correct class", "oracle.jdbc.pool.OracleDataSource", bean.getClass().getName());
        assertTrue("connection properties not found", ((OracleDataSource)bean).getConnectionProperties().size() > 0);
        assertTrue("cache properties not found", ((OracleDataSource)bean).getConnectionCacheProperties().size() > 0);
    } 
 
    public void testConnectionCachingIsEnabledByDefault() throws Exception {
        Object bean = this.beanFactory.getBean("cachingByDefaultDataSource");
        assertEquals("not the correct class", "oracle.jdbc.pool.OracleDataSource", bean.getClass().getName());
        assertTrue("caching not enabled", ((OracleDataSource)bean).getConnectionCachingEnabled());