Java 类org.springframework.beans.factory.support.StaticListableBeanFactory 实例源码

项目:kc-rice    文件:ModuleServiceBaseTest.java   
@Before
public void initGRL() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();
    when(kualiModuleService.getInstalledModuleServices()).thenReturn(installedModuleServices);

    testBf.addBean(KRADServiceLocator.PROVIDER_REGISTRY, mock(ProviderRegistry.class));
    testBf.addBean(KRADServiceLocatorWeb.KUALI_MODULE_SERVICE, kualiModuleService);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleservicebase-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
项目:kc-rice    文件:KualiModuleServiceImplTest.java   
@Before
public void installRiceKualiModuleService() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();

    KualiModuleService riceKualiModuleService = mock(KualiModuleService.class);
    when(riceKualiModuleService.getInstalledModuleServices()).thenReturn(riceModuleServices);

    testBf.addBean(KRADServiceLocatorWeb.KUALI_MODULE_SERVICE, riceKualiModuleService);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleservicebase-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
项目:spring-boot-controller-test-example    文件:TestHelper.java   
public MockMvc mvc(Object controller) {
    StandaloneMockMvcBuilder builder = new StandaloneMockMvcBuilder(controller) {
        @Override
        protected WebApplicationContext initWebAppContext() {
            WebApplicationContext context = super.initWebAppContext();
            StaticListableBeanFactory beanFactory = (StaticListableBeanFactory)context.getAutowireCapableBeanFactory();

            Arrays.stream(BeanFactoryUtils.beanNamesForTypeIncludingAncestors(applicationContext, Object.class))
                .filter(name -> applicationContext.findAnnotationOnBean(name, ControllerAdvice.class) != null)
                .forEach(name -> beanFactory.addBean(name, applicationContext.getBean(name)));

            context.getBean(RequestMappingHandlerAdapter.class).afterPropertiesSet();
            return context;
        }
    };
    return builder.setHandlerExceptionResolvers(handlerExceptionResolver).build();
}
项目:rice    文件:ModuleServiceBaseTest.java   
@Before
public void initGRL() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();
    when(kualiModuleService.getInstalledModuleServices()).thenReturn(installedModuleServices);

    testBf.addBean(KRADServiceLocator.PROVIDER_REGISTRY, mock(ProviderRegistry.class));
    testBf.addBean(KRADServiceLocatorWeb.KUALI_MODULE_SERVICE, kualiModuleService);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleservicebase-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
项目:rice    文件:KualiModuleServiceImplTest.java   
@Before
public void installRiceKualiModuleService() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();

    KualiModuleService riceKualiModuleService = mock(KualiModuleService.class);
    when(riceKualiModuleService.getInstalledModuleServices()).thenReturn(riceModuleServices);

    testBf.addBean(KRADServiceLocatorWeb.KUALI_MODULE_SERVICE, riceKualiModuleService);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleservicebase-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
项目:spring4-understanding    文件:ClassPathBeanDefinitionScannerTests.java   
@Test
public void testBeanAutowiredWithAnnotationConfigEnabled() {
    GenericApplicationContext context = new GenericApplicationContext();
    context.registerBeanDefinition("myBf", new RootBeanDefinition(StaticListableBeanFactory.class));
    ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
    scanner.setBeanNameGenerator(new TestBeanNameGenerator());
    int beanCount = scanner.scan(BASE_PACKAGE);
    assertEquals(12, beanCount);
    context.refresh();

    FooServiceImpl fooService = context.getBean("fooService", FooServiceImpl.class);
    StaticListableBeanFactory myBf = (StaticListableBeanFactory) context.getBean("myBf");
    MessageSource ms = (MessageSource) context.getBean("messageSource");
    assertTrue(fooService.isInitCalled());
    assertEquals("bar", fooService.foo(123));
    assertSame(context.getDefaultListableBeanFactory(), fooService.beanFactory);
    assertEquals(2, fooService.listableBeanFactory.size());
    assertSame(context.getDefaultListableBeanFactory(), fooService.listableBeanFactory.get(0));
    assertSame(myBf, fooService.listableBeanFactory.get(1));
    assertSame(context, fooService.resourceLoader);
    assertSame(context, fooService.resourcePatternResolver);
    assertSame(context, fooService.eventPublisher);
    assertSame(ms, fooService.messageSource);
    assertSame(context, fooService.context);
    assertEquals(1, fooService.configurableContext.length);
    assertSame(context, fooService.configurableContext[0]);
    assertSame(context, fooService.genericContext);
}
项目:spring4-understanding    文件:JCacheInterceptorTests.java   
protected JCacheOperationSource createOperationSource(CacheManager cacheManager,
        CacheResolver cacheResolver, CacheResolver exceptionCacheResolver, KeyGenerator keyGenerator) {

    DefaultJCacheOperationSource source = new DefaultJCacheOperationSource();
    source.setCacheManager(cacheManager);
    source.setCacheResolver(cacheResolver);
    source.setExceptionCacheResolver(exceptionCacheResolver);
    source.setKeyGenerator(keyGenerator);
    source.setBeanFactory(new StaticListableBeanFactory());
    source.afterPropertiesSet();
    source.afterSingletonsInstantiated();
    return source;
}
项目:spring4-understanding    文件:BeanFactoryUtilsTests.java   
@Test
public void testHierarchicalCountBeansWithNonHierarchicalFactory() {
    StaticListableBeanFactory lbf = new StaticListableBeanFactory();
    lbf.addBean("t1", new TestBean());
    lbf.addBean("t2", new TestBean());
    assertTrue(BeanFactoryUtils.countBeansIncludingAncestors(lbf) == 2);
}
项目:spring4-understanding    文件:BeanFactoryUtilsTests.java   
@Test
public void testNoBeansOfType() {
    StaticListableBeanFactory lbf = new StaticListableBeanFactory();
    lbf.addBean("foo", new Object());
    Map<String, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, false);
    assertTrue(beans.isEmpty());
}
项目:spring4-understanding    文件:BeanFactoryUtilsTests.java   
@Test
public void testFindsBeansOfTypeWithStaticFactory() {
    StaticListableBeanFactory lbf = new StaticListableBeanFactory();
    TestBean t1 = new TestBean();
    TestBean t2 = new TestBean();
    DummyFactory t3 = new DummyFactory();
    DummyFactory t4 = new DummyFactory();
    t4.setSingleton(false);
    lbf.addBean("t1", t1);
    lbf.addBean("t2", t2);
    lbf.addBean("t3", t3);
    lbf.addBean("t4", t4);

    Map<String, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, true);
    assertEquals(4, beans.size());
    assertEquals(t1, beans.get("t1"));
    assertEquals(t2, beans.get("t2"));
    assertEquals(t3.getObject(), beans.get("t3"));
    assertTrue(beans.get("t4") instanceof TestBean);

    beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, DummyFactory.class, true, true);
    assertEquals(2, beans.size());
    assertEquals(t3, beans.get("&t3"));
    assertEquals(t4, beans.get("&t4"));

    beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, FactoryBean.class, true, true);
    assertEquals(2, beans.size());
    assertEquals(t3, beans.get("&t3"));
    assertEquals(t4, beans.get("&t4"));
}
项目:kc-rice    文件:ModuleConfigurationTest.java   
@Before
public void initGRL() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);
    StaticListableBeanFactory testBf = new StaticListableBeanFactory();
    testBf.addBean(KRADServiceLocator.PROVIDER_REGISTRY, prMock);
    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleconfiguration-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
项目:kc-rice    文件:LegacyDataAdapterImplTest.java   
@Before
public void setup() throws Exception {
    GlobalResourceLoader.stop();

    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, getClass().getName());
    ConfigContext.init(config);
    ConfigContext.getCurrentContextConfig().removeProperty(KRADConstants.Config.ENABLE_LEGACY_DATA_FRAMEWORK);
    ConfigContext.getCurrentContextConfig().removeProperty(KRADConstants.Config.KNS_ENABLED);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();
    testBf.addBean("metadataRepository", metadataRepository);
    testBf.addBean("dataDictionaryService", dataDictionaryService);
    testBf.addBean("knsLegacyDataAdapter", knsLegacyDataAdapter);
    testBf.addBean("kradLegacyDataAdapter", kradLegacyDataAdapter);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName(getClass().getName()), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();

    MetadataManager mm = MetadataManager.getInstance();

    // register Legacy object
    ClassDescriptor legacyDescriptor = new ClassDescriptor(mm.getGlobalRepository());
    legacyDescriptor.setClassOfObject(Legacy.class);
    mm.getGlobalRepository().put(Legacy.class, legacyDescriptor);

    // register LegacyDocument object
    ClassDescriptor legacyDocumentDescriptor = new ClassDescriptor(mm.getGlobalRepository());
    legacyDocumentDescriptor.setClassOfObject(LegacyDocument.class);
    mm.getGlobalRepository().put(LegacyDocument.class, legacyDocumentDescriptor);
}
项目:kc-rice    文件:BeanFactoryInvocationHandlerTest.java   
@Before
public void createBadInstance() {
    StaticListableBeanFactory bf = new StaticListableBeanFactory();
    bf.addBean("bean", "This is a bean");
    bad = (BadInterface)
            Proxy.newProxyInstance(this.getClass().getClassLoader(),
                    new Class[]{BadInterface.class},
                    new BeanFactoryInvocationHandler(bf));
}
项目:class-guard    文件:ClassPathBeanDefinitionScannerTests.java   
@Test
public void testBeanAutowiredWithAnnotationConfigEnabled() {
    GenericApplicationContext context = new GenericApplicationContext();
    context.registerBeanDefinition("myBf", new RootBeanDefinition(StaticListableBeanFactory.class));
    ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
    scanner.setBeanNameGenerator(new TestBeanNameGenerator());
    int beanCount = scanner.scan(BASE_PACKAGE);
    assertEquals(10, beanCount);
    context.refresh();

    FooServiceImpl fooService = context.getBean("fooService", FooServiceImpl.class);
    StaticListableBeanFactory myBf = (StaticListableBeanFactory) context.getBean("myBf");
    MessageSource ms = (MessageSource) context.getBean("messageSource");
    assertTrue(fooService.isInitCalled());
    assertEquals("bar", fooService.foo(123));
    assertSame(context.getDefaultListableBeanFactory(), fooService.beanFactory);
    assertEquals(2, fooService.listableBeanFactory.size());
    assertSame(context.getDefaultListableBeanFactory(), fooService.listableBeanFactory.get(0));
    assertSame(myBf, fooService.listableBeanFactory.get(1));
    assertSame(context, fooService.resourceLoader);
    assertSame(context, fooService.resourcePatternResolver);
    assertSame(context, fooService.eventPublisher);
    assertSame(ms, fooService.messageSource);
    assertSame(context, fooService.context);
    assertEquals(1, fooService.configurableContext.length);
    assertSame(context, fooService.configurableContext[0]);
    assertSame(context, fooService.genericContext);
}
项目:class-guard    文件:DelegatingPhaseListenerTests.java   
@Override
@SuppressWarnings("serial")
protected void setUp() {
    facesContext = new MockFacesContext();
    beanFactory = new StaticListableBeanFactory();

    delPhaseListener = new DelegatingPhaseListenerMulticaster() {
        @Override
        protected ListableBeanFactory getBeanFactory(FacesContext facesContext) {
            return beanFactory;
        }
    };
}
项目:class-guard    文件:DelegatingNavigationHandlerTests.java   
@Override
protected void setUp() {
    facesContext = new MockFacesContext();
    beanFactory = new StaticListableBeanFactory();
    origNavHandler = new TestNavigationHandler();

    delNavHandler = new DelegatingNavigationHandlerProxy(origNavHandler) {
        @Override
        protected BeanFactory getBeanFactory(FacesContext facesContext) {
            return beanFactory;
        }
    };
}
项目:class-guard    文件:BeanFactoryUtilsTests.java   
@Test
public void testHierarchicalCountBeansWithNonHierarchicalFactory() {
    StaticListableBeanFactory lbf = new StaticListableBeanFactory();
    lbf.addBean("t1", new TestBean());
    lbf.addBean("t2", new TestBean());
    assertTrue(BeanFactoryUtils.countBeansIncludingAncestors(lbf) == 2);
}
项目:class-guard    文件:BeanFactoryUtilsTests.java   
@Test
public void testNoBeansOfType() {
    StaticListableBeanFactory lbf = new StaticListableBeanFactory();
    lbf.addBean("foo", new Object());
    Map<?, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, false);
    assertTrue(beans.isEmpty());
}
项目:rice    文件:ModuleConfigurationTest.java   
@Before
public void initGRL() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);
    StaticListableBeanFactory testBf = new StaticListableBeanFactory();
    testBf.addBean(KRADServiceLocator.PROVIDER_REGISTRY, prMock);
    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleconfiguration-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
项目:rice    文件:LegacyDataAdapterImplTest.java   
@Before
public void setup() throws Exception {
    GlobalResourceLoader.stop();

    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, getClass().getName());
    ConfigContext.init(config);
    ConfigContext.getCurrentContextConfig().removeProperty(KRADConstants.Config.ENABLE_LEGACY_DATA_FRAMEWORK);
    ConfigContext.getCurrentContextConfig().removeProperty(KRADConstants.Config.KNS_ENABLED);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();
    testBf.addBean("metadataRepository", metadataRepository);
    testBf.addBean("dataDictionaryService", dataDictionaryService);
    testBf.addBean("knsLegacyDataAdapter", knsLegacyDataAdapter);
    testBf.addBean("kradLegacyDataAdapter", kradLegacyDataAdapter);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName(getClass().getName()), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();

    MetadataManager mm = MetadataManager.getInstance();

    // register Legacy object
    ClassDescriptor legacyDescriptor = new ClassDescriptor(mm.getGlobalRepository());
    legacyDescriptor.setClassOfObject(Legacy.class);
    mm.getGlobalRepository().put(Legacy.class, legacyDescriptor);

    // register LegacyDocument object
    ClassDescriptor legacyDocumentDescriptor = new ClassDescriptor(mm.getGlobalRepository());
    legacyDocumentDescriptor.setClassOfObject(LegacyDocument.class);
    mm.getGlobalRepository().put(LegacyDocument.class, legacyDocumentDescriptor);
}
项目:rice    文件:BeanFactoryInvocationHandlerTest.java   
@Before
public void createBadInstance() {
    StaticListableBeanFactory bf = new StaticListableBeanFactory();
    bf.addBean("bean", "This is a bean");
    bad = (BadInterface)
            Proxy.newProxyInstance(this.getClass().getClassLoader(),
                    new Class[]{BadInterface.class},
                    new BeanFactoryInvocationHandler(bf));
}
项目:kuali_rice    文件:BeanFactoryInvocationHandlerTest.java   
@Before
public void createBadInstance() {
    StaticListableBeanFactory bf = new StaticListableBeanFactory();
    bf.addBean("bean", "This is a bean");
    bad = (BadInterface)
            Proxy.newProxyInstance(this.getClass().getClassLoader(),
                    new Class[]{BadInterface.class},
                    new BeanFactoryInvocationHandler(bf));
}
项目:spring4-understanding    文件:DefaultMessageHandlerMethodFactoryTests.java   
private DefaultMessageHandlerMethodFactory createInstance() {
    DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory();
    factory.setBeanFactory(new StaticListableBeanFactory());
    return factory;
}
项目:spring4-understanding    文件:MessagingMessageListenerAdapterTests.java   
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) {
    factory.setBeanFactory(new StaticListableBeanFactory());
    factory.afterPropertiesSet();
}
项目:spring4-understanding    文件:JmsListenerEndpointRegistrarTests.java   
@Before
public void setup() {
    registrar.setEndpointRegistry(registry);
    registrar.setBeanFactory(new StaticListableBeanFactory());
}
项目:spring4-understanding    文件:MethodJmsListenerEndpointTests.java   
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) {
    factory.setBeanFactory(new StaticListableBeanFactory());
    factory.afterPropertiesSet();
}
项目:spring4-understanding    文件:JmsListenerContainerFactoryIntegrationTests.java   
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) {
    factory.setBeanFactory(new StaticListableBeanFactory());
    factory.afterPropertiesSet();
}
项目:class-guard    文件:QuartzSupportTests.java   
private void doTestSchedulerFactoryBean(boolean explicitJobDetail, boolean prototypeJob) throws Exception {
    TestBean tb = new TestBean("tb", 99);
    JobDetailBean jobDetail0 = new JobDetailBean();
    jobDetail0.setJobClass(Job.class);
    jobDetail0.setBeanName("myJob0");
    Map jobData = new HashMap();
    jobData.put("testBean", tb);
    jobDetail0.setJobDataAsMap(jobData);
    jobDetail0.afterPropertiesSet();
    assertEquals(tb, jobDetail0.getJobDataMap().get("testBean"));

    CronTriggerBean trigger0 = new CronTriggerBean();
    trigger0.setBeanName("myTrigger0");
    trigger0.setJobDetail(jobDetail0);
    trigger0.setCronExpression("0/1 * * * * ?");
    trigger0.afterPropertiesSet();

    TestMethodInvokingTask task1 = new TestMethodInvokingTask();
    MethodInvokingJobDetailFactoryBean mijdfb = new MethodInvokingJobDetailFactoryBean();
    mijdfb.setBeanName("myJob1");
    if (prototypeJob) {
        StaticListableBeanFactory beanFactory = new StaticListableBeanFactory();
        beanFactory.addBean("task", task1);
        mijdfb.setTargetBeanName("task");
        mijdfb.setBeanFactory(beanFactory);
    }
    else {
        mijdfb.setTargetObject(task1);
    }
    mijdfb.setTargetMethod("doSomething");
    mijdfb.afterPropertiesSet();
    JobDetail jobDetail1 = mijdfb.getObject();

    SimpleTriggerBean trigger1 = new SimpleTriggerBean();
    trigger1.setBeanName("myTrigger1");
    trigger1.setJobDetail(jobDetail1);
    trigger1.setStartDelay(0);
    trigger1.setRepeatInterval(20);
    trigger1.afterPropertiesSet();

    final Scheduler scheduler = mock(Scheduler.class);
    given(scheduler.getContext()).willReturn(new SchedulerContext());
    given(scheduler.scheduleJob(trigger0)).willReturn(new Date());
    given(scheduler.scheduleJob(trigger1)).willReturn(new Date());

    SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
        @Override
        protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
            return scheduler;
        }
    };
    schedulerFactoryBean.setJobFactory(null);
    Map schedulerContext = new HashMap();
    schedulerContext.put("otherTestBean", tb);
    schedulerFactoryBean.setSchedulerContextAsMap(schedulerContext);
    if (explicitJobDetail) {
        schedulerFactoryBean.setJobDetails(new JobDetail[] {jobDetail0});
    }
    schedulerFactoryBean.setTriggers(new Trigger[] {trigger0, trigger1});
    try {
        schedulerFactoryBean.afterPropertiesSet();
        schedulerFactoryBean.start();
    }
    finally {
        schedulerFactoryBean.destroy();
    }

    verify(scheduler).getJobDetail("myJob0", Scheduler.DEFAULT_GROUP);
    verify(scheduler).getJobDetail("myJob1", Scheduler.DEFAULT_GROUP);
    verify(scheduler).getTrigger("myTrigger0", Scheduler.DEFAULT_GROUP);
    verify(scheduler).getTrigger("myTrigger1", Scheduler.DEFAULT_GROUP);
    verify(scheduler).addJob(jobDetail0, true);
    verify(scheduler).addJob(jobDetail1, true);
    verify(scheduler).start();
    verify(scheduler).shutdown(false);
}
项目:class-guard    文件:BeanFactoryUtilsTests.java   
@Test
public void testFindsBeansOfTypeWithStaticFactory() {
    StaticListableBeanFactory lbf = new StaticListableBeanFactory();
    TestBean t1 = new TestBean();
    TestBean t2 = new TestBean();
    DummyFactory t3 = new DummyFactory();
    DummyFactory t4 = new DummyFactory();
    t4.setSingleton(false);
    lbf.addBean("t1", t1);
    lbf.addBean("t2", t2);
    lbf.addBean("t3", t3);
    lbf.addBean("t4", t4);

    Map<?, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, false);
    assertEquals(2, beans.size());
    assertEquals(t1, beans.get("t1"));
    assertEquals(t2, beans.get("t2"));

    beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, false, true);
    assertEquals(3, beans.size());
    assertEquals(t1, beans.get("t1"));
    assertEquals(t2, beans.get("t2"));
    assertEquals(t3.getObject(), beans.get("t3"));

    beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, true);
    assertEquals(4, beans.size());
    assertEquals(t1, beans.get("t1"));
    assertEquals(t2, beans.get("t2"));
    assertEquals(t3.getObject(), beans.get("t3"));
    assertTrue(beans.get("t4") instanceof TestBean);

    beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, DummyFactory.class, true, true);
    assertEquals(2, beans.size());
    assertEquals(t3, beans.get("&t3"));
    assertEquals(t4, beans.get("&t4"));

    beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, FactoryBean.class, true, true);
    assertEquals(2, beans.size());
    assertEquals(t3, beans.get("&t3"));
    assertEquals(t4, beans.get("&t4"));
}