Search in sources :

Example 6 with IBeanManager

use of org.eclipse.scout.rt.platform.IBeanManager in project scout.rt by eclipse.

the class SoapServiceTunnelContentHandlerTest method after.

@After
public void after() {
    TestingUtility.unregisterBean(m_serviceReg);
    IBeanManager beanManager = BEANS.getBeanManager();
    // restore
    for (IBean<?> bean : m_oldBeans) {
        beanManager.registerBean(new BeanMetaData(bean));
    }
}
Also used : BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) IBeanManager(org.eclipse.scout.rt.platform.IBeanManager) After(org.junit.After)

Example 7 with IBeanManager

use of org.eclipse.scout.rt.platform.IBeanManager in project scout.rt by eclipse.

the class NotificationHandlerRegistryTest method ensureHandlerRegistryRefreshed.

private void ensureHandlerRegistryRefreshed() {
    IBeanManager beanManager = BEANS.getBeanManager();
    IBean<NotificationHandlerRegistry> bean = beanManager.getBean(NotificationHandlerRegistry.class);
    beanManager.unregisterBean(bean);
    beanManager.registerBean(new BeanMetaData(bean));
}
Also used : BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) IBeanManager(org.eclipse.scout.rt.platform.IBeanManager)

Example 8 with IBeanManager

use of org.eclipse.scout.rt.platform.IBeanManager in project scout.rt by eclipse.

the class CodeTypeRegistrator method stateChanged.

@Override
public void stateChanged(PlatformEvent e) {
    if (e.getState() == IPlatform.State.BeanManagerPrepared) {
        IBeanManager beanManager = e.getSource().getBeanManager();
        Set<Class<? extends ICodeType<?, ?>>> classes = BEANS.get(CodeTypeClassInventory.class).getClasses();
        for (Class<? extends ICodeType<?, ?>> c : classes) {
            LOG.debug("Register {}", c.getName());
            beanManager.registerBean(new BeanMetaData(c).withProducer(new CodeTypeProducer()));
        }
        LOG.info("{} code type classes registered.", classes.size());
    }
}
Also used : BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) IBeanManager(org.eclipse.scout.rt.platform.IBeanManager)

Example 9 with IBeanManager

use of org.eclipse.scout.rt.platform.IBeanManager in project scout.rt by eclipse.

the class NotificationDispatcherTest method before.

@Before
public void before() throws Exception {
    m_globalNotificationHanlder = mock(GlobalNotificationHandler.class);
    m_groupNotificationHanlder = mock(GroupNotificationHandler.class);
    m_serviceReg = TestingUtility.registerBeans(new BeanMetaData(GlobalNotificationHandler.class).withInitialInstance(m_globalNotificationHanlder).withApplicationScoped(true), new BeanMetaData(GroupNotificationHandler.class).withInitialInstance(m_groupNotificationHanlder).withApplicationScoped(true));
    // ensure bean hander cache of notification dispatcher gets refreshed
    IBeanManager beanManager = BEANS.getBeanManager();
    IBean<NotificationHandlerRegistry> bean = beanManager.getBean(NotificationHandlerRegistry.class);
    beanManager.unregisterBean(bean);
    beanManager.registerBean(new BeanMetaData(bean));
}
Also used : NotificationHandlerRegistry(org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry) BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) IBeanManager(org.eclipse.scout.rt.platform.IBeanManager) Before(org.junit.Before)

Example 10 with IBeanManager

use of org.eclipse.scout.rt.platform.IBeanManager in project scout.rt by eclipse.

the class RunContextChainInterceptorTest method unregisterInterceptor.

@After
public void unregisterInterceptor() {
    IBeanManager manager = BEANS.getBeanManager();
    for (IBean<?> bean : m_registeredBeans) {
        manager.unregisterBean(bean);
    }
    BEANS.get(RunContextChainIntercepterRegistry.class).reindex();
}
Also used : IBeanManager(org.eclipse.scout.rt.platform.IBeanManager) After(org.junit.After)

Aggregations

IBeanManager (org.eclipse.scout.rt.platform.IBeanManager)11 BeanMetaData (org.eclipse.scout.rt.platform.BeanMetaData)6 After (org.junit.After)6 RunContextChainIntercepterRegistry (org.eclipse.scout.rt.platform.context.RunContextChainIntercepterRegistry)2 NotificationHandlerRegistry (org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry)2 IBean (org.eclipse.scout.rt.platform.IBean)1 IClassInventory (org.eclipse.scout.rt.platform.inventory.IClassInventory)1 Before (org.junit.Before)1