diff options
author | John Ahlroos <john@vaadin.com> | 2012-09-03 14:18:16 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2012-09-03 14:18:16 +0300 |
commit | b6e762dc8408b607568919f518ab2e2f74df7010 (patch) | |
tree | b6ccf5b5cb1225d6744f20b0292880cd094bbcf1 /uitest | |
parent | 1bc93daa34b1094f41cf19f20342c94c4e423244 (diff) | |
parent | ae2c302f71554f49b3f57b649cec7450c652cf09 (diff) | |
download | vaadin-framework-b6e762dc8408b607568919f518ab2e2f74df7010.tar.gz vaadin-framework-b6e762dc8408b607568919f518ab2e2f74df7010.zip |
Merge branch 'master' into layoutgraph
Diffstat (limited to 'uitest')
12 files changed, 75 insertions, 58 deletions
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index bceecaf35a..bbe6e061fb 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.vaadin.Application; -import com.vaadin.server.AbstractApplicationServlet; +import com.vaadin.server.VaadinServlet; import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.WrappedHttpServletRequest; import com.vaadin.server.WrappedRequest; @@ -38,7 +38,7 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.UI; @SuppressWarnings("serial") -public class ApplicationRunnerServlet extends AbstractApplicationServlet { +public class ApplicationRunnerServlet extends VaadinServlet { /** * The name of the application class currently used. Only valid within one @@ -209,20 +209,6 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet { return uris; } - @Override - protected Class<? extends Application> getApplicationClass() - throws ClassNotFoundException { - Class<?> classToRun = getClassToRun(); - if (UI.class.isAssignableFrom(classToRun)) { - return Application.class; - } else if (Application.class.isAssignableFrom(classToRun)) { - return classToRun.asSubclass(Application.class); - } else { - throw new ClassCastException(classToRun.getCanonicalName() - + " is not an Application nor a UI"); - } - } - private Class<?> getClassToRun() throws ClassNotFoundException { // TODO use getClassLoader() ? diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java index 8a07168ef7..f4cf236a24 100644 --- a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java +++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java @@ -1,6 +1,6 @@ package com.vaadin.tests; -import com.vaadin.server.WebApplicationContext; +import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Label; @@ -9,7 +9,7 @@ public class VerifyBrowserVersion extends TestBase { @Override protected void setup() { - WebApplicationContext context = (WebApplicationContext) getContext(); + ApplicationContext context = getContext(); WebBrowser browser = context.getBrowser(); addComponent(new Label(browser.getBrowserApplication())); addComponent(new Label("Touch device? " diff --git a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java index 233da9722e..1f5f0dc691 100644 --- a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java +++ b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java @@ -1,7 +1,6 @@ package com.vaadin.tests.application; import com.vaadin.Application; -import com.vaadin.server.WebApplicationContext; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; @@ -16,8 +15,7 @@ public class ApplicationCloseTest extends TestBase { protected void setup() { Label applications = new Label("Applications in session: <br/>", ContentMode.XHTML); - for (Application a : ((WebApplicationContext) getContext()) - .getApplications()) { + for (Application a : getContext().getApplications()) { applications.setValue(applications.getValue() + "App: " + a + "<br/>"); } diff --git a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java index 9146cf5dea..96ebe1345f 100644 --- a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java +++ b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java @@ -1,6 +1,6 @@ package com.vaadin.tests.applicationcontext; -import com.vaadin.server.WebApplicationContext; +import com.vaadin.server.ServletApplicationContext; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; @@ -32,7 +32,7 @@ public class ChangeSessionId extends AbstractTestCase { loginButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { - WebApplicationContext context = ((WebApplicationContext) getContext()); + ServletApplicationContext context = ((ServletApplicationContext) getContext()); String oldSessionId = context.getHttpSession().getId(); context.reinitializeSession(); @@ -55,7 +55,7 @@ public class ChangeSessionId extends AbstractTestCase { } protected String getSessionId() { - return ((WebApplicationContext) getContext()).getHttpSession().getId(); + return ((ServletApplicationContext) getContext()).getHttpSession().getId(); } @Override diff --git a/uitest/src/com/vaadin/tests/applicationcontext/RemoveTransactionListener.java b/uitest/src/com/vaadin/tests/applicationcontext/RemoveTransactionListener.java index f1730ed5f5..5927e9c19f 100644 --- a/uitest/src/com/vaadin/tests/applicationcontext/RemoveTransactionListener.java +++ b/uitest/src/com/vaadin/tests/applicationcontext/RemoveTransactionListener.java @@ -1,8 +1,8 @@ package com.vaadin.tests.applicationcontext; import com.vaadin.Application; -import com.vaadin.service.ApplicationContext; -import com.vaadin.service.ApplicationContext.TransactionListener; +import com.vaadin.server.ApplicationContext; +import com.vaadin.server.ApplicationContext.TransactionListener; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestApplication.java b/uitest/src/com/vaadin/tests/components/AbstractTestApplication.java index 406158e8e1..db17c67fdd 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestApplication.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestApplication.java @@ -1,9 +1,8 @@ package com.vaadin.tests.components; import com.vaadin.Application; -import com.vaadin.server.AbstractWebApplicationContext; +import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; -import com.vaadin.service.ApplicationContext; public abstract class AbstractTestApplication extends Application { protected abstract String getTestDescription(); @@ -12,12 +11,7 @@ public abstract class AbstractTestApplication extends Application { protected WebBrowser getBrowser() { ApplicationContext context = getContext(); - if (context instanceof AbstractWebApplicationContext) { - WebBrowser webBrowser = ((AbstractWebApplicationContext) context) - .getBrowser(); - return webBrowser; - } - - return null; + WebBrowser webBrowser = context.getBrowser(); + return webBrowser; } } diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java index 4e2ec1d935..f51c74d4a8 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java @@ -1,9 +1,8 @@ package com.vaadin.tests.components; import com.vaadin.Application; -import com.vaadin.server.AbstractWebApplicationContext; +import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; -import com.vaadin.service.ApplicationContext; public abstract class AbstractTestCase extends Application.LegacyApplication { @@ -13,12 +12,8 @@ public abstract class AbstractTestCase extends Application.LegacyApplication { protected WebBrowser getBrowser() { ApplicationContext context = getContext(); - if (context instanceof AbstractWebApplicationContext) { - WebBrowser webBrowser = ((AbstractWebApplicationContext) context) - .getBrowser(); - return webBrowser; - } + WebBrowser webBrowser = context.getBrowser(); + return webBrowser; - return null; } } diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java index ff235c5d9f..21eda56891 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java @@ -1,10 +1,9 @@ package com.vaadin.tests.components; import com.vaadin.Application; -import com.vaadin.server.AbstractWebApplicationContext; +import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; import com.vaadin.server.WrappedRequest; -import com.vaadin.service.ApplicationContext; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Component; import com.vaadin.ui.Label; @@ -58,12 +57,8 @@ public abstract class AbstractTestUI extends UI { protected WebBrowser getBrowser() { ApplicationContext context = Application.getCurrent().getContext(); - if (context instanceof AbstractWebApplicationContext) { - AbstractWebApplicationContext webContext = (AbstractWebApplicationContext) context; - return webContext.getBrowser(); - } - - return null; + ApplicationContext webContext = context; + return webContext.getBrowser(); } } diff --git a/uitest/src/com/vaadin/tests/components/panel/PanelConcurrentModificationException.java b/uitest/src/com/vaadin/tests/components/panel/PanelConcurrentModificationException.java new file mode 100644 index 0000000000..9235eb3cfc --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/panel/PanelConcurrentModificationException.java @@ -0,0 +1,46 @@ +package com.vaadin.tests.components.panel; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.ComponentContainer; +import com.vaadin.ui.Label; +import com.vaadin.ui.Notification; +import com.vaadin.ui.Panel; + +public class PanelConcurrentModificationException extends TestBase { + + private final ComponentContainer panel = new Panel(); + + @Override + protected void setup() { + addComponent(new Button("Click here for exception", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + panel.addComponent(new Label("Label")); + } + })); + addComponent(new Button("Or click here first", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + Notification + .show("It is now safe to click the other button"); + } + })); + addComponent(panel); + } + + @Override + protected String getDescription() { + return "Modifying Panel content causes Internal Error (ConcurrentModificationException)"; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1673.java b/uitest/src/com/vaadin/tests/tickets/Ticket1673.java index 99f213541a..bf95001464 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1673.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1673.java @@ -1,6 +1,7 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.server.CustomizedSystemMessages; +import com.vaadin.server.SystemMessages; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; @@ -22,8 +23,8 @@ public class Ticket1673 extends com.vaadin.Application.LegacyApplication { } - public static Application.SystemMessages getSystemMessages() { - Application.CustomizedSystemMessages msgs = new Application.CustomizedSystemMessages(); + public static SystemMessages getSystemMessages() { + CustomizedSystemMessages msgs = new CustomizedSystemMessages(); msgs.setSessionExpiredURL("http://www.vaadin.com/"); msgs.setSessionExpiredCaption("Foo"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java index 9c6dd8c272..e85fe294f2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java @@ -5,7 +5,7 @@ import java.io.File; import java.io.FileInputStream; import com.vaadin.Application; -import com.vaadin.server.WebApplicationContext; +import com.vaadin.server.ServletApplicationContext; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -33,7 +33,7 @@ public class Ticket1975 extends Application.LegacyApplication { try { cl1 = new CustomLayout(new ByteArrayInputStream(s.getBytes())); layout.addComponent(cl1); - WebApplicationContext wc = ((WebApplicationContext) getContext()); + ServletApplicationContext wc = ((ServletApplicationContext) getContext()); layout.addComponent(new Button("Disable/Enable", new ClickListener() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2106.java b/uitest/src/com/vaadin/tests/tickets/Ticket2106.java index 9d6e198f03..a57a20cdc3 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2106.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2106.java @@ -3,6 +3,8 @@ package com.vaadin.tests.tickets; import java.util.Date; import com.vaadin.Application; +import com.vaadin.server.CustomizedSystemMessages; +import com.vaadin.server.SystemMessages; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @@ -10,7 +12,7 @@ import com.vaadin.ui.UI.LegacyWindow; public class Ticket2106 extends Application.LegacyApplication { - private static CustomizedSystemMessages msgs = new Application.CustomizedSystemMessages(); + private static CustomizedSystemMessages msgs = new CustomizedSystemMessages(); static { // We will forward the user to www.vaadin.com when the session expires msgs.setSessionExpiredURL("http://www.vaadin.com"); @@ -18,7 +20,7 @@ public class Ticket2106 extends Application.LegacyApplication { msgs.setSessionExpiredCaption(null); } - public static Application.SystemMessages getSystemMessages() { + public static SystemMessages getSystemMessages() { return msgs; } |