diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-09-21 16:51:20 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-09-21 16:51:20 +0300 |
commit | fb8cf5cb457f6fe95bd3b07d2fb1a1fb03a3be8f (patch) | |
tree | 60fba1a290003fb9c1d381222d5e83c8d250c170 /uitest | |
parent | 167ff2bcea28bb5ad4a9ccba4f2b5b9819371390 (diff) | |
download | vaadin-framework-fb8cf5cb457f6fe95bd3b07d2fb1a1fb03a3be8f.tar.gz vaadin-framework-fb8cf5cb457f6fe95bd3b07d2fb1a1fb03a3be8f.zip |
Allow specifying UIProvider using a servlet parameter (#9628)
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java | 36 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameter.html | 39 |
2 files changed, 75 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java b/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java new file mode 100644 index 0000000000..6a2f5c500b --- /dev/null +++ b/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java @@ -0,0 +1,36 @@ +/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.applicationservlet; + +import com.vaadin.server.UIProvider; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.javascriptcomponent.BasicJavaScriptComponent; +import com.vaadin.ui.UI; + +public class InitParamUIProvider extends UIProvider { + + @Override + public Class<? extends UI> getUIClass(VaadinRequest request) { + String pathInfo = request.getRequestPathInfo(); + if ("/test".equals(pathInfo)) { + return BasicJavaScriptComponent.class; + } else { + return null; + } + } + +} diff --git a/uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameter.html b/uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameter.html new file mode 100644 index 0000000000..8a5f89cbad --- /dev/null +++ b/uitest/src/com/vaadin/tests/applicationservlet/UIProviderInitParameter.html @@ -0,0 +1,39 @@ +<?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="" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/uiprovider</td> + <td></td> +</tr> +<!--Test that UI parameter is used by default--> +<tr> + <td>assertText</td> + <td>vaadin=uiprovider::/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> + <td>Tests whether the testing server is run with assertions enabled.</td> +</tr> +<!--Test that UIProvider parameter is more important than UI parameter--> +<tr> + <td>open</td> + <td>/uiprovider/test</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=uiprovider::/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> + <td>Test for basic JavaScript component functionality.</td> +</tr> + +</tbody></table> +</body> +</html> |