diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-10-18 11:51:00 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-10-18 12:21:44 +0300 |
commit | 780d076d81a35d640fbaedd134635e8216040d28 (patch) | |
tree | 88dae066606a13c63223d21c045ff4334f9ff4c7 | |
parent | 90ffa9404fbb458ffbd1a26930811fcea6037d97 (diff) | |
download | vaadin-framework-780d076d81a35d640fbaedd134635e8216040d28.tar.gz vaadin-framework-780d076d81a35d640fbaedd134635e8216040d28.zip |
Properly read heartbeat interval servlet parameter (#9987)
* Test that servlet parameters in general are read correctly
Change-Id: I4a015070e5ce03cff0fee10e037b4df2c3df8219
5 files changed, 86 insertions, 2 deletions
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 @@ </servlet> <servlet> + <!-- Non-default values for testing purposes --> + <init-param> + <param-name>heartbeatInterval</param-name> + <param-value>301</param-value> + </init-param> + <init-param> + <param-name>resourceCacheTime</param-name> + <param-value>3601</param-value> + </init-param> + <init-param> + <param-name>closeIdleUIs</param-name> + <param-value>true</param-value> + </init-param> + <init-param> + <param-name>testParam</param-name> + <param-value>42</param-value> + </init-param> <servlet-name>VaadinApplicationRunner</servlet-name> <servlet-class>com.vaadin.launcher.ApplicationRunnerServlet</servlet-class> </servlet> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8070/" /> +<title>DeploymentConfigurationTest</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">DeploymentConfigurationTest</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.application.DeploymentConfigurationTest?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>exact:closeIdleUIs: true</td> + <td></td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>exact:productionMode: false</td> + <td></td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>exact:testParam: 42</td> + <td></td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>exact:heartbeatInterval: 301</td> + <td></td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>exact:resourceCacheTime: 3601</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> 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))); + } + } +} |