<display>
<category name="Vaadin">
- <portlet id="PortletDemoPortlet" />
- <portlet id="Portlet Mode Example" />
- <portlet id="Portlet HTML Mode Example" />
+ <portlet id="JSR286TestPortlet" />
<portlet id="AddressBookPortlet" />
<portlet id="Vaadin Liferay Theme Portlet"/>
-
- <!-- These should be used together -->
- <portlet id="InterPortletEventPortlet" />
- <portlet id="VaadinInterPortletEventPortlet" />
</category>
</display>
\ No newline at end of file
<liferay-portlet-app>
<portlet>
- <portlet-name>PortletDemoPortlet</portlet-name>
- <instanceable>true</instanceable>
- <ajaxable>false</ajaxable>
- </portlet>
- <portlet>
- <portlet-name>Portlet Mode Example</portlet-name>
- <instanceable>true</instanceable>
- <ajaxable>false</ajaxable>
- </portlet>
- <portlet>
- <portlet-name>Portlet HTML Mode Example</portlet-name>
- <instanceable>true</instanceable>
+ <portlet-name>JSR286TestPortlet</portlet-name>
+ <instanceable>false</instanceable>
<ajaxable>false</ajaxable>
</portlet>
<portlet>
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
- <portlet-name>PortletDemoPortlet</portlet-name>
- <display-name>Vaadin PortletDemo</display-name>
- <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet</portlet-class>
+ <portlet-name>JSR286TestPortlet</portlet-name>
+ <display-name>Vaadin Portlet 2.0 Test</display-name>
+ <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>
<init-param>
<name>application</name>
- <value>PortletDemo</value>
+ <value>com.vaadin.tests.integration.JSR286PortletApplication</value>
</init-param>
<init-param>
<name>widgetset</name>
<portlet-mode>help</portlet-mode>
</supports>
<portlet-info>
- <title>PortletDemo</title>
- <short-title>PortletDemo</short-title>
+ <title>Vaadin Portlet 2.0 Test</title>
+ <short-title>Vaadin Portlet 2.0 Test</short-title>
</portlet-info>
<security-role-ref>
</security-role-ref>
</portlet>
- <portlet>
- <portlet-name>Portlet Mode Example</portlet-name>
- <display-name>Portlet Mode Example</display-name>
- <portlet-class>com.vaadin.demo.portlet.PortletModePortlet</portlet-class>
- <init-param>
- <name>application</name>
- <value>com.vaadin.demo.portlet.PortletModeExample</value>
- </init-param>
- <init-param>
- <name>widgetset</name>
- <value>com.vaadin.portal.gwt.PortalDefaultWidgetSet</value>
- </init-param>
-
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
- <portlet-mode>edit</portlet-mode>
- <portlet-mode>help</portlet-mode>
- <portlet-mode>config</portlet-mode>
- </supports>
- <portlet-info>
- <title>PortletModeExample</title>
- <short-title>PortletModeExample</short-title>
- </portlet-info>
-
- <security-role-ref>
- <role-name>administrator</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>guest</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>power-user</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>user</role-name>
- </security-role-ref>
- </portlet>
-
- <portlet>
- <portlet-name>Portlet HTML Mode Example</portlet-name>
- <display-name>Portlet HTML Mode Example</display-name>
- <portlet-class>com.vaadin.demo.portlet.HtmlModePortlet</portlet-class>
- <init-param>
- <name>widgetset</name>
- <value>com.vaadin.portal.gwt.PortalDefaultWidgetSet</value>
- </init-param>
-
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
- <portlet-mode>help</portlet-mode>
- </supports>
-
- <portlet-info>
- <title>Portlet HTML Mode Example</title>
- <short-title>Portlet HTML Mode Example</short-title>
- </portlet-info>
-
- <security-role-ref>
- <role-name>administrator</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>guest</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>power-user</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>user</role-name>
- </security-role-ref>
- </portlet>
-
<portlet>
<portlet-name>AddressBookPortlet</portlet-name>
<display-name>Address Book</display-name>
</security-role-ref>
</portlet>
- <!-- A Vaadin portlet and a non-Vaadin portlet that can communicate with each other -->
- <portlet>
- <portlet-name>VaadinInterPortletEventPortlet</portlet-name>
- <display-name>Hello World Event</display-name>
- <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>
- <init-param>
- <name>application</name>
- <value>com.vaadin.demo.portlet.VaadinInterPortletEventPortlet</value>
- </init-param>
- <init-param>
- <name>widgetset</name>
- <value>com.vaadin.portal.gwt.PortalDefaultWidgetSet</value>
- </init-param>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
- </supports>
- <portlet-info>
- <title>Inter-portlet events</title>
- <short-title>Inter-portlet
- events</short-title>
- </portlet-info>
- <supported-processing-event>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:Hello</qname>
- </supported-processing-event>
- <supported-processing-event>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:ReplyToVaadin</qname>
- </supported-processing-event>
- <supported-publishing-event>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:Reply</qname>
- </supported-publishing-event>
- <supported-publishing-event>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:FromVaadin</qname>
- </supported-publishing-event>
- <supported-public-render-parameter>HelloState</supported-public-render-parameter>
- </portlet>
- <portlet>
- <portlet-name>InterPortletEventPortlet</portlet-name>
- <display-name>Hello World Event (non-Vaadin)</display-name>
- <portlet-class>com.vaadin.demo.portlet.InterPortletEventPortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
- </supports>
- <portlet-info>
- <title>Inter-portlet events (non-Vaadin)</title>
- <short-title>Inter-portlet events (non-Vaadin)</short-title>
- </portlet-info>
- <supported-processing-event>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:Reply</qname>
- </supported-processing-event>
- <supported-processing-event>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:FromVaadin</qname>
- </supported-processing-event>
- <supported-publishing-event>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:Hello</qname>
- </supported-publishing-event>
- <supported-publishing-event>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:ReplyToVaadin</qname>
- </supported-publishing-event>
- <supported-public-render-parameter>HelloState</supported-public-render-parameter>
- </portlet>
-
- <!-- Used by the Portlet mode demo -->
- <custom-portlet-mode>
- <description>Custom mode</description>
- <portlet-mode>config</portlet-mode>
- <portal-managed>false</portal-managed>
- </custom-portlet-mode>
-
- <!--
- These can be used to customize the event object types. The types must
- be serializable and have JAXB binding.
- -->
- <event-definition>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:Hello</qname>
- <value-type>java.lang.String</value-type>
- </event-definition>
-
- <event-definition>
- <qname xmlns:vaadin="http://vaadin.com/hello">vaadin:Reply</qname>
- <value-type>java.lang.String</value-type>
- </event-definition>
-
- <public-render-parameter>
- <identifier>HelloState</identifier>
- <qname xmlns:vaadin="http://vaadin.com/params">vaadin:HelloState</qname>
- </public-render-parameter>
-
<!--
This can be used to work around an issue in liferay 5.0-5.1.1
</init-param>\r
</servlet>\r
\r
- <servlet>\r
- <servlet-name>PortletDemo</servlet-name>\r
- <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>\r
- <init-param>\r
- <param-name>application</param-name>\r
- <param-value>com.vaadin.demo.portlet.PortletDemo</param-value>\r
- </init-param>\r
- </servlet>\r
-\r
<servlet>\r
<servlet-name>Parameters</servlet-name>\r
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>\r
<url-pattern>/ModalWindow/*</url-pattern>\r
</servlet-mapping>\r
\r
- <servlet-mapping>\r
- <servlet-name>PortletDemo</servlet-name>\r
- <url-pattern>/PortletDemo/*</url-pattern>\r
- </servlet-mapping>\r
-\r
<servlet-mapping>\r
<servlet-name>GAESyncTest</servlet-name>\r
<url-pattern>/gaesynctest/*</url-pattern>\r
<copy todir="${output-dir}/WebContent/WEB-INF/classes">
<fileset dir="${result-path}/classes">
<include name="${toolkit-package}/demo/**/*" />
+ <include name="${toolkit-package}/tests/integration/**/*" />
<!-- user might want to tweak launcher classes -->
<include name="${toolkit-package}/launcher/**" />
</fileset>
</init-param>
</servlet>
- <!-- Portlet demo application -->
- <servlet>
- <servlet-name>PortletDemo</servlet-name>
- <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.vaadin.demo.portlet.PortletDemo</param-value>
- </init-param>
- </servlet>
-
<!-- Servlet Mappings below - see servlets for comments -->
- <servlet-mapping>
- <servlet-name>PortletDemo</servlet-name>
- <url-pattern>/PortletDemo/*</url-pattern>
- </servlet-mapping>
<servlet-mapping>
<servlet-name>VaadinApplicationRunner</servlet-name>
<url-pattern>/run/*</url-pattern>
</tr>
<tr>
<td>mouseClickAndWait</td>
- <td>//div[@id='Vaadin-AddressBook']/p/a</td>
+ <td>//div[@id='Vaadin-VaadinPortlet20Test']/p/a</td>
<td>16,11</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
- <td>mouseClick</td>
- <td>vaadin=v-AddressBookPortlet_WAR_demo_LAYOUT_10707::/VVerticalLayout[0]/ChildComponentContainer[1]/VSplitPanelHorizontal[0]/VSplitPanelVertical[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[0]</td>
- <td>24,10</td>
+ <td>closeNotification</td>
+ <td>//body/div[2]</td>
+ <td></td>
</tr>
<tr>
- <td>click</td>
- <td>vaadin=v-AddressBookPortlet_WAR_demo_LAYOUT_10707::/VVerticalLayout[0]/ChildComponentContainer[1]/VSplitPanelHorizontal[0]/VSplitPanelVertical[0]/VForm[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>verifyTextNotPresent</td>
+ <td>Action received</td>
<td></td>
</tr>
<tr>
- <td>mouseClick</td>
- <td>vaadin=v-AddressBookPortlet_WAR_demo_LAYOUT_10707::/VVerticalLayout[0]/ChildComponentContainer[1]/VSplitPanelHorizontal[0]/VSplitPanelVertical[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[1]</td>
- <td>9,11</td>
+ <td>mouseClickAndWait</td>
+ <td>vaadin=v-JSR286TestPortlet_WAR_demo_LAYOUT_10706::/VVerticalLayout[0]/ChildComponentContainer[2]/VLink[0]/domChild[0]/domChild[0]</td>
+ <td>8,7</td>
</tr>
<tr>
- <td>mouseClick</td>
- <td>vaadin=v-AddressBookPortlet_WAR_demo_LAYOUT_10707::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item8</td>
- <td>158,17</td>
+ <td>closeNotification</td>
+ <td>//body/div[2]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Done</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Action received</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClickAndWait</td>
+ <td>vaadin=v-JSR286TestPortlet_WAR_demo_LAYOUT_10706::/VVerticalLayout[0]/ChildComponentContainer[4]/VLink[0]/domChild[0]/domChild[0]</td>
+ <td>28,7</td>
+</tr>
+<tr>
+ <td>closeNotification</td>
+ <td>//body/div[2]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>mouseClickAndWait</td>
+ <td>vaadin=v-JSR286TestPortlet_WAR_demo_LAYOUT_10706::/VVerticalLayout[0]/ChildComponentContainer[3]/VLink[0]/domChild[0]/domChild[0]</td>
+ <td>37,-41</td>
</tr>
<tr>
- <td>click</td>
- <td>vaadin=v-AddressBookPortlet_WAR_demo_LAYOUT_10707::/VVerticalLayout[0]/ChildComponentContainer[1]/VSplitPanelHorizontal[0]/VSplitPanelVertical[0]/VForm[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>closeNotification</td>
+ <td>//body/div[2]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Back to normal</td>
<td></td>
</tr>
<tr>
- <td>assertText</td>
- <td>vaadin=v-AddressBookPortlet_WAR_demo_LAYOUT_10707::/VVerticalLayout[0]/ChildComponentContainer[1]/VSplitPanelHorizontal[0]/VSplitPanelVertical[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[6]/domChild[0]</td>
- <td>New York</td>
+ <td>mouseClickAndWait</td>
+ <td>vaadin=v-JSR286TestPortlet_WAR_demo_LAYOUT_10706::/VVerticalLayout[0]/ChildComponentContainer[3]/VLink[0]/domChild[0]/domChild[0]</td>
+ <td>46,-57</td>
+</tr>
+<tr>
+ <td>closeNotification</td>
+ <td>//body/div[2]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Edit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Maximize</td>
+ <td></td>
</tr>
</tbody></table>
--- /dev/null
+package com.vaadin.tests.integration;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.WindowState;
+
+import com.vaadin.Application;
+import com.vaadin.terminal.ExternalResource;
+import com.vaadin.terminal.gwt.server.PortletApplicationContext2;
+import com.vaadin.terminal.gwt.server.PortletApplicationContext2.PortletListener;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Window.Notification;
+
+/**
+ * Adapted from old PortletDemo to support integration testing.
+ */
+public class JSR286PortletApplication extends Application {
+
+ Window main = new Window();
+ TextField tf = new TextField("Some value");
+ Label userInfo = new Label();
+ Link portletEdit = new Link();
+ Link portletMax = new Link();
+ Link someAction = null;
+
+ @Override
+ public void init() {
+ main = new Window();
+ setMainWindow(main);
+
+ userInfo.setCaption("User info");
+ userInfo.setContentMode(Label.CONTENT_PREFORMATTED);
+ main.addComponent(userInfo);
+
+ tf.setEnabled(false);
+ tf.setImmediate(true);
+ main.addComponent(tf);
+
+ portletEdit.setEnabled(false);
+ main.addComponent(portletEdit);
+ portletMax.setEnabled(false);
+ main.addComponent(portletMax);
+
+ if (getContext() instanceof PortletApplicationContext2) {
+ PortletApplicationContext2 ctx = (PortletApplicationContext2) getContext();
+ ctx.addPortletListener(this, new DemoPortletListener());
+ } else {
+ getMainWindow().showNotification("Not inited via Portal!",
+ Notification.TYPE_ERROR_MESSAGE);
+ }
+
+ }
+
+ private class DemoPortletListener implements PortletListener {
+
+ public void handleActionRequest(ActionRequest request,
+ ActionResponse response, Window window) {
+ main.addComponent(new Label("Action received"));
+ }
+
+ public void handleRenderRequest(RenderRequest request,
+ RenderResponse response, Window window) {
+ // Portlet up-and-running, enable stuff
+ portletEdit.setEnabled(true);
+ portletMax.setEnabled(true);
+
+ // Editable if we're in editmode
+ tf.setEnabled((request.getPortletMode() == PortletMode.EDIT));
+
+ // Show notification about current mode and state
+ getMainWindow().showNotification(
+ "Portlet status",
+ "Mode: " + request.getPortletMode() + " State: "
+ + request.getWindowState(),
+ Notification.TYPE_WARNING_MESSAGE);
+
+ // Display current user info
+ Map<?, ?> uinfo = (Map<?, ?>) request
+ .getAttribute(PortletRequest.USER_INFO);
+ if (uinfo != null) {
+ String s = "";
+ for (Iterator<?> it = uinfo.keySet().iterator(); it.hasNext();) {
+ Object key = it.next();
+ Object val = uinfo.get(key);
+ s += key + ": " + val + "\n";
+ }
+ if (request.isUserInRole("administrator")) {
+ s += "(administrator)";
+ }
+ userInfo.setValue(s);
+ } else {
+ userInfo.setValue("-");
+ }
+
+ // Create Edit/Done link (actionUrl)
+ PortletURL url = response.createActionURL();
+ try {
+ url.setPortletMode((request.getPortletMode() == PortletMode.VIEW ? PortletMode.EDIT
+ : PortletMode.VIEW));
+ portletEdit.setResource(new ExternalResource(url.toString()));
+ portletEdit
+ .setCaption((request.getPortletMode() == PortletMode.VIEW ? "Edit"
+ : "Done"));
+ } catch (Exception e) {
+ portletEdit.setEnabled(false);
+ }
+ // Create Maximize/Normal link (actionUrl)
+ url = response.createActionURL();
+ try {
+ url.setWindowState((request.getWindowState() == WindowState.NORMAL ? WindowState.MAXIMIZED
+ : WindowState.NORMAL));
+ portletMax.setResource(new ExternalResource(url.toString()));
+ portletMax
+ .setCaption((request.getWindowState() == WindowState.NORMAL ? "Maximize"
+ : "Back to normal"));
+ } catch (Exception e) {
+ portletMax.setEnabled(false);
+ }
+
+ if (someAction == null) {
+ url = response.createActionURL();
+ try {
+ someAction = new Link("An action", new ExternalResource(
+ url.toString()));
+ main.addComponent(someAction);
+ } catch (Exception e) {
+ // Oops
+ System.err.println("Could not create someAction: " + e);
+ }
+
+ }
+ }
+
+ public void handleEventRequest(EventRequest request,
+ EventResponse response, Window window) {
+ // events not used by this test
+ }
+
+ public void handleResourceRequest(ResourceRequest request,
+ ResourceResponse response, Window window) {
+ // nothing special to do here
+ }
+ }
+
+}