Search in sources :

Example 1 with DefaultPlatform

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

the class ClientSessionDisposeTest method testDispose.

/**
 * Test might fail when manually debugged.
 */
@Test
public void testDispose() throws Exception {
    Platform.set(new DefaultPlatform());
    Platform.get().start();
    Platform.get().awaitPlatformStarted();
    TestingUtility.registerBean(new BeanMetaData(TestEnvironmentClientSession.class));
    IClientSession session = BEANS.get(ClientSessionProvider.class).provide(ClientRunContexts.empty().withUserAgent(UserAgents.createDefault()));
    WeakReference<IClientSession> ref = new WeakReference<IClientSession>(session);
    session.stop();
    assertTrue(session.isStopping());
    session = null;
    TestingUtility.assertGC(ref);
    Platform.get().stop();
}
Also used : ClientSessionProvider(org.eclipse.scout.rt.client.session.ClientSessionProvider) BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) WeakReference(java.lang.ref.WeakReference) DefaultPlatform(org.eclipse.scout.rt.platform.DefaultPlatform) TestEnvironmentClientSession(org.eclipse.scout.rt.client.testenvironment.TestEnvironmentClientSession) Test(org.junit.Test)

Example 2 with DefaultPlatform

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

the class ClientSessionTest method before.

@Before
public void before() {
    Platform.set(new DefaultPlatform());
    Platform.get().start();
    Platform.get().awaitPlatformStarted();
}
Also used : DefaultPlatform(org.eclipse.scout.rt.platform.DefaultPlatform) Before(org.junit.Before)

Aggregations

DefaultPlatform (org.eclipse.scout.rt.platform.DefaultPlatform)2 WeakReference (java.lang.ref.WeakReference)1 ClientSessionProvider (org.eclipse.scout.rt.client.session.ClientSessionProvider)1 TestEnvironmentClientSession (org.eclipse.scout.rt.client.testenvironment.TestEnvironmentClientSession)1 BeanMetaData (org.eclipse.scout.rt.platform.BeanMetaData)1 Before (org.junit.Before)1 Test (org.junit.Test)1