Skip to content

Commit

Permalink
Merge pull request #16 from icatproject/payara6
Browse files Browse the repository at this point in the history
Upgrade to JakartaEE 10 API for compatibility with Payara 6
  • Loading branch information
ajkyffin authored Sep 8, 2023
2 parents 7f1c8ee + ef1a0bb commit 7b0f8ee
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 79 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,17 @@ on:

jobs:
build_and_tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
java: [ '8', '11' ]
java: [ '11', '17' ]
steps:
# Setup Java & Python
# Setup Java
- name: Setup Java
uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98 # v3.10.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup Python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: "3.9.7"
architecture: x64

- name: Cache local Maven repository
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
Expand All @@ -39,7 +34,7 @@ jobs:
with:
repository: icatproject-contrib/icat-ansible
path: icat-ansible
ref: master
ref: payara6
- name: Install Ansible
run: pip install -r icat-ansible/requirements.txt

Expand Down Expand Up @@ -74,6 +69,7 @@ jobs:
# Create local instance of ICAT
- name: Run ICAT Ansible Playbook
run: |
sudo apt-get update
ansible-playbook icat-ansible/icatdb_minimal_hosts.yml -i icat-ansible/hosts --vault-password-file icat-ansible/vault_pass.txt -vv
# The authn-db deployed by ansible needs to be undeployed so that the build can run
Expand Down
27 changes: 15 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.icatproject</groupId>
<artifactId>authn.db</artifactId>
<version>2.0.2-SNAPSHOT</version>
<version>3.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ICAT DB Authn</name>

Expand Down Expand Up @@ -62,10 +62,17 @@

<dependencies>

<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.icatproject</groupId>
<artifactId>icat.authentication</artifactId>
<version>4.6.0</version>
<version>5.0.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -102,9 +109,9 @@
</dependency>

<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0.4</version>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
<version>1.1.0</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -200,21 +207,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<version>3.10.1</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>1.8</source>
<target>1.8</target>
<release>11</release>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
<version>3.4.0</version>
</plugin>

<plugin>
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/org/icatproject/authn_db/DB_Authenticator.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
import java.io.ByteArrayOutputStream;
import java.net.HttpURLConnection;

import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
import javax.json.JsonValue;
import javax.json.stream.JsonGenerator;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import jakarta.annotation.PostConstruct;
import jakarta.ejb.Stateless;
import jakarta.json.Json;
import jakarta.json.JsonObject;
import jakarta.json.JsonReader;
import jakarta.json.JsonValue;
import jakarta.json.stream.JsonGenerator;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.FormParam;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

import org.icatproject.authentication.AuthnException;
import org.icatproject.authentication.PasswordChecker;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/icatproject/authn_db/Passwd.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;

@SuppressWarnings("serial")
@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import java.io.ByteArrayOutputStream;

import javax.json.Json;
import javax.json.stream.JsonGenerator;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import jakarta.json.Json;
import jakarta.json.stream.JsonGenerator;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

import org.icatproject.authentication.AuthnException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import java.io.ByteArrayOutputStream;

import javax.json.Json;
import javax.json.stream.JsonGenerator;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import jakarta.json.Json;
import jakarta.json.stream.JsonGenerator;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import java.io.PrintStream;
import java.net.HttpURLConnection;

import javax.json.Json;
import javax.json.stream.JsonGenerator;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import jakarta.json.Json;
import jakarta.json.stream.JsonGenerator;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
<persistence
xmlns="https://jakarta.ee/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
version="3.0">

<persistence-unit name="db_authn" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
Expand All @@ -22,4 +23,4 @@
</properties>
</persistence-unit>

</persistence>
</persistence>
6 changes: 4 additions & 2 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
<web-app
xmlns="https://jakarta.ee/xml/ns/jakartaee"
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_3_0.xsd">
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">

<servlet>
<servlet-name>ServletAdaptor</servlet-name>
Expand Down
10 changes: 3 additions & 7 deletions src/site/xdoc/installation.xml.vm
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,16 @@
<li>The authn.db distribution: <a
href="${repoUrl}/org/icatproject/authn.db/${project.version}/authn.db-${project.version}-distro.zip">authn.db-${project.version}-distro.zip</a>
</li>
<li>A suitable deployed container (here assumed to be
Glassfish/Payara) to support a web application. Testing has been
carried out with payara41. <a
href="http://icatproject.org/installation/glassfish/">Glassfish/Payara
installation instructions</a> are available.
<li>A suitable deployed application server that supports JakartaEE 10+. Testing has been carried out with Payara Server Community 6. Other applications servers such as GlassFish and WildFly may work but have not been tested.
<a href="http://icatproject.org/installation/glassfish/">Glassfish/Payara installation instructions</a> are available.
</li>
<li>A database as described in <a
href="http://icatproject.org/installation/database">Database
installation instructions</a> installed on the server or accessible
from it.
</li>

<li>Python (version 2.4 to 2.7) installed on the server.</li>
<li>Python 3.6+ installed on the server.</li>
</ul>
</subsection>

Expand Down Expand Up @@ -146,4 +143,3 @@
</section>
</body>
</document>

13 changes: 7 additions & 6 deletions src/site/xdoc/release-notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
</properties>

<body>
<section name="2.0.1">
<p>Changes to support Python 3. Now works on Python 2.7 and Python 3.
Note: support for Python 2.6 is now dropped.</p>
<section name="3.0.0">
<p>Upgrade from JavaEE to JakartaEE 10. Requires Java 11+ and an application server that supports JakartaEE 10 such as Payara 6.</p>
</section>

<section name="2.0.1">
<p>Changes to support Python 3. Now works on Python 2.7 and Python 3.
Note: support for Python 2.6 is now dropped.</p>
</section>

<section name="2.0.0">
Expand Down Expand Up @@ -55,6 +59,3 @@

</body>
</document>



10 changes: 5 additions & 5 deletions src/test/java/org/icatproject/integration/TestRS.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import java.util.ArrayList;
import java.util.List;

import javax.json.Json;
import javax.json.stream.JsonGenerator;
import javax.json.stream.JsonParser;
import javax.json.stream.JsonParser.Event;
import javax.json.stream.JsonParsingException;
import jakarta.json.Json;
import jakarta.json.stream.JsonGenerator;
import jakarta.json.stream.JsonParser;
import jakarta.json.stream.JsonParser.Event;
import jakarta.json.stream.JsonParsingException;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
Expand Down

0 comments on commit 7b0f8ee

Please sign in to comment.