summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-09 21:49:19 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-09 21:49:19 +0300
commit98a934554a8a88e0b64e9bc4069ee2af82286efa (patch)
treeac4b33db2fb8f3f194d473c13e611ddab4ef807a /uitest
parent65de3244f6f263a59492d32085057e895f68d1a8 (diff)
downloadvaadin-framework-98a934554a8a88e0b64e9bc4069ee2af82286efa.tar.gz
vaadin-framework-98a934554a8a88e0b64e9bc4069ee2af82286efa.zip
Allow storing values in VaadinSession (#9514)
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.html31
-rw-r--r--uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.java55
2 files changed, 86 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.html b/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.html
new file mode 100644
index 0000000000..e03027f308
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.html
@@ -0,0 +1,31 @@
+<?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>/run/com.vaadin.tests.application.VaadinSessionAttribute?restartApplication&amp;attachMainFirst</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestsapplicationVaadinSessionAttribute::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>//body/div[2]</td>
+ <td>42 &amp; 84</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.java b/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.java
new file mode 100644
index 0000000000..ad48ef05ad
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.java
@@ -0,0 +1,55 @@
+/*
+ * 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.application;
+
+import com.vaadin.server.WrappedRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Notification;
+
+public class VaadinSessionAttribute extends AbstractTestUI {
+
+ private static final String ATTR_NAME = "myAttribute";
+
+ @Override
+ protected void setup(WrappedRequest request) {
+ getSession().setAttribute(ATTR_NAME, Integer.valueOf(42));
+ getSession().setAttribute(Integer.class, Integer.valueOf(42 * 2));
+
+ addComponent(new Button("Show attribute values",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Notification.show(getSession().getAttribute(ATTR_NAME)
+ + " & "
+ + getSession().getAttribute(Integer.class));
+ }
+ }));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Test to verify that session attributes are saved between requests.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(9514);
+ }
+
+}