From 780d076d81a35d640fbaedd134635e8216040d28 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Thu, 18 Oct 2012 11:51:00 +0300 Subject: Properly read heartbeat interval servlet parameter (#9987) * Test that servlet parameters in general are read correctly Change-Id: I4a015070e5ce03cff0fee10e037b4df2c3df8219 --- WebContent/WEB-INF/web.xml | 17 ++++++++ .../com/vaadin/DefaultDeploymentConfiguration.java | 2 +- server/src/com/vaadin/server/Constants.java | 2 +- .../application/DeploymentConfigurationTest.html | 47 ++++++++++++++++++++++ .../application/DeploymentConfigurationTest.java | 20 +++++++++ 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html create mode 100644 uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.java diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index e8ac6b7797..46ace4520b 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -49,6 +49,23 @@ + + + heartbeatInterval + 301 + + + resourceCacheTime + 3601 + + + closeIdleUIs + true + + + testParam + 42 + VaadinApplicationRunner com.vaadin.launcher.ApplicationRunnerServlet diff --git a/server/src/com/vaadin/DefaultDeploymentConfiguration.java b/server/src/com/vaadin/DefaultDeploymentConfiguration.java index fed558c5b5..a9818f2c8b 100644 --- a/server/src/com/vaadin/DefaultDeploymentConfiguration.java +++ b/server/src/com/vaadin/DefaultDeploymentConfiguration.java @@ -219,7 +219,7 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration { try { heartbeatInterval = Integer .parseInt(getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_HEARTBEAT_RATE, "300")); + Constants.SERVLET_PARAMETER_HEARTBEAT_INTERVAL, "300")); } catch (NumberFormatException e) { getLogger().warning( Constants.WARNING_HEARTBEAT_INTERVAL_NOT_NUMERIC); diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java index 60f7aa03d0..b6bfcc0495 100644 --- a/server/src/com/vaadin/server/Constants.java +++ b/server/src/com/vaadin/server/Constants.java @@ -61,7 +61,7 @@ public interface Constants { static final String SERVLET_PARAMETER_PRODUCTION_MODE = "productionMode"; static final String SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION = "disable-xsrf-protection"; static final String SERVLET_PARAMETER_RESOURCE_CACHE_TIME = "resourceCacheTime"; - static final String SERVLET_PARAMETER_HEARTBEAT_RATE = "heartbeatRate"; + static final String SERVLET_PARAMETER_HEARTBEAT_INTERVAL = "heartbeatInterval"; static final String SERVLET_PARAMETER_CLOSE_IDLE_UIS = "closeIdleUIs"; static final String SERVLET_PARAMETER_UI_PROVIDER = "UIProvider"; diff --git a/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html b/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html new file mode 100644 index 0000000000..f5ad0987aa --- /dev/null +++ b/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html @@ -0,0 +1,47 @@ + + + + + + +DeploymentConfigurationTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DeploymentConfigurationTest
open/run/com.vaadin.tests.application.DeploymentConfigurationTest?restartApplication
assertTextPresentexact:closeIdleUIs: true
assertTextPresentexact:productionMode: false
assertTextPresentexact:testParam: 42
assertTextPresentexact:heartbeatInterval: 301
assertTextPresentexact:resourceCacheTime: 3601
+ + diff --git a/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.java b/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.java new file mode 100644 index 0000000000..9c89254bd7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.java @@ -0,0 +1,20 @@ +package com.vaadin.tests.application; + +import java.util.Properties; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Label; +import com.vaadin.ui.UI; + +public class DeploymentConfigurationTest extends UI { + + @Override + protected void init(VaadinRequest request) { + Properties params = getSession().getConfiguration().getInitParameters(); + + for (Object key : params.keySet()) { + addComponent(new Label(key + ": " + + params.getProperty((String) key))); + } + } +} -- cgit v1.2.3