Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve variables in app location and fix app configuration validation logic #1655

Merged
merged 12 commits into from
Apr 4, 2023
17 changes: 9 additions & 8 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 All @@ -43,7 +43,8 @@ jobs:
- name: Checkout ci.common
uses: actions/checkout@v3
with:
repository: OpenLiberty/ci.common
repository: cherylking/ci.common
ref: resolveVars
path: ci.common
- name: Checkout ci.ant
uses: actions/checkout@v3
Expand Down Expand Up @@ -76,13 +77,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 All @@ -98,7 +99,7 @@ jobs:
- name: Clone ci.ant, ci.common, ci.maven repos to C drive
run: |
cp -r D:/a/ci.maven/ci.maven C:/ci.maven
git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common
git clone https://github.com/cherylking/ci.common.git --branch resolveVars --single-branch C:/ci.common
git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant
- name: Cache maven packages
uses: actions/cache@v3
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,231 @@
<?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-liberty</id>
<phase>package</phase>
<goals>
<goal>install-server</goal>
</goals>
</execution>
<execution>
<id>create-liberty-server</id>
<phase>package</phase>
<goals>
<goal>create</goal>
</goals>
</execution -->
<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