Skip to content

Commit

Permalink
Merge branch 'master' into CIRCSTORE-270
Browse files Browse the repository at this point in the history
  • Loading branch information
mtraneis authored Feb 26, 2021
2 parents 2ad715a + d7ce11d commit 27c33a9
Show file tree
Hide file tree
Showing 24 changed files with 190 additions and 229 deletions.
6 changes: 3 additions & 3 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
},
{
"id": "_tenant",
"version": "1.2",
"version": "2.0",
"interfaceType": "system",
"handlers": [
{
Expand All @@ -404,8 +404,8 @@
"pubsub.subscribers.post"
]
}, {
"methods": ["DELETE"],
"pathPattern": "/_/tenant"
"methods": ["GET", "DELETE"],
"pathPattern": "/_/tenant/{id}"
}
]
},
Expand Down
45 changes: 26 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.7</version>
<version>2.10.6</version>
</dependency>
<dependency>
<groupId>org.folio</groupId>
<artifactId>domain-models-runtime</artifactId>
<version>${raml-module-builder-version}</version>
<version>32.1.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand All @@ -71,7 +71,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.4.2</version>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -86,7 +86,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<version>1.18.16</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -110,13 +110,13 @@
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
<version>4.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.folio</groupId>
<artifactId>mod-pubsub-client</artifactId>
<version>1.3.1</version>
<version>2.0.0</version>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
Expand All @@ -133,7 +133,7 @@
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<version>2.24.0</version>
<version>2.25.1</version>
<exclusions>
<exclusion>
<groupId>net.sf.jopt-simple</groupId>
Expand All @@ -142,17 +142,24 @@
</exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.13</version>
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<ramlfiles_path>${basedir}/ramls</ramlfiles_path>
<raml-module-builder-version>31.1.5</raml-module-builder-version>
<vertx-version>3.9.4</vertx-version>
<lombok.version>1.18.12</lombok.version>
<vertx-version>4.0.0</vertx-version>
<spring.version>5.2.7.RELEASE</spring.version>
<rest-assured.version>3.3.0</rest-assured.version>
<argLine />
</properties>

Expand Down Expand Up @@ -199,7 +206,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<version>3.0.0</version>
<executions>
<execution>
<id>generate_interfaces</id>
Expand All @@ -209,7 +216,6 @@
</goals>
<configuration>
<mainClass>org.folio.rest.tools.GenerateRunner</mainClass>
<!-- <executable>java</executable> -->
<cleanupDaemonThreads>false</cleanupDaemonThreads>
<systemProperties>
<systemProperty>
Expand All @@ -224,7 +230,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<version>3.2.0</version>
<executions>
<execution>
<id>addGeneratedSourceFolder</id>
Expand Down Expand Up @@ -305,17 +311,18 @@
</execution>
</executions>
<configuration>
<outputFile/>
<properties>
<property>
<name>log4j.configuration</name>
<name>log4j.configurationFile</name>
<value>${project.baseUri}src/main/resources/log4j.properties</value>
</property>
</properties>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
Expand Down Expand Up @@ -387,7 +394,7 @@
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<version>1.0.1</version>
<executions>
<execution>
<id>rename-descriptor-outputs</id>
Expand Down Expand Up @@ -421,7 +428,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<version>3.2.4</version>
<configuration>
<filters>
<filter>
Expand Down Expand Up @@ -457,7 +464,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<version>3.0.0-M5</version>
<configuration>
<!-- TODO: update to version 3.0.0 and remove useSystemClassLoader
https://issues.folio.org/browse/CIRCSTORE-78
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Promise;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.RowSet;

public class AnonymizeStorageLoansAPI implements AnonymizeStorageLoans {
private static final Logger log = LoggerFactory.getLogger(
MethodHandles.lookup().lookupClass());
private static final Logger log = LogManager.getLogger();

@Override
public void postAnonymizeStorageLoans(AnonymizeStorageLoansRequest request,
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/folio/rest/impl/CancellationReasonsAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import io.vertx.core.Context;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.folio.rest.annotations.Validate;
import org.folio.rest.jaxrs.model.CancellationReason;
import org.folio.rest.jaxrs.model.CancellationReasons;
Expand All @@ -23,7 +23,7 @@
*/
public class CancellationReasonsAPI implements CancellationReasonStorage {

private static final Logger logger = LoggerFactory.getLogger(CancellationReasonsAPI.class);
private static final Logger logger = LogManager.getLogger();
private static final String TABLE_NAME = "cancellation_reason";
private boolean suppressErrorResponse = false;

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/folio/rest/impl/CirculationRulesAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import io.vertx.core.Context;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

import org.folio.rest.jaxrs.model.CirculationRules;
import org.folio.rest.jaxrs.resource.CirculationRulesStorage;
Expand All @@ -20,7 +20,7 @@
import java.util.Map;

public class CirculationRulesAPI implements CirculationRulesStorage {
private static final Logger log = LoggerFactory.getLogger(CirculationRulesStorage.class);
private static final Logger log = LogManager.getLogger();
static final String CIRCULATION_RULES_TABLE = "circulation_rules";

private void internalErrorGet(Handler<AsyncResult<Response>> asyncResultHandler, Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.folio.rest.impl;

import io.vertx.core.*;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.folio.rest.annotations.Validate;
import org.folio.rest.jaxrs.model.Errors;
import org.folio.rest.jaxrs.model.FixedDueDateSchedule;
Expand All @@ -25,7 +25,7 @@

public class FixedDueDateSchedulesAPI implements FixedDueDateScheduleStorage {

private static final Logger log = LoggerFactory.getLogger(FixedDueDateSchedulesAPI.class);
private static final Logger log = LogManager.getLogger();
private static final String FIXED_SCHEDULE_TABLE = "fixed_due_date_schedule";
private static final String INVALID_DATE_MSG = "Unable to save fixed loan date. Date range not valid";

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/folio/rest/impl/LoansAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Handler;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

public class LoansAPI implements LoanStorage {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final Logger log = LogManager.getLogger();

@Override
public void deleteLoanStorageLoans(
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/folio/rest/impl/PatronActionSessionAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Handler;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.RowSet;

public class PatronActionSessionAPI implements PatronActionSessionStorage {

private static final String PATRON_ACTION_SESSION_TABLE = "patron_action_session";
private static final String INTERNAL_SERVER_ERROR = "Internal Server Error";
private static final Logger LOGGER = LoggerFactory.getLogger(PatronActionSessionAPI.class);
private static final Logger LOGGER = LogManager.getLogger();
private static final String PATRON_ID = "patronId";
private static final String ACTION_TYPE = "actionType";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Promise;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.RowSet;

Expand All @@ -57,7 +57,7 @@

public class PatronNoticePoliciesAPI implements PatronNoticePolicyStorage {

private static final Logger logger = LoggerFactory.getLogger(PatronNoticePoliciesAPI.class);
private static final Logger logger = LogManager.getLogger();

public static final String PATRON_NOTICE_POLICY_TABLE = "patron_notice_policy";
public static final String STATUS_CODE_DUPLICATE_NAME = "duplicate.name";
Expand Down Expand Up @@ -249,7 +249,7 @@ private Errors createNotUniqueNameErrors(String name) {
private Future<CirculationRules> findCirculationRules(PostgresClient pgClient) {

Promise<Results<CirculationRules>> promise = Promise.promise();
pgClient.get(CIRCULATION_RULES_TABLE, CirculationRules.class, new Criterion(), false, promise.future());
pgClient.get(CIRCULATION_RULES_TABLE, CirculationRules.class, new Criterion(), false, promise);
return promise.future().map(Results::getResults)
.compose(list -> list.size() == 1 ? succeededFuture(list) :
failedFuture(new IllegalStateException("Number of records in circulation_rules table is " + list.size())))
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/folio/rest/impl/RequestPoliciesAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import io.vertx.core.Context;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

import org.folio.cql2pgjson.CQL2PgJSON;
import org.folio.rest.annotations.Validate;
Expand All @@ -27,7 +27,7 @@
import static org.folio.rest.impl.Headers.TENANT_HEADER;

public class RequestPoliciesAPI implements RequestPolicyStorage {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final Logger log = LogManager.getLogger();

private static final String REQUEST_POLICY_TABLE = "request_policy";
private static final Class<RequestPolicy> REQUEST_POLICY_CLASS = RequestPolicy.class;
Expand Down
15 changes: 4 additions & 11 deletions src/main/java/org/folio/rest/impl/ScheduledNoticesAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Promise;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.RowSet;

Expand All @@ -34,7 +34,7 @@

public class ScheduledNoticesAPI implements ScheduledNoticeStorage {

private static final Logger logger = LoggerFactory.getLogger(ScheduledNoticeStorage.class);
private static final Logger logger = LogManager.getLogger();

private static final String SCHEDULED_NOTICE_TABLE = "scheduled_notice";
private static final String INTERNAL_SERVER_ERROR = "Internal Server Error";
Expand Down Expand Up @@ -62,7 +62,7 @@ public void deleteScheduledNoticeStorageScheduledNotices(String query,
PostgresClient pgClient = PgUtil.postgresClient(vertxContext, okapiHeaders);

cqlToSqlDeleteQuery(query, okapiHeaders.get(RestVerticle.OKAPI_HEADER_TENANT))
.compose(sql -> executeSql(pgClient, sql))
.compose(sql -> pgClient.execute(sql))
.map(v -> DeleteScheduledNoticeStorageScheduledNoticesResponse.respond204())
.map(Response.class::cast)
.otherwise(this::mapExceptionToResponse)
Expand Down Expand Up @@ -115,13 +115,6 @@ public void putScheduledNoticeStorageScheduledNoticesByScheduledNoticeId(String

}

private Future<Void> executeSql(PostgresClient pgClient, String sql) {

Promise<RowSet<Row>> promise = Promise.promise();
pgClient.execute(sql, promise.future());
return promise.future().map(ur -> null);
}

private Future<String> cqlToSqlDeleteQuery(String cql, String tenant) {

String sql = format("DELETE FROM %s.%s", convertToPsqlStandard(tenant), SCHEDULED_NOTICE_TABLE);
Expand Down
Loading

0 comments on commit 27c33a9

Please sign in to comment.