Skip to content

Commit

Permalink
Merge branch 'current' into issue-3849
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem authored Aug 28, 2024
2 parents dfa3777 + 68632e2 commit 135354f
Show file tree
Hide file tree
Showing 11 changed files with 323 additions and 53 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@ jobs:
git add .
git commit -a -m "Publishing Maven plugin documentation" || true
git push
41 changes: 41 additions & 0 deletions .github/workflows/docs-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: docs-release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Piranha
uses: actions/checkout@v3
- name: Checkout Piranha Website
uses: actions/checkout@v3
with:
repository: piranhacloud/piranha-website
token: ${{ secrets.GIT_PASSWORD }}
path: piranha-website
ref: 'gh-pages'
- name: Set up Java 21
uses: actions/setup-java@v3
with:
cache: 'maven'
distribution: 'temurin'
java-version: 21
- name: Build with Maven
run: |
git checkout v${{ github.event.inputs.version }}
cd docs
mvn -B -DskipTests -DskipITs -ntp site
cd ../
rm -rf piranha-website/release || true
mkdir -p piranha-website/release || true
cp -R docs/target/site/* piranha-website/release/
cd piranha-website
git config --global user.email "noreply@piranha.cloud"
git config --global user.name "Automated publish"
git add .
git commit -a -m "Publishing documentation" || true
git push
42 changes: 42 additions & 0 deletions .github/workflows/docs-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: docs-snapshot
on:
push:
paths:
- 'docs/**'
branches:
- 'current'
tags-ignore:
- 'v*'
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Piranha
uses: actions/checkout@v3
- name: Checkout Piranha Website
uses: actions/checkout@v3
with:
repository: piranhacloud/piranha-website
token: ${{ secrets.GIT_PASSWORD }}
path: piranha-website
ref: 'gh-pages'
- name: Set up Java 21
uses: actions/setup-java@v3
with:
cache: 'maven'
distribution: 'temurin'
java-version: 21
- name: Build with Maven
run: |
cd docs
mvn -B -DskipTests -DskipITs -ntp site
cd ../
rm -rf piranha-website/snapshot || true
mkdir -p piranha-website/snapshot || true
cp -R docs/target/site/* piranha-website/snapshot/
cd piranha-website
git config --global user.email "noreply@piranha.cloud"
git config --global user.name "Automated publish"
git add .
git commit -a -m "Publishing documentation" || true
git push
90 changes: 90 additions & 0 deletions .github/workflows/tck-core-profile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: tck-core-profile
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
annotations:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '21' ]
os: [ubuntu-latest]
steps:
- name: Checkout Sources
uses: actions/checkout@v3
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
cache: 'maven'
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup for TCK
run: mvn -B -DskipTests=true -ntp install
- name: Run TCK
run: |
cd external/tck/coreprofile/annotations
mvn -B -ntp verify
atinject:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '21' ]
os: [ubuntu-latest]
steps:
- name: Checkout Sources
uses: actions/checkout@v3
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
cache: 'maven'
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup for TCK
run: mvn -B -DskipTests=true -ntp install
- name: Run TCK
run: |
cd external/tck/coreprofile/atinject
mvn -B -ntp verify
jsonb:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '21' ]
os: [ubuntu-latest]
steps:
- name: Checkout Sources
uses: actions/checkout@v3
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
cache: 'maven'
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup for TCK
run: mvn -B -DskipTests=true -ntp install
- name: Run TCK
run: |
cd external/tck/coreprofile/jsonb
mvn -B -ntp verify
jsonp:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '21' ]
os: [ubuntu-latest]
steps:
- name: Checkout Sources
uses: actions/checkout@v3
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
cache: 'maven'
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup for TCK
run: mvn -B -DskipTests=true -ntp install
- name: Run TCK
run: |
cd external/tck/coreprofile/jsonp
mvn -B -ntp verify
6 changes: 6 additions & 0 deletions arquillian/jarcontainer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-spi</artifactId>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-api-base</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>me.alexpanov</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,15 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
import org.jboss.arquillian.container.spi.client.container.DeploymentException;
import org.jboss.arquillian.container.spi.client.container.LifecycleException;
import org.jboss.arquillian.container.spi.client.protocol.ProtocolDescription;
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext;
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData;
import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.exporter.ZipExporter;
import org.jboss.shrinkwrap.descriptor.api.Descriptor;

/**
* The Piranha JAR container.
Expand Down Expand Up @@ -89,6 +88,11 @@ public class PiranhaJarContainer implements DeployableContainer<PiranhaJarContai
*/
private File localRepositoryDir = new File(System.getProperty("user.home"), ".m2/repository");

/**
* Stores the Piranha process.
*/
private Process process;

/**
* Default constructor.
*/
Expand All @@ -105,37 +109,14 @@ public void setup(PiranhaJarContainerConfiguration configuration) {
this.configuration = configuration;
}

@Override
public void start() throws LifecycleException {
LOGGER.log(Level.INFO, "Starting server");
}

@Override
public void stop() throws LifecycleException {
LOGGER.log(Level.INFO, "Stopping server");

/*
* Delete the PID file.
*/
File runtimeDirectory = new File(System.getProperty(TMP_DIR));
File pidFile = new File(runtimeDirectory, PID_FILENAME);
if (pidFile.exists()) {
try {
Files.delete(pidFile.toPath());
} catch (IOException ioe) {
LOGGER.log(WARNING, "Unable to delete PID file", ioe);
}
}
}

@Override
public ProtocolDescription getDefaultProtocol() {
return new ProtocolDescription(configuration.getProtocol());
}

@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
LOGGER.log(Level.INFO, "Deploying - " + archive.getName());
LOGGER.log(Level.INFO, "Deploying " + archive.getName());

ProtocolMetaData metadata = new ProtocolMetaData();

Expand All @@ -152,12 +133,12 @@ public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
*/
String version = determineVersionToUse();
File piranhaJarFile = getPiranhaJarFile(version);
copyPiranhaCoreProfileJarFile(runtimeDirectory, piranhaJarFile);
copyPiranhaJarFile(runtimeDirectory, piranhaJarFile);

/*
* Start Piranha.
*/
startPiranhaCoreProfile(runtimeDirectory, warFile);
startPiranha(runtimeDirectory, warFile);
} catch (IOException ioe) {
ioe.printStackTrace();
return null;
Expand All @@ -171,14 +152,9 @@ public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
return metadata;
}

@Override
public void deploy(Descriptor descriptor) throws DeploymentException {
// not supporting deployment by descriptor.
}

@Override
public void undeploy(Archive<?> archive) throws DeploymentException {
LOGGER.log(Level.INFO, "Undeploying - " + archive.getName());
LOGGER.log(Level.INFO, "Undeploying " + archive.getName());

/*
* Delete the PID file.
Expand All @@ -194,11 +170,17 @@ public void undeploy(Archive<?> archive) throws DeploymentException {
}

/*
* Wait for 5 seconds.
* Wait for 5 minutes at the most.
*/
try {
Thread.sleep(5000);
} catch (InterruptedException ie) {
if (process != null && process.isAlive()) {
try {
LOGGER.log(Level.INFO, "Waiting for Piranha to be shutdown");
process.waitFor(5, TimeUnit.MINUTES);
} catch (InterruptedException ie) {
LOGGER.log(Level.WARNING, "Piranha did not shutdown within time alloted");
LOGGER.log(Level.WARNING, "Destroying Piranha process forcibly");
process.destroyForcibly();
}
}

/*
Expand All @@ -208,11 +190,6 @@ public void undeploy(Archive<?> archive) throws DeploymentException {
warFile.delete();
}

@Override
public void undeploy(Descriptor d) throws DeploymentException {
// not supporting undeployment by descriptor.
}

/**
* Creates a WAR filename for the archive.
*
Expand Down Expand Up @@ -322,12 +299,12 @@ private String determineVersionToUse() {
}

/**
* Start and wait for Piranha Core Profile.
* Start Piranha.
*
* @param runtimeDirectory the runtime directory.
* @param warFilename the WAR filename.
*/
private void startPiranhaCoreProfile(
private void startPiranha(
File runtimeDirectory,
File warFilename)
throws IOException {
Expand All @@ -350,22 +327,21 @@ private void startPiranhaCoreProfile(
commands.add(warFilename.getName());
commands.add("--write-pid");

new ProcessBuilder()
process = new ProcessBuilder()
.directory(runtimeDirectory)
.command(commands)
.start();

File pidFile = new File(runtimeDirectory, PID_FILENAME);
int count = 0;
LOGGER.log(Level.INFO, "Waiting for Piranha to be ready ");
LOGGER.log(Level.INFO, "Waiting for Piranha to be ready");
while (!pidFile.exists()) {
try {
Thread.sleep(500);
count++;
LOGGER.log(Level.INFO, ".");
} catch (InterruptedException ie) {
}
if (count == 80) {
if (count == 600) {
LOGGER.log(Level.WARNING, "Warning, PID file not seen!");
break;
}
Expand All @@ -379,12 +355,12 @@ private void startPiranhaCoreProfile(
}

/**
* Copy the Piranha Core Profile JAR file.
* Copy the Piranha JAR file.
*
* @param runtimeDirectory the runtime directory.
* @param zipFile the zip file.
*/
private void copyPiranhaCoreProfileJarFile(File runtimeDirectory, File zipFile) throws IOException {
private void copyPiranhaJarFile(File runtimeDirectory, File zipFile) throws IOException {
if (!runtimeDirectory.exists() && !runtimeDirectory.mkdirs()) {
System.err.println(UNABLE_TO_CREATE_DIRECTORIES);
}
Expand Down
3 changes: 1 addition & 2 deletions arquillian/jarcontainer/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
provides LoadableExtension with PiranhaJarContainerExtension;
requires arquillian.container.spi;
requires arquillian.core.spi;
requires shrinkwrap.api;
requires shrinkwrap.descriptors.api.base;
requires free.port.finder;
requires shrinkwrap.api;
}
Loading

0 comments on commit 135354f

Please sign in to comment.