From c71563c8a6e9993cbbdff3ddfdfccfee4aa34f7b Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 4 Sep 2012 16:48:13 +0300 Subject: Extract ApplicationConfiguration from DeploymentConfiguration (#9382) --- ...tractApplicationServletStaticFilesLocation.java | 4 +++- .../server/component/root/CustomUIClassLoader.java | 24 ++++++++-------------- 2 files changed, 12 insertions(+), 16 deletions(-) (limited to 'server/tests') diff --git a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java index b936cae1a5..2aa8d04364 100644 --- a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java +++ b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java @@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletRequest; import junit.framework.TestCase; +import com.vaadin.DefaultApplicationConfiguration; import com.vaadin.server.VaadinServlet.ServletDeploymentConfiguration; public class TestAbstractApplicationServletStaticFilesLocation extends TestCase { @@ -32,7 +33,8 @@ public class TestAbstractApplicationServletStaticFilesLocation extends TestCase .getDeclaredField("deploymentConfiguration"); f.setAccessible(true); f.set(servlet, new ServletDeploymentConfiguration(servlet, - new Properties())); + new DefaultApplicationConfiguration(servlet.getClass(), + new Properties()))); } diff --git a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java index 89da55a31f..aef35084f8 100644 --- a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java +++ b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java @@ -10,6 +10,8 @@ import org.easymock.EasyMock; import com.vaadin.Application; import com.vaadin.Application.ApplicationStartEvent; +import com.vaadin.DefaultApplicationConfiguration; +import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.DefaultUIProvider; import com.vaadin.server.DeploymentConfiguration; import com.vaadin.server.WrappedRequest; @@ -62,15 +64,11 @@ public class CustomUIClassLoader extends TestCase { assertEquals(MyUI.class, uiClass); } - 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 ApplicationConfiguration createConfigurationMock() { + Properties properties = new Properties(); + properties.put(Application.UI_PARAMETER, MyUI.class.getName()); + return new DefaultApplicationConfiguration(CustomUIClassLoader.class, + properties); } private static WrappedRequest createRequestMock(ClassLoader classloader) { @@ -117,12 +115,8 @@ public class CustomUIClassLoader extends TestCase { private Application createStubApplication() { return new Application() { @Override - public String getProperty(String name) { - if (name.equals(UI_PARAMETER)) { - return MyUI.class.getName(); - } else { - return super.getProperty(name); - } + public ApplicationConfiguration getConfiguration() { + return createConfigurationMock(); } }; } -- cgit v1.2.3