Skip to content

Commit

Permalink
test: Added integration tests for Liferay (#216)
Browse files Browse the repository at this point in the history
Added modules to test portlet add-on on Liferay portlet container

Closes #204

Co-authored-by: Mikhail Shabarov <[email protected]>
Co-authored-by: Mikhail Shabarov <[email protected]>
  • Loading branch information
3 people authored Apr 11, 2022
1 parent d94861c commit 04e8b12
Show file tree
Hide file tree
Showing 63 changed files with 4,397 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

<modules>
<module>vaadin-portlet</module>
<module>vaadin-portlet-integration-tests</module>
<module>vaadin-portlet-cdi</module>
<module>vaadin-portlet-integration-tests</module>
<module>vaadin-portlet-liferay-integration-tests</module>
</modules>

<organization>
Expand Down Expand Up @@ -70,6 +71,7 @@
<maven.clean.plugin.version>3.0.0</maven.clean.plugin.version>

<testbench.version>6.2.0</testbench.version>
<vaadin.version>14.8-SNAPSHOT</vaadin.version>
<flow.version>2.7-SNAPSHOT</flow.version>
<flow.cdi.version>11.3-SNAPSHOT</flow.cdi.version>
<jetty.version>9.4.9.v20180320</jetty.version>
Expand Down
30 changes: 30 additions & 0 deletions vaadin-portlet-cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,36 @@
<groupId>com.vaadin</groupId>
<artifactId>vaadin-cdi</artifactId>
<version>${flow.cdi.version}</version>
<exclusions>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>flow-client</artifactId>
</exclusion>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>flow-push</artifactId>
</exclusion>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>flow-server</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-client</artifactId>
<version>${flow.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-push</artifactId>
<version>${flow.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server</artifactId>
<version>${flow.version}</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion vaadin-portlet-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<vaadin.productionMode>true</vaadin.productionMode>

<failOnMissingWebXml>false</failOnMissingWebXml>
<component.version>14.8-SNAPSHOT</component.version>
<component.version>${vaadin.version}</component.version>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import com.vaadin.testbench.parallel.ParallelTest;

/**
* Base class for ITs
* Base class for ITs running in the Apache Pluto container.
* <p>
* The tests use Chrome driver (see pom.xml for integration-tests profile) to
* run integration tests on a headless Chrome. If a property {@code test.use
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>vaadin-portlet-liferay-integration-tests</artifactId>
<groupId>com.vaadin</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>liferay-portlet-deployer</artifactId>
<name>Liferay Portlet Deployer</name>
<packaging>war</packaging>

<properties>
<skipTests>true</skipTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8
</project.reporting.outputEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<javax.validation.version>2.0.0.Final</javax.validation.version>
<vaadin.productionMode>true</vaadin.productionMode>
</properties>

<repositories>
<!-- The order of definitions matters. Explicitly defining central
here to make sure it has the highest priority. -->
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<!-- The order of definitions matters. Explicitly defining central
here to make sure it has the highest priority. -->
<pluginRepository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-portlet</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>release.portal.api</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>

<!-- Added to provide logging output as Flow uses -->
<!-- the unbound SLF4J no-operation (NOP) logger implementation -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.28</version>
</dependency>

<!-- Portlet API -->
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>

<!-- Servlet API -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-portlet-liferay-it-shared</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Test dependencies -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<attachClasses>true</attachClasses>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven3-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>production</id>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server-production-mode</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/*
* Copyright 2000-2022 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.flow.portal.liferay.deployer;

import java.util.Collection;
import java.util.LinkedList;

import com.vaadin.flow.portal.liferay.AbstractPortletDeployer;
import com.vaadin.flow.portal.liferay.LayoutInfo;
import com.vaadin.flow.portal.liferay.PortletInfo;

/**
* Adds Liferay layouts and test portlets for generic-tests and portlet 3.0.
*/
public class PortletDeployer extends AbstractPortletDeployer {

@Override
protected Collection<LayoutInfo> getLayouts() {
// remember to update the xml config files in
// liferay-tests-generic/src/main/webapp/WEB-INF/
// when adding a new test portlet

// Generic tests

Collection<LayoutInfo> layouts = new LinkedList<>();

LayoutInfo basicLayout = new LayoutInfo("BasicPortlet", "/test/basic");
PortletInfo basic = new PortletInfo();
basic.setId("basic_WAR_liferaytestsgeneric");
basic.setPortletName("BasicPortlet");
basic.setPortletFriendlyUrl("/test/basic");
basicLayout.addPortlet(basic);
layouts.add(basicLayout);

LayoutInfo errorLayout = new LayoutInfo("ErrorHandling", "/test/errorhandling");
PortletInfo errorHandling = new PortletInfo();
errorHandling.setId("errorhandling_WAR_liferaytestsgeneric");
errorHandling.setPortletName("ErrorHandling");
errorHandling.setPortletFriendlyUrl("/test/errorhandling");
errorLayout.addPortlet(errorHandling);
layouts.add(errorLayout);

LayoutInfo eventLayout = new LayoutInfo("EventHandler",
"/test/eventhandler");
PortletInfo eventHandler = new PortletInfo();
eventHandler.setId("eventhandler_WAR_liferaytestsgeneric");
eventHandler.setPortletName("EventHandler");
eventHandler.setPortletFriendlyUrl("/test/eventhandler");
eventLayout.addPortlet(eventHandler);
layouts.add(eventLayout);

LayoutInfo stateLayout = new LayoutInfo("MinimizedStateRenderer",
"/test/minimized-state-render");
PortletInfo minimizedStateRenderer = new PortletInfo();
minimizedStateRenderer.setId("minimizedstaterender_WAR_liferaytestsgeneric");
minimizedStateRenderer.setPortletName("MinimizedStateRenderer");
minimizedStateRenderer.setPortletFriendlyUrl("/test/minimized-state-render");
stateLayout.addPortlet(minimizedStateRenderer);
layouts.add(stateLayout);

LayoutInfo renderLayout = new LayoutInfo("Renderer",
"/test/renderer");
PortletInfo renderer = new PortletInfo();
renderer.setId("render_WAR_liferaytestsgeneric");
renderer.setPortletName("Renderer");
renderer.setPortletFriendlyUrl("/test/renderer");
renderLayout.addPortlet(renderer);
layouts.add(renderLayout);

LayoutInfo streamLayout = new LayoutInfo("StreamResource",
"/test/stream-resource");
PortletInfo streamResource = new PortletInfo();
streamResource.setId("streamresource_WAR_liferaytestsgeneric");
streamResource.setPortletName("StreamResource");
streamResource.setPortletFriendlyUrl("/test/stream-resource");
streamLayout.addPortlet(streamResource);
layouts.add(streamLayout);

LayoutInfo uploadLayout = new LayoutInfo("Upload", "/test/upload");
PortletInfo upload = new PortletInfo();
upload.setId("upload_WAR_liferaytestsgeneric");
upload.setPortletName("Upload");
upload.setPortletFriendlyUrl("/test/upload");
uploadLayout.addPortlet(upload);
layouts.add(uploadLayout);


// Portlet 3.0:

String ipcEventFriendlyUrl = "/test/ipcevent";
LayoutInfo eventSourceTargetLayout = new LayoutInfo("Events",
ipcEventFriendlyUrl);
PortletInfo eventSource = new PortletInfo();
eventSource.setId("eventsource_WAR_liferayportlet30");
eventSource.setPortletName("Event Source");
eventSource.setPortletFriendlyUrl(ipcEventFriendlyUrl);
eventSourceTargetLayout.addPortlet(eventSource);

PortletInfo eventTarget = new PortletInfo();
eventTarget.setId("eventtarget_WAR_liferayportlet30");
eventTarget.setPortletName("Event Target");
eventTarget.setPortletFriendlyUrl(ipcEventFriendlyUrl);
eventSourceTargetLayout.addPortlet(eventTarget);

PortletInfo otherEventTarget = new PortletInfo();
otherEventTarget.setId("othereventtarget_WAR_liferayportlet30");
otherEventTarget.setPortletName("Other Event Target");
otherEventTarget.setPortletFriendlyUrl(ipcEventFriendlyUrl);
eventSourceTargetLayout.addPortlet(otherEventTarget);

layouts.add(eventSourceTargetLayout);

String ipcEventNotVaadinFriedlyUrl = "/test/ipceventnotvaadin";
LayoutInfo notVaadinEventLayout = new LayoutInfo("Not Vaadin Events",
ipcEventNotVaadinFriedlyUrl);
PortletInfo vaadinIpcPortlet = new PortletInfo();
vaadinIpcPortlet.setId("vaadinipcportlet_WAR_liferayportlet30");
vaadinIpcPortlet.setPortletName("Vaadin IPC Portlet");
vaadinIpcPortlet.setPortletFriendlyUrl(ipcEventNotVaadinFriedlyUrl);
notVaadinEventLayout.addPortlet(vaadinIpcPortlet);

PortletInfo plainIpcPortlet = new PortletInfo();
plainIpcPortlet.setId("plainipcportlet_WAR_liferayportlet30");
plainIpcPortlet.setPortletName("Event Target");
plainIpcPortlet.setPortletFriendlyUrl(ipcEventNotVaadinFriedlyUrl);
notVaadinEventLayout.addPortlet(plainIpcPortlet);

layouts.add(notVaadinEventLayout);

LayoutInfo render30Layout = new LayoutInfo("Render 30",
"/test/hubrender");
PortletInfo render30Portlet = new PortletInfo();
render30Portlet.setId("renderportlet30_WAR_liferayportlet30");
render30Portlet.setPortletName("Render 30 Portlet");
render30Portlet.setPortletFriendlyUrl("/test/hubrender");
render30Layout.addPortlet(render30Portlet);

layouts.add(render30Layout);

return layouts;
}

}




Loading

0 comments on commit 04e8b12

Please sign in to comment.