Skip to content

Commit

Permalink
Merge branch 'master' into typo-permissionsRequired
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkurash authored Dec 1, 2024
2 parents 2341b44 + d6c6be4 commit eba4fdb
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 37 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: postgres
on:
workflow_dispatch:
inputs:
postgres:
description: "List of postgres container images, to be injected as TESTCONTAINERS_POSTGRES_IMAGE"
default: '["postgres:16-alpine", "postgres:18-alpine"]'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
postgres: ${{ fromJSON(github.event.inputs.postgres) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: maven
- run: mvn --batch-mode verify
env:
TESTCONTAINERS_POSTGRES_IMAGE: ${{ matrix.postgres }}
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 2024-11-19 v2.15.1
* [MODPUBSUB-302](https://folio-org.atlassian.net/browse/MODPUBSUB-302) Add permissions in pubsub module for MD file changes in Eureka

## 2024-10-29 v2.15.0
* [MODPUBSUB-301](https://folio-org.atlassian.net/browse/MODPUBSUB-301) Circulation logs are not displayed
* [MODPUBSUB-298](https://folio-org.atlassian.net/browse/MODPUBSUB-298) Upgrade to RMB v35.3.0
* [MODPUBSUB-296](https://folio-org.atlassian.net/browse/MODPUBSUB-296) Add new permission to the list of those granted to the pubsub system user
* [EUREKA-225](https://folio-org.atlassian.net/browse/EUREKA-225) Update module descriptors to use the "metadata" field

## 2024-06-20 v2.14.0
* [MODPUBSUB-290](https://folio-org.atlassian.net/browse/MODPUBSUB-290) Use folio-kafka-wrapper to create topics
* [EUREKA-79](https://folio-org.atlassian.net/browse/EUREKA-79) Skip retrieving token if system user is disabled
Expand Down
28 changes: 23 additions & 5 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"pathPattern": "/pubsub/event-types",
"permissionsRequired": [
"pubsub.event-types.get"
"pubsub.event-types.collection.get"
]
},
{
Expand All @@ -44,7 +44,7 @@
],
"pathPattern": "/pubsub/event-types/{eventTypeName}",
"permissionsRequired": [
"pubsub.event-types.get"
"pubsub.event-types.item.get"
]
},
{
Expand Down Expand Up @@ -220,9 +220,15 @@
],
"permissionSets": [
{
"permissionName": "pubsub.event-types.get",
"permissionName": "pubsub.event-types.collection.get",
"displayName": "PubSub - get Event Descriptor collection",
"description": "Get Event Descriptor collection"
},
{
"permissionName": "pubsub.event-types.item.get",
"displayName": "PubSub - get Event Descriptor",
"description": "Get Event Descriptor"
"description": "Get Event Descriptor",
"replaces": ["pubsub.event-types.get"]
},
{
"permissionName": "pubsub.event-types.post",
Expand Down Expand Up @@ -289,6 +295,16 @@
"displayName": "PubSub - delete publishers and subscribers declarations",
"description": "Delete publishers or subscribers"
},
{
"permissionName": "remote-storage.pub-sub-handlers.log-record-event.post",
"displayName" : "log record events from pub-sub",
"description" : "log record events received from pub-sub"
},
{
"permissionName": "audit.pub-sub-handlers.log-record-event.post",
"displayName" : "log record events from pub-sub",
"description" : "log record events received from pub-sub"
},
{
"permissionName": "pubsub.events.post",
"displayName": "PubSub - post event.",
Expand All @@ -307,7 +323,9 @@
"user": {
"type": "system",
"permissions": [
"pubsub.events.post"
"pubsub.events.post",
"audit.pub-sub-handlers.log-record-event.post",
"remote-storage.pub-sub-handlers.log-record-event.post"
]
}
},
Expand Down
12 changes: 11 additions & 1 deletion mod-pubsub-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>mod-pubsub</artifactId>
<groupId>org.folio</groupId>
<version>2.15.0-SNAPSHOT</version>
<version>2.16.0-SNAPSHOT</version>
</parent>

<properties>
Expand Down Expand Up @@ -179,6 +179,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.folio</groupId>
<artifactId>folio-module-descriptor-validator</artifactId>
<version>${folio-module-descriptor-validator.version}</version>
<executions>
<execution>
<phase/> <!-- skip execution, run in parent only -->
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
14 changes: 12 additions & 2 deletions mod-pubsub-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mod-pubsub</artifactId>
<groupId>org.folio</groupId>
<version>2.15.0-SNAPSHOT</version>
<version>2.16.0-SNAPSHOT</version>
</parent>

<properties>
Expand Down Expand Up @@ -102,7 +102,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
<version>3.17.0</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
Expand Down Expand Up @@ -390,6 +390,16 @@
</configuration>
</plugin>

<plugin>
<groupId>org.folio</groupId>
<artifactId>folio-module-descriptor-validator</artifactId>
<version>${folio-module-descriptor-validator.version}</version>
<executions>
<execution>
<phase/> <!-- skip execution, run in parent only -->
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pubsub.events.post
audit.pub-sub-handlers.log-record-event.post
remote-storage.pub-sub-handlers.log-record-event.post
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private static void waitForPostgres() {
String query = "Select 1";
AtomicBoolean isReady = new AtomicBoolean();
await()
.atMost(15, TimeUnit.SECONDS)
.atMost(120, TimeUnit.SECONDS)
.pollInterval(3, TimeUnit.SECONDS)
.alias("Is Postgres Up?")
.until(() -> {
Expand Down
44 changes: 26 additions & 18 deletions mod-pubsub-server/src/test/java/org/folio/rest/impl/PubSubIT.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package org.folio.rest.impl;

import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.when;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
import static com.github.tomakehurst.wiremock.client.WireMock.created;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.notFound;
import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.when;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;

import com.github.tomakehurst.wiremock.junit.WireMockClassRule;
import io.restassured.RestAssured;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.http.ContentType;
import io.vertx.core.json.JsonObject;
import java.nio.file.Path;
import java.util.Objects;

import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
Expand All @@ -28,6 +25,14 @@
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.images.builder.ImageFromDockerfile;
import org.testcontainers.utility.DockerImageName;

import com.github.tomakehurst.wiremock.junit.WireMockClassRule;

import io.restassured.RestAssured;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.http.ContentType;
import io.vertx.core.json.JsonObject;

/**
* Test that the shaded fat uber jar works and that the Dockerfile works.
Expand All @@ -38,6 +43,9 @@ public class PubSubIT {

private static final Network network = Network.newNetwork();

private static final DockerImageName POSTGRES_IMAGE_NAME = DockerImageName.parse(
Objects.toString(System.getenv("TESTCONTAINERS_POSTGRES_IMAGE"), "postgres:16-alpine"));

@ClassRule
public static final WireMockClassRule okapi = new WireMockClassRule();

Expand All @@ -58,13 +66,13 @@ public class PubSubIT {

@ClassRule
public static final PostgreSQLContainer<?> postgres =
new PostgreSQLContainer<>("postgres:12-alpine")
.withNetwork(network)
.withNetworkAliases("postgres")
.withExposedPorts(5432)
.withUsername("username")
.withPassword("password")
.withDatabaseName("postgres");
new PostgreSQLContainer<>(POSTGRES_IMAGE_NAME)
.withNetwork(network)
.withNetworkAliases("postgres")
.withExposedPorts(5432)
.withUsername("username")
.withPassword("password")
.withDatabaseName("postgres");

@BeforeClass
public static void beforeClass() {
Expand Down
32 changes: 23 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.folio</groupId>
<artifactId>mod-pubsub</artifactId>
<version>2.15.0-SNAPSHOT</version>
<version>2.16.0-SNAPSHOT</version>
<packaging>pom</packaging>

<licenses>
Expand All @@ -19,15 +19,18 @@
</modules>

<properties>
<raml-module-builder.version>35.2.0</raml-module-builder.version>
<vertx.version>4.5.5</vertx.version>
<raml-module-builder.version>35.3.0</raml-module-builder.version>
<vertx.version>4.5.10</vertx.version>
<lombok.version>1.18.28</lombok.version>
<wiremock.version>2.27.2</wiremock.version>
<junit.version>4.13.2</junit.version>
<rest-assured.version>5.1.1</rest-assured.version>
<rest-assured.version>5.5.0</rest-assured.version>
<main.basedir>${project.basedir}</main.basedir>
<ramlfiles_path>${basedir}/ramls</ramlfiles_path>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!--Folio dependencies properties-->
<folio-module-descriptor-validator.version>1.0.1</folio-module-descriptor-validator.version>
</properties>

<dependencyManagement>
Expand All @@ -36,7 +39,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-bom</artifactId>
<version>2.20.0</version>
<version>2.24.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -60,7 +63,7 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>1.19.0</version>
<version>1.20.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -100,7 +103,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.13.0</version>
<configuration>
<release>17</release>
<encoding>UTF-8</encoding>
Expand Down Expand Up @@ -199,7 +202,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.5.0</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
Expand Down Expand Up @@ -246,7 +249,18 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.folio</groupId>
<artifactId>folio-module-descriptor-validator</artifactId>
<version>${folio-module-descriptor-validator.version}</version>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit eba4fdb

Please sign in to comment.