diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-09-05 17:10:31 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-09-05 17:10:31 +0300 |
commit | 5ab35cc6080653a7e9b25712f637db6c95c183ce (patch) | |
tree | d6fd4f845e96b5dd9c0e697aa9ff7683ec5742c8 /uitest | |
parent | 3ddaf280d61642742dff3f4a63376d0eedca5abf (diff) | |
download | vaadin-framework-5ab35cc6080653a7e9b25712f637db6c95c183ce.tar.gz vaadin-framework-5ab35cc6080653a7e9b25712f637db6c95c183ce.zip |
Combine ApplicationContext into Application (#9402)
Diffstat (limited to 'uitest')
6 files changed, 12 insertions, 20 deletions
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index a9a988f296..34c1cc1fce 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -34,6 +34,7 @@ import com.vaadin.LegacyApplication; import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.LegacyVaadinServlet; +import com.vaadin.server.ServletApplicationContext; import com.vaadin.server.UIProvider; import com.vaadin.server.WrappedHttpServletRequest; import com.vaadin.server.WrappedRequest; @@ -112,12 +113,12 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { } @Override - protected Application createApplication(HttpServletRequest request) - throws ServletException { + protected ServletApplicationContext createApplication( + HttpServletRequest request) throws ServletException { try { final Class<?> classToRun = getClassToRun(); if (UI.class.isAssignableFrom(classToRun)) { - Application application = new Application(); + ServletApplicationContext application = new ServletApplicationContext(); application.addUIProvider(new AbstractUIProvider() { @Override @@ -130,7 +131,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { } else if (LegacyApplication.class.isAssignableFrom(classToRun)) { return super.createApplication(request); } else if (UIProvider.class.isAssignableFrom(classToRun)) { - Application application = new Application(); + ServletApplicationContext application = new ServletApplicationContext(); application .addUIProvider((UIProvider) classToRun.newInstance()); return application; diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java index f4cf236a24..022a343196 100644 --- a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java +++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java @@ -1,6 +1,5 @@ package com.vaadin.tests; -import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Label; @@ -9,8 +8,7 @@ public class VerifyBrowserVersion extends TestBase { @Override protected void setup() { - ApplicationContext context = getContext(); - WebBrowser browser = context.getBrowser(); + WebBrowser browser = getBrowser(); addComponent(new Label(browser.getBrowserApplication())); addComponent(new Label("Touch device? " + (browser.isTouchDevice() ? "YES" : "No"))); diff --git a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java index f2fe90f4b1..7250ba3cfb 100644 --- a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java +++ b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java @@ -14,9 +14,9 @@ public class ApplicationCloseTest extends TestBase { protected void setup() { Label applications = new Label("Applications in session: <br/>", ContentMode.XHTML); - if (getContext().getApplication() != null) { + if (getContext() != null) { applications.setValue(applications.getValue() + "App: " - + getContext().getApplication() + "<br/>"); + + getContext() + "<br/>"); } applications.setValue(applications.getValue() + "<br/><br/>"); diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java index 6f539af016..5dc5fd7128 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java @@ -1,7 +1,7 @@ package com.vaadin.tests.components; +import com.vaadin.Application; import com.vaadin.LegacyApplication; -import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; public abstract class AbstractTestCase extends LegacyApplication { @@ -11,8 +11,7 @@ public abstract class AbstractTestCase extends LegacyApplication { protected abstract Integer getTicketNumber(); protected WebBrowser getBrowser() { - ApplicationContext context = getContext(); - WebBrowser webBrowser = context.getBrowser(); + WebBrowser webBrowser = Application.getCurrent().getBrowser(); return webBrowser; } diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java index 21eda56891..92ac336df7 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java @@ -1,7 +1,5 @@ package com.vaadin.tests.components; -import com.vaadin.Application; -import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; import com.vaadin.server.WrappedRequest; import com.vaadin.shared.ui.label.ContentMode; @@ -56,9 +54,7 @@ public abstract class AbstractTestUI extends UI { protected abstract Integer getTicketNumber(); protected WebBrowser getBrowser() { - ApplicationContext context = Application.getCurrent().getContext(); - ApplicationContext webContext = context; - return webContext.getBrowser(); + return getApplication().getBrowser(); } } diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java index 3d380c7835..4311cd6a0f 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components; import com.vaadin.Application; import com.vaadin.server.AbstractUIProvider; -import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; public abstract class AbstractTestUIProvider extends AbstractUIProvider { @@ -11,8 +10,7 @@ public abstract class AbstractTestUIProvider extends AbstractUIProvider { protected abstract Integer getTicketNumber(); protected WebBrowser getBrowser() { - ApplicationContext context = Application.getCurrent().getContext(); - WebBrowser webBrowser = context.getBrowser(); + WebBrowser webBrowser = Application.getCurrent().getBrowser(); return webBrowser; } } |