use of org.eclipse.scout.rt.platform.BeanMetaData in project scout.rt by eclipse.
the class ClientSessionTest method testStopWithBlockingClientCallback.
@Test
public void testStopWithBlockingClientCallback() throws Exception {
TestingUtility.registerBean(new BeanMetaData(TestEnvironmentClientSession.class));
TestingUtility.registerBean(new BeanMetaData(JobCompletionDelayOnSessionShutdown.class).withProducer(new IBeanInstanceProducer<JobCompletionDelayOnSessionShutdown>() {
@Override
public JobCompletionDelayOnSessionShutdown produce(IBean<JobCompletionDelayOnSessionShutdown> bean) {
return new JobCompletionDelayOnSessionShutdown() {
@Override
protected Long getDefaultValue() {
return 1000L;
}
};
}
}));
session = BEANS.get(ClientSessionProvider.class).provide(ClientRunContexts.empty().withUserAgent(UserAgents.createDefault()));
// request a geo location
Future<Coordinates> geo = ModelJobs.schedule(new Callable<Future<Coordinates>>() {
@Override
public Future<Coordinates> call() throws Exception {
return IDesktop.CURRENT.get().requestGeolocation();
}
}, ModelJobs.newInput(ClientRunContexts.empty().withSession(session, true))).awaitDoneAndGet();
assertFalse(geo.isDone());
// close from ui
ModelJobs.schedule(new IRunnable() {
@Override
public void run() throws Exception {
session.getDesktop().getUIFacade().closeFromUI(true);
}
}, ModelJobs.newInput(ClientRunContexts.empty().withSession(session, true))).awaitDone();
assertTrue(geo.isCancelled());
}
use of org.eclipse.scout.rt.platform.BeanMetaData in project scout.rt by eclipse.
the class FileUtilityMimeTypeTest method before.
@Before
public void before() {
ServletContext servletContext = Mockito.mock(ServletContext.class);
Mockito.when(servletContext.getMimeType("file.xml")).thenReturn("application/xml");
Mockito.when(servletContext.getMimeType("file.XML")).thenReturn("application/xml");
Mockito.when(servletContext.getMimeType("file.m4v")).thenReturn("video/mp4");
beans.add(TestingUtility.registerBean(new BeanMetaData(ServletContext.class, servletContext).withApplicationScoped(true)));
}
use of org.eclipse.scout.rt.platform.BeanMetaData in project scout.rt by eclipse.
the class BinaryServiceTunnelContentHandlerTest 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));
}
}
use of org.eclipse.scout.rt.platform.BeanMetaData 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));
}
}
use of org.eclipse.scout.rt.platform.BeanMetaData 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));
}
Aggregations