Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: folio-org/edge-rtac
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.5.2
Choose a base ref
...
head repository: folio-org/edge-rtac
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 969 additions and 284 deletions.
  1. +91 −0 .github/workflows/api-doc.yml
  2. +65 −0 .github/workflows/api-lint.yml
  3. +46 −0 .github/workflows/api-schema-lint.yml
  4. +13 −5 .gitignore
  5. +6 −1 Dockerfile
  6. +2 −8 Jenkinsfile
  7. +41 −2 NEWS.md
  8. +42 −1 README.md
  9. +1 −1 descriptors/ModuleDescriptor-template.json
  10. +34 −27 pom.xml
  11. +37 −1 ramls/batch-holdings.xsd
  12. +1 −0 ramls/edge-rtac.raml
  13. +52 −10 ramls/holdings.xsd
  14. +4 −16 src/main/java/org/folio/edge/rtac/MainVerticle.java
  15. +6 −3 src/main/java/org/folio/edge/rtac/RtacHandler.java
  16. +11 −3 src/main/java/org/folio/edge/rtac/model/Error.java
  17. +52 −15 src/main/java/org/folio/edge/rtac/model/Holding.java
  18. +8 −0 src/main/java/org/folio/edge/rtac/model/Holdings.java
  19. +94 −0 src/main/java/org/folio/edge/rtac/model/HoldingsStatement.java
  20. +1 −1 src/main/java/org/folio/edge/rtac/model/Instances.java
  21. +75 −0 src/main/java/org/folio/edge/rtac/model/Library.java
  22. +65 −0 src/main/java/org/folio/edge/rtac/model/MaterialType.java
  23. +0 −16 src/main/java/org/folio/edge/rtac/utils/RtacOkapiClientFactory.java
  24. +198 −137 src/test/java/org/folio/edge/rtac/MainVerticleTest.java
  25. +14 −0 src/test/java/org/folio/edge/rtac/model/InstancesTest.java
  26. +2 −0 src/test/java/org/folio/edge/rtac/utils/RtacMockOkapi.java
  27. +3 −2 src/test/java/org/folio/edge/rtac/utils/RtacOkapiClientCompressionTest.java
  28. +0 −31 src/test/java/org/folio/edge/rtac/utils/RtacOkapiClientFactoryTest.java
  29. +5 −4 src/test/java/org/folio/edge/rtac/utils/RtacOkapiClientTest.java
91 changes: 91 additions & 0 deletions .github/workflows/api-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: api-doc

# https://dev.folio.org/guides/api-doc/

# API_TYPES: string: The space-separated list of types to consider.
# One or more of 'RAML OAS'.
# e.g. 'OAS'
#
# API_DIRECTORIES: string: The space-separated list of directories to search
# for API description files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''

env:
API_TYPES: 'RAML'
API_DIRECTORIES: 'ramls'
API_EXCLUDES: ''
OUTPUT_DIR: 'folio-api-docs'
AWS_S3_BUCKET: 'foliodocs'
AWS_S3_FOLDER: 'api'
AWS_S3_REGION: 'us-east-1'
AWS_S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_S3_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}

on:
push:
branches: [ main, master ]
paths:
- 'ramls/**'
tags: '[vV][0-9]+.[0-9]+.[0-9]+*'

jobs:
api-doc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.REF }}
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-doc \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Obtain version if release tag
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
version=$(echo ${GITHUB_REF#refs/tags/[vV]} | awk -F'.' '{ printf("%d.%d", $1, $2) }')
echo "VERSION_MAJ_MIN=${version}" >> $GITHUB_ENV
- name: Set some vars
run: |
echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Report some info
run: |
echo "REPO_NAME=${{ env.REPO_NAME }}"
- name: Do api-doc
run: |
if test -n "${{ env.VERSION_MAJ_MIN }}"; then
echo "Docs for release version ${{ env.VERSION_MAJ_MIN }}"
option_release=$(echo "--version ${{ env.VERSION_MAJ_MIN }}")
else
option_release=""
fi
python3 folio-tools/api-doc/api_doc.py \
--loglevel info \
--types ${{ env.API_TYPES }} \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }} \
--output ${{ env.OUTPUT_DIR }} $option_release
- name: Show generated files
working-directory: ${{ env.OUTPUT_DIR }}
run: ls -R
- name: Publish to AWS S3
uses: sai-sharan/aws-s3-sync-action@v0.1.0
with:
access_key: ${{ env.AWS_S3_ACCESS_KEY_ID }}
secret_access_key: ${{ env.AWS_S3_ACCESS_KEY }}
region: ${{ env.AWS_S3_REGION }}
source: ${{ env.OUTPUT_DIR }}
destination_bucket: ${{ env.AWS_S3_BUCKET }}
destination_prefix: ${{ env.AWS_S3_FOLDER }}
delete: false
quiet: false

65 changes: 65 additions & 0 deletions .github/workflows/api-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: api-lint

# https://dev.folio.org/guides/api-lint/

# API_TYPES: string: The space-separated list of types to consider.
# One or more of 'RAML OAS'.
# e.g. 'OAS'
#
# API_DIRECTORIES: string: The space-separated list of directories to search
# for API description files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''
#
# API_WARNINGS: boolean: Whether to cause Warnings to be displayed,
# and to fail the workflow.
# e.g. false

env:
API_TYPES: 'RAML'
API_DIRECTORIES: 'ramls'
API_EXCLUDES: ''
API_WARNINGS: false

on:
push:
paths:
- 'ramls/**'
pull_request:
paths:
- 'ramls/**'

jobs:
api-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-lint \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Configure default options
run: |
echo "OPTION_WARNINGS=''" >> $GITHUB_ENV
- name: Configure option warnings
if: ${{ env.API_WARNINGS == 'true' }}
run: |
echo "OPTION_WARNINGS=--warnings" >> $GITHUB_ENV
- name: Do api-lint
run: |
python3 folio-tools/api-lint/api_lint.py \
--loglevel info \
--types ${{ env.API_TYPES }} \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }} \
${{ env.OPTION_WARNINGS }}
46 changes: 46 additions & 0 deletions .github/workflows/api-schema-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: api-schema-lint

# https://dev.folio.org/guides/describe-schema/

# API_DIRECTORIES: string: The space-separated list of directories to search
# for JSON Schema files.
# e.g. 'src/main/resources/openapi'
# NOTE: -- Also add each separate path to each of the "on: paths:" sections.
# e.g. 'src/main/resources/openapi/**'
#
# API_EXCLUDES: string: The space-separated list of directories and files
# to exclude from traversal, in addition to the default exclusions.
# e.g. ''

env:
API_DIRECTORIES: 'ramls'
API_EXCLUDES: ''

on:
push:
paths:
- 'ramls/**'
pull_request:
paths:
- 'ramls/**'

jobs:
api-schema-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare folio-tools
run: |
git clone https://github.com/folio-org/folio-tools
cd folio-tools/api-schema-lint \
&& yarn install \
&& pip3 install -r requirements.txt
- name: Do api-schema-lint
run: |
python3 folio-tools/api-schema-lint/api_schema_lint.py \
--loglevel info \
--directories ${{ env.API_DIRECTORIES }} \
--excludes ${{ env.API_EXCLUDES }}
18 changes: 13 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
/target/
.classpath
.project
.settings
.vertx
.idea/
/.classpath
/.settings/
*.iml
*.ipr
node_modules/
/target
/bin/
/.vertx/
/.project
/.checkstyle
/pom.xml.releaseBackup
/release.properties
.vscode/
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FROM folioci/alpine-jre-openjdk11:latest
FROM folioci/alpine-jre-openjdk17:latest

# Install latest patch versions of packages: https://pythonspeed.com/articles/security-updates-in-docker/
USER root
RUN apk upgrade --no-cache
USER folio

ENV VERTICLE_FILE edge-rtac-fat.jar

10 changes: 2 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
buildMvn {
publishModDescriptor = 'yes'
mvnDeploy = 'yes'
buildNode = 'jenkins-agent-java11'

doApiLint = true
doApiDoc = true
apiTypes = 'RAML'
apiDirectories = 'ramls'
buildNode = 'jenkins-agent-java17'

doDocker = {
buildJavaDocker {
publishMaster = 'yes'
healthChk = 'yes'
healthChkCmd = 'curl -sS --fail -o /dev/null http://localhost:8081/admin/health || exit 1'
//healthChk for /admin/health in MainVerticleTest.java
}
}
}
43 changes: 41 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
# v2.8.0 2024.10.31

* Enhance single rtac response ([EDGRTAC-93](https://folio-org.atlassian.net/browse/EDGRTAC-93))
* Update Vert.x to v4.5.10 version ([EDGRTAC-96](https://folio-org.atlassian.net/browse/EDGRTAC-96))

# v2.7.3 2024.07.03

* [EDGRTAC-89](https://folio-org.atlassian.net/browse/EDGRTAC-89) edge-common 4.7.1: AwsParamStore to support FIPS-approved crypto modules

# v2.7.2 2024.05.29

* [EDGRTAC-88](https://folio-org.atlassian.net/browse/EDGRTAC-88) Vert.x 4.5.7 fixing netty-codec-http form POST OOM CVE-2024-29025
* Remove -SNAPSHOT from edge-common:4.7.0-SNAPSHOT
* [EDGRTAC-87](https://folio-org.atlassian.net/browse/EDGRTAC-87) aws-java-sdk-ssm 1.12.729 removing ion-java CVE-2024-21634
* [EDGRTAC-86](https://folio-org.atlassian.net/browse/EDGRTAC-86) Enhance HTTP Endpoint Security with TLS and FIPS-140-2 Compliant Cryptography

# 2.7.1 2024-03-22

* US1238243: update edge-common version to 4.6.0 ([MODRTAC-109](https://folio-org.atlassian.net/browse/MODRTAC-109))

# 2.7.0 2024-03-20

* Upgrade edge-rtac Vert.x 4.5.4 ([MODRTAC-109](https://folio-org.atlassian.net/browse/MODRTAC-109))
* Add holdingsCopyNumber and ItemsCopyNumber to rtac response ([EDGRTAC-81](https://folio-org.atlassian.net/browse/EDGRTAC-81))

# 2.6.2 2023-12-07

* EDGRTAC-82: Upgrade edge-common to get refresh token rotation (RTR) ([EDGRTAC-82](https://issues.folio.org/browse/EDGRTAC-82))

# 2.6.1 2023-11-02

* Upgrade to Vert.x 4.4.6, Netty 4.1.100.Final (CVE-2023-44487) ([EDGRTAC-79](https://issues.folio.org/browse/EDGRTAC-79))

# 2.6.0 2022-10-19

* Upgrade to Log4J 2.18.0 (CVE-2021-44832) ([EDGRTAC-68](https://issues.folio.org/browse/EDGRTAC-68))
* Upgrade to edge-common 4.4.1 ([EDGRTAC-68](https://issues.folio.org/browse/EDGRTAC-68))
* Upgrade to vertx 4.3.3 ([EDGRTAC-68](https://issues.folio.org/browse/EDGRTAC-68))

# 2.5.0 2022-06-15

* Remove no longer supported vert.x completable future dependency. ([EDGRTAC-60](https://issues.folio.org/browse/EDGRTAC-60)
@@ -8,8 +47,8 @@

# 2.3.0 2021-10-05

* Upgrade to vert.x 4.x (EDGRTAC-37)
* Instance ID number is now included in responses in which holdings data could not be found or reported (EDGRTAC-43)
* Upgrade to vert.x 4.x ([EDGRTAC-37](https://issues.folio.org/browse/EDGRTAC-37))
* Instance ID number is now included in responses in which holdings data could not be found or reported ([EDGRTAC-43](https://issues.folio.org/browse/EDGRTAC-43))

# 2.2.0 2021-03-16

43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# edge-rtac

Copyright (C) 2018-2021 The Open Library Foundation
Copyright (C) 2018-2023 The Open Library Foundation

This software is distributed under the terms of the Apache License,
Version 2.0. See the file "[LICENSE](LICENSE)" for more information.
@@ -32,6 +32,47 @@ Institutional users should be granted the following permission in order to use t
/prod/rtac/folioRTAC
/rtac
```

### System Properties

| Property | Default | Description |
|------------------------|-------------|---------------------------------------------------------------------|
| `port` | `8081` | Server port to listen on |
| `okapi_url` | *required* | Where to find Okapi (URL) |
| `request_timeout_ms` | `30000` | Request Timeout |
| `log_level` | `INFO` | Log4j Log Level |
| `token_cache_capacity` | `100` | Max token cache size |
| `token_cache_ttl_ms` | `100` | How long to cache JWTs, in milliseconds (ms) |
| `secure_store` | `Ephemeral` | Type of secure store to use. Valid: `Ephemeral`, `AwsSsm`, `Vault` |
| `secure_store_props` | `NA` | Path to a properties file specifying secure store configuration |

### Env variables for TLS configuration for Http server

To configure Transport Layer Security (TLS) for the HTTP server in an edge module, the following configuration parameters should be used.
Parameters marked as Required are required only in case when TLS for the server should be enabled.

| Property | Default | Description |
|-----------------------------------------------------|------------------|---------------------------------------------------------------------------------------------|
| `SPRING_SSL_BUNDLE_JKS_WEBSERVER_KEYSTORE_TYPE` | `NA` | (Required). Set the type of the keystore. Common types include `JKS`, `PKCS12`, and `BCFKS` |
| `SPRING_SSL_BUNDLE_JKS_WEBSERVER_KEYSTORE_LOCATION` | `NA` | (Required). Set the location of the keystore file in the local file system |
| `SPRING_SSL_BUNDLE_JKS_WEBSERVER_KEYSTORE_PASSWORD` | `NA` | (Required). Set the password for the keystore |
| `SPRING_SSL_BUNDLE_JKS_WEBSERVER_KEY_ALIAS` | `NA` | Set the alias of the key within the keystore. |
| `SPRING_SSL_BUNDLE_JKS_WEBSERVER_KEY_PASSWORD` | `NA` | Optional param that points to a password of `KEY_ALIAS` if it protected |

### Env variables for TLS configuration for Web Client

To configure Transport Layer Security (TLS) for Web clients in the edge module, you can use the following configuration parameters.
Truststore parameters for configuring Web clients are optional even when `FOLIO_CLIENT_TLS_ENABLED = true`.
If truststore parameters need to be populated, `FOLIO_CLIENT_TLS_TRUSTSTORETYPE`, `FOLIO_CLIENT_TLS_TRUSTSTOREPATH` and `FOLIO_CLIENT_TLS_TRUSTSTOREPASSWORD` are required.

| Property | Default | Description |
|-----------------------------------------|-------------------|----------------------------------------------------------------------------------|
| `FOLIO_CLIENT_TLS_ENABLED` | `false` | Set whether SSL/TLS is enabled for Vertx Http Server |
| `FOLIO_CLIENT_TLS_TRUSTSTORETYPE` | `NA` | Set the type of the keystore. Common types include `JKS`, `PKCS12`, and `BCFKS` |
| `FOLIO_CLIENT_TLS_TRUSTSTOREPATH` | `NA` | Set the location of the keystore file in the local file system |
| `FOLIO_CLIENT_TLS_TRUSTSTOREPASSWORD` | `NA` | Set the password for the keystore |


## Additional information

### Issue tracker
2 changes: 1 addition & 1 deletion descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
"requires": [
{
"id": "rtac-batch",
"version": "1.0"
"version": "1.1"
},
{
"id": "login",
Loading