diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-03-08 16:59:04 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-03-11 12:53:31 +0200 |
commit | 3e83aa8b8bb61690ecf4d54a5e816c06b1c80709 (patch) | |
tree | 05713bcaa7db6436c1ec053cc8eca0d597c6570e /uitest | |
parent | 6c3224ea3846c00efa621abd8134438bc9790837 (diff) | |
download | vaadin-framework-3e83aa8b8bb61690ecf4d54a5e816c06b1c80709.tar.gz vaadin-framework-3e83aa8b8bb61690ecf4d54a5e816c06b1c80709.zip |
Properly recognize class of redefined UI connector (#10867)
Change-Id: I8e3afbd669123a846214c3bd65bf696aa2b5a536
Diffstat (limited to 'uitest')
5 files changed, 139 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/ui/CustomUITest.html b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.html new file mode 100644 index 0000000000..90f7df44d2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.html @@ -0,0 +1,27 @@ +<?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.components.ui.CustomUITest?restartApplication&debug=</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//span</td> + <td>This is the CustomUIConnector</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java new file mode 100644 index 0000000000..3542806a92 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java @@ -0,0 +1,43 @@ +/* + * Copyright 2000-2013 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.components.ui; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; +import com.vaadin.tests.widgetset.client.CustomUIConnectorRpc; + +@Widgetset(TestingWidgetSet.NAME) +public class CustomUITest extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + getRpcProxy(CustomUIConnectorRpc.class).test(); + } + + @Override + protected String getTestDescription() { + return "It should be possible to change the implementation of the UIConnector class"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(10867); + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml index c127d3bb21..919a4a5d69 100644 --- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml +++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml @@ -3,4 +3,9 @@ <!-- Inherit the DefaultWidgetSet --> <inherits name="com.vaadin.DefaultWidgetSet" /> + + <replace-with class="com.vaadin.tests.widgetset.client.CustomUIConnector"> + <when-type-is class="com.vaadin.client.ui.ui.UIConnector" /> + </replace-with> + </module> diff --git a/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java new file mode 100644 index 0000000000..ddf6763f1b --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnector.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2013 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.widgetset.client; + +import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.SpanElement; +import com.vaadin.client.Util; +import com.vaadin.client.ui.ui.UIConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.ui.UI; + +@Connect(UI.class) +public class CustomUIConnector extends UIConnector { + @Override + protected void init() { + super.init(); + registerRpc(CustomUIConnectorRpc.class, new CustomUIConnectorRpc() { + @Override + public void test() { + SpanElement span = Document.get().createSpanElement(); + span.setInnerText("This is the " + + Util.getSimpleName(CustomUIConnector.this)); + Document.get().getBody().insertFirst(span); + } + }); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnectorRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnectorRpc.java new file mode 100644 index 0000000000..217d906137 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/CustomUIConnectorRpc.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2013 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.widgetset.client; + +import com.vaadin.shared.communication.ClientRpc; + +public interface CustomUIConnectorRpc extends ClientRpc { + public void test(); +} |