Skip to content

Commit

Permalink
MODFEE-391: Upgrade to RMB 35.3.0 (#295)
Browse files Browse the repository at this point in the history
* MODFEE-391 Upgrade to RMB 35.3.0

* MODFEE-391 Upgrade apache commons lang3 to 3.17.0

* MODFEE-391 Add commons-io 2.17.0

* MODFEE-391 Increase wait timeout in tests

* MODFEE-391 Do not override parameter constraint configuration

* MODFEE-391 Fix typo
  • Loading branch information
OleksandrVidinieiev authored Oct 24, 2024
1 parent 3c4fc1a commit f951b7d
Show file tree
Hide file tree
Showing 34 changed files with 396 additions and 350 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 }}
10 changes: 8 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<vertx.version>4.5.5</vertx.version>
<raml-module-builder.version>35.2.0</raml-module-builder.version>
<raml-module-builder.version>35.3.0</raml-module-builder.version>
<ramlfiles_path>${basedir}/ramls</ramlfiles_path>
<postgresrunner.port>5434</postgresrunner.port>
<!-- Postgres port for Jenkins CI build environment https://issues.folio.org/browse/METADATA-10 -->
Expand Down Expand Up @@ -166,8 +166,14 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
<version>3.17.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.17.0</version>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
Expand Down
1 change: 0 additions & 1 deletion ramls/accounts.raml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml
facets: !include raml-util/traits/facets.raml

Expand Down
1 change: 0 additions & 1 deletion ramls/actual-cost-fee-fine.raml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ types:
errors: !include raml-util/schemas/errors.schema

traits:
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml

/actual-cost-fee-fine:
Expand Down
1 change: 0 additions & 1 deletion ramls/comments.raml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml
facets: !include raml-util/traits/facets.raml

Expand Down
1 change: 0 additions & 1 deletion ramls/feefine-reports.raml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ types:

traits:
validate: !include raml-util/traits/validation.raml
language: !include raml-util/traits/language.raml

/feefine-reports:
/refund:
Expand Down
1 change: 0 additions & 1 deletion ramls/feefineactions.raml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml

resourceTypes:
Expand Down
1 change: 0 additions & 1 deletion ramls/feefines.raml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml
facets: !include raml-util/traits/facets.raml

Expand Down
1 change: 0 additions & 1 deletion ramls/lost-item-fee-policy.raml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml

resourceTypes:
Expand Down
1 change: 0 additions & 1 deletion ramls/manual-block-templates.raml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml

resourceTypes:
Expand Down
1 change: 0 additions & 1 deletion ramls/manualblocks.raml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml

resourceTypes:
Expand Down
1 change: 0 additions & 1 deletion ramls/overdue-fine-policy.raml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml

resourceTypes:
Expand Down
1 change: 0 additions & 1 deletion ramls/owners.raml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml

resourceTypes:
Expand Down
1 change: 0 additions & 1 deletion ramls/payments.raml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml
facets: !include raml-util/traits/facets.raml

Expand Down
1 change: 0 additions & 1 deletion ramls/refunds.raml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml
facets: !include raml-util/traits/facets.raml

Expand Down
1 change: 0 additions & 1 deletion ramls/transfer-criteria.raml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml

resourceTypes:
Expand Down
1 change: 0 additions & 1 deletion ramls/transfers.raml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml
facets: !include raml-util/traits/facets.raml

Expand Down
1 change: 0 additions & 1 deletion ramls/waiver.raml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ traits:
orderable: !include raml-util/traits/orderable.raml
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
language: !include raml-util/traits/language.raml
validate: !include raml-util/traits/validation.raml
facets: !include raml-util/traits/facets.raml

Expand Down
48 changes: 24 additions & 24 deletions src/main/java/org/folio/rest/impl/AccountsAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static org.folio.rest.domain.Action.REFUND;
import static org.folio.rest.domain.Action.TRANSFER;
import static org.folio.rest.domain.Action.WAIVE;
import static org.folio.rest.tools.messages.Messages.DEFAULT_LANGUAGE;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -126,10 +127,10 @@ private Future<Void> setAdditionalFields(Vertx vertx, Map<String, String> okapiH

@Validate
@Override
public void getAccounts(String query, String orderBy, AccountsGetOrder order, int offset, int limit, List<String> facets,
String lang,
Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
public void getAccounts(String query, String orderBy, AccountsGetOrder order, String totalRecords,
int offset, int limit, List<String> facets, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {

String tenantId = TenantTool.calculateTenantId(okapiHeaders.get(OKAPI_HEADER_TENANT));
List<FacetField> facetList = FacetManager.convertFacetStrings2FacetFields(facets, "jsonb");
try {
Expand Down Expand Up @@ -176,7 +177,7 @@ public void getAccounts(String query, String orderBy, AccountsGetOrder order, in
} else {
asyncResultHandler.handle(succeededFuture(
GetAccountsResponse.respond500WithTextPlain(
messages.getMessage(lang,
messages.getMessage(DEFAULT_LANGUAGE,
MessageConsts.InternalServerError))));
}
}
Expand All @@ -190,19 +191,16 @@ public void getAccounts(String query, String orderBy, AccountsGetOrder order, in
} else {
asyncResultHandler.handle(succeededFuture(
GetAccountsResponse.respond500WithTextPlain(
messages.getMessage(lang,
messages.getMessage(DEFAULT_LANGUAGE,
MessageConsts.InternalServerError))));
}
}
}

@Validate
@Override
public void postAccounts(String lang,
Account entity,
Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
public void postAccounts(Account entity, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {

PgUtil.post(ACCOUNTS_TABLE, entity, okapiHeaders, vertxContext,
PostAccountsResponse.class, post -> {
Expand All @@ -216,8 +214,9 @@ public void postAccounts(String lang,

@Validate
@Override
public void getAccountsByAccountId(String accountId, String lang, Map<String, String> okapiHeaders,
public void getAccountsByAccountId(String accountId, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {

try {
vertxContext.runOnContext(v -> {
String tenantId = TenantTool.calculateTenantId(okapiHeaders.get(OKAPI_HEADER_TENANT));
Expand All @@ -235,19 +234,19 @@ public void getAccountsByAccountId(String accountId, String lang, Map<String, St
logger.error(getReply.result());
asyncResultHandler.handle(succeededFuture(
GetAccountsByAccountIdResponse.respond500WithTextPlain(
messages.getMessage(lang, MessageConsts.InternalServerError))));
messages.getMessage(DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
} else {
List<Account> accountList = getReply.result().getResults();
if (accountList.isEmpty()) {
asyncResultHandler.handle(succeededFuture(
GetAccountsByAccountIdResponse.respond404WithTextPlain("Account"
+ messages.getMessage(lang,
+ messages.getMessage(DEFAULT_LANGUAGE,
MessageConsts.ObjectDoesNotExist))));
} else if (accountList.size() > 1) {
logger.error("Multiple accounts found with the same id");
asyncResultHandler.handle(succeededFuture(
GetAccountsByAccountIdResponse.respond500WithTextPlain(
messages.getMessage(lang,
messages.getMessage(DEFAULT_LANGUAGE,
MessageConsts.InternalServerError))));
} else {
setAdditionalFields(vertxContext.owner(), okapiHeaders, accountList)
Expand All @@ -262,20 +261,21 @@ public void getAccountsByAccountId(String accountId, String lang, Map<String, St
logger.error(e.getMessage());
asyncResultHandler.handle(succeededFuture(
GetAccountsResponse.respond500WithTextPlain(messages.getMessage(
lang, MessageConsts.InternalServerError))));
DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
}
});
} catch (Exception e) {
asyncResultHandler.handle(succeededFuture(
GetAccountsResponse.respond500WithTextPlain(messages.getMessage(
lang, MessageConsts.InternalServerError))));
DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
}
}

@Validate
@Override
public void deleteAccountsByAccountId(String accountId, String lang, Map<String, String> okapiHeaders,
public void deleteAccountsByAccountId(String accountId, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {

try {
vertxContext.runOnContext(v -> {
String tenantId = TenantTool.calculateTenantId(okapiHeaders.get(OKAPI_HEADER_TENANT));
Expand Down Expand Up @@ -304,7 +304,7 @@ public void deleteAccountsByAccountId(String accountId, String lang, Map<String,
logger.error(error, deleteReply.cause());
if (error == null) {
asyncResultHandler.handle(succeededFuture(DeleteAccountsByAccountIdResponse.respond500WithTextPlain(
messages.getMessage(lang, MessageConsts.InternalServerError))));
messages.getMessage(DEFAULT_LANGUAGE, MessageConsts.InternalServerError))));
} else {
asyncResultHandler.handle(succeededFuture(DeleteAccountsByAccountIdResponse.respond400WithTextPlain(error)));
}
Expand All @@ -315,7 +315,7 @@ public void deleteAccountsByAccountId(String accountId, String lang, Map<String,
asyncResultHandler.handle(
succeededFuture(
DeleteAccountsByAccountIdResponse.respond500WithTextPlain(
messages.getMessage(lang,
messages.getMessage(DEFAULT_LANGUAGE,
MessageConsts.InternalServerError))));
}
});
Expand All @@ -324,16 +324,16 @@ public void deleteAccountsByAccountId(String accountId, String lang, Map<String,
asyncResultHandler.handle(
succeededFuture(
DeleteAccountsByAccountIdResponse.respond500WithTextPlain(
messages.getMessage(lang,
messages.getMessage(DEFAULT_LANGUAGE,
MessageConsts.InternalServerError))));
}
}

@Validate
@Override
public void putAccountsByAccountId(String accountId, String lang,
Account entity, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
public void putAccountsByAccountId(String accountId, Account entity,
Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {

new AccountUpdateService(okapiHeaders, vertxContext)
.updateAccount(accountId, entity)
Expand Down
Loading

0 comments on commit f951b7d

Please sign in to comment.