diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-08-17 13:12:51 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-08-17 13:12:51 +0300 |
commit | 8e3aa0a9823556896f1af00599c3e79ca2ce2e01 (patch) | |
tree | 93ee8856d280e7a17d0e65961652ad7e4b20b95b /tests | |
parent | b52fbdfc7f03d83b521cc969acae906b669cd64c (diff) | |
download | vaadin-framework-8e3aa0a9823556896f1af00599c3e79ca2ce2e01.tar.gz vaadin-framework-8e3aa0a9823556896f1af00599c3e79ca2ce2e01.zip |
Pass whole DeploymentConfiguration to ApplicationStartEvent and Application; add accessors to supported servlet init params to DeploymentConfiguration; move init param checks and validation to AbstractDeploymentConfiguration (#9340,#9341)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/server-side/com/vaadin/tests/server/TransactionListenersConcurrency.java | 24 | ||||
-rw-r--r-- | tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java | 23 |
2 files changed, 34 insertions, 13 deletions
diff --git a/tests/server-side/com/vaadin/tests/server/TransactionListenersConcurrency.java b/tests/server-side/com/vaadin/tests/server/TransactionListenersConcurrency.java index b567617fdd..f7ac55b6da 100644 --- a/tests/server-side/com/vaadin/tests/server/TransactionListenersConcurrency.java +++ b/tests/server-side/com/vaadin/tests/server/TransactionListenersConcurrency.java @@ -17,14 +17,15 @@ import javax.servlet.http.HttpSession; import junit.framework.TestCase; -import org.easymock.EasyMock; - import com.vaadin.Application; import com.vaadin.Application.ApplicationStartEvent; import com.vaadin.service.ApplicationContext.TransactionListener; +import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.gwt.server.AbstractWebApplicationContext; import com.vaadin.terminal.gwt.server.WebApplicationContext; +import org.easymock.EasyMock; + public class TransactionListenersConcurrency extends TestCase { /** @@ -71,10 +72,15 @@ public class TransactionListenersConcurrency extends TestCase { // Start the application so the transaction listener is // called later on. try { + DeploymentConfiguration dc = EasyMock + .createMock(DeploymentConfiguration.class); + EasyMock.expect(dc.isProductionMode()).andReturn(true); + EasyMock.expect(dc.getInitParameters()).andReturn( + new Properties()); + EasyMock.replay(dc); app.start(new ApplicationStartEvent(new URL( - "http://localhost/"), new Properties(), - context, true)); + "http://localhost/"), dc, context)); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -101,7 +107,9 @@ public class TransactionListenersConcurrency extends TestCase { @Override public void uncaughtException(Thread t, Throwable e) { - e = e.getCause(); + if (e.getCause() != null) { + e = e.getCause(); + } exceptions.add(e); } }); @@ -127,8 +135,10 @@ public class TransactionListenersConcurrency extends TestCase { if (t instanceof InvocationTargetException) { t = t.getCause(); } - t.printStackTrace(System.err); - fail(t.getClass().getName()); + if (t != null) { + t.printStackTrace(System.err); + fail(t.getClass().getName()); + } } System.out.println("Done, all ok"); diff --git a/tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java b/tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java index aa9753ebcc..fa730515a2 100644 --- a/tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java +++ b/tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java @@ -6,8 +6,6 @@ import java.util.Properties; import junit.framework.TestCase; -import org.easymock.EasyMock; - import com.vaadin.Application; import com.vaadin.Application.ApplicationStartEvent; import com.vaadin.RootRequiresMoreInformationException; @@ -15,6 +13,8 @@ import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.WrappedRequest; import com.vaadin.ui.Root; +import org.easymock.EasyMock; + public class CustomRootClassLoader extends TestCase { /** @@ -52,13 +52,24 @@ public class CustomRootClassLoader extends TestCase { */ public void testWithNullClassLoader() throws Exception { Application application = createStubApplication(); - application.start(new ApplicationStartEvent(null, new Properties(), - null, false)); + application.start(new ApplicationStartEvent(null, + createConfigurationMock(), null)); Root root = application.getRootForRequest(createRequestMock(null)); assertTrue(root instanceof MyRoot); } + private static DeploymentConfiguration createConfigurationMock() { + DeploymentConfiguration configurationMock = EasyMock + .createMock(DeploymentConfiguration.class); + EasyMock.expect(configurationMock.isProductionMode()).andReturn(false); + EasyMock.expect(configurationMock.getInitParameters()).andReturn( + new Properties()); + + EasyMock.replay(configurationMock); + return configurationMock; + } + private static WrappedRequest createRequestMock(ClassLoader classloader) { // Mock a DeploymentConfiguration to give the passed classloader DeploymentConfiguration configurationMock = EasyMock @@ -86,8 +97,8 @@ public class CustomRootClassLoader extends TestCase { LoggingClassLoader loggingClassLoader = new LoggingClassLoader(); Application application = createStubApplication(); - application.start(new ApplicationStartEvent(null, new Properties(), - null, false)); + application.start(new ApplicationStartEvent(null, + createConfigurationMock(), null)); Root root = application .getRootForRequest(createRequestMock(loggingClassLoader)); |