Skip to content

Commit

Permalink
Merge pull request #1655 from cherylking/handleVarsInAppLocation
Browse files Browse the repository at this point in the history
Resolve variables in app location and fix app configuration validation logic
  • Loading branch information
cherylking authored Apr 4, 2023
2 parents b8803c3 + d656b2a commit e66ab39
Show file tree
Hide file tree
Showing 26 changed files with 877 additions and 55 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
RUNTIME: [ol, wlp]
RUNTIME_VERSION: [22.0.0.6, 22.0.0.9]
RUNTIME_VERSION: [22.0.0.12, 22.0.0.9]
java: [17, 11, 8]
exclude:
- java: 8
RUNTIME_VERSION: 22.0.0.6
RUNTIME_VERSION: 22.0.0.9
- java: 17
RUNTIME_VERSION: 22.0.0.6
RUNTIME_VERSION: 22.0.0.9
name: ${{ matrix.RUNTIME }} ${{ matrix.RUNTIME_VERSION }}, Java ${{ matrix.java }}, Linux
steps:
# Checkout repos
Expand Down Expand Up @@ -76,13 +76,13 @@ jobs:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
RUNTIME: [ol, wlp]
RUNTIME_VERSION: [22.0.0.6, 22.0.0.9]
RUNTIME_VERSION: [22.0.0.12, 22.0.0.9]
java: [17, 11, 8]
exclude:
- java: 8
RUNTIME_VERSION: 22.0.0.6
RUNTIME_VERSION: 22.0.0.9
- java: 17
RUNTIME_VERSION: 22.0.0.6
RUNTIME_VERSION: 22.0.0.9
name: ${{ matrix.RUNTIME }} ${{ matrix.RUNTIME_VERSION }}, Java ${{ matrix.java }}, Windows
steps:
# Checkout repos
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# prove the variables in server.xml can be resolved correctly
invoker.goals.1 = clean liberty:create resources:copy-resources install
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
<?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">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.openliberty.tools.it</groupId>
<artifactId>tests</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>appsdirectory-apps-configured-variables-include-it</artifactId>
<packaging>war</packaging>

<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-servlet_3.0_spec</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
<filters>
<filter>${project.basedir}/src/main/filters/test.properties</filter>
</filters>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Web-ContextPath>/test-wab</Web-ContextPath>
<Bundle-ClassPath>WEB-INF/classes</Bundle-ClassPath>
<Import-Package>
javax.servlet.jsp.el,
javax.servlet.jsp,
javax.servlet.jsp.tagext,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>@pom.version@</version>
<extensions>true</extensions>
<configuration>
<stripVersion>true</stripVersion>
<assemblyArtifact>
<groupId>${project.groupId}</groupId>
<artifactId>assembly-server</artifactId>
<version>${project.version}</version>
<type>zip</type>
</assemblyArtifact>
<serverName>test</serverName>
<looseApplication>false</looseApplication>
</configuration>
<executions>
<execution>
<id>install-artifact</id>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<looseApplication>false</looseApplication>
<appsDirectory>apps</appsDirectory>
<stripVersion>true</stripVersion>
</configuration>
</execution>
<execution>
<id>start-server</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>clean-server</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
<!-- goal>clean</goal -->
</goals>
<configuration>
<cleanDropins>false</cleanDropins>
<cleanApps>false</cleanApps>
<cleanLogs>false</cleanLogs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>default-cli</id>
<phase>none</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<!-- This location can persist across a server recreate, where the refresh can annoyingly wipe out your earlier copy -->
<outputDirectory>target/liberty/usr/shared/config</outputDirectory>
<resources>
<resource>
<directory>src/main/filtered-config</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<forkMode>once</forkMode>
<forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
<argLine>-enableassertions</argLine>
<workingDirectory>${project.build.directory}</workingDirectory>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="false"
version="2.5">

<servlet>
<display-name>TestServlet</display-name>
<servlet-name>TestServlet</servlet-name>
<servlet-class>net.wasdev.wlp.test.servlet.TestServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/TestServlet</url-pattern>
<url-pattern>/TestServlet/*</url-pattern>
</servlet-mapping>

</web-app>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<server description="environment">
<variable name="tidal.url" value="${tidal.url}"/>
<variable name="project.artifactId" value="${project.artifactId}"/>
</server>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tidal.url=http://test.ibm.com:9080
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.wasdev.wlp.test.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TestServlet extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<html><head><title>Sample Wab Application Bundle</title></head></html>");
out.println("<body><h1>");
out.println("Web Application Bundle");
out.println("</h1></body></html>");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<server description="default server">
<featureManager>
<feature>jsp-2.3</feature>
</featureManager>

<include location="${shared.config.dir}/environment.xml"/>

<!-- webApplication location="${project.artifactId}.war"/ -->
<webApplication location="${server.config.dir}/apps/${project.artifactId}.war"/>
</server>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<jsp:useBean id="datetime" class="java.util.Date" />
<title>Hello IBM WebSphere Application Server Liberty</title>
</head>
<body>
<h2>Welcome to IBM Liberty</h2>
<p>Congratulations on running this very simple demo application on ${datetime}.</p>
</body>
</html>
Loading

0 comments on commit e66ab39

Please sign in to comment.