delete(String table,
}
}
- /**
+ /**
* Get a record by id.
*
* All exceptions are caught and reported via the asyncResultHandler.
diff --git a/domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java b/domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java
index bea8887a4..8dd7dc590 100644
--- a/domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java
+++ b/domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java
@@ -4247,7 +4247,7 @@ static String getModuleName(final String className) {
/**
* @return the tenantId of this PostgresClient
*/
- String getTenantId() {
+ public String getTenantId() {
return tenantId;
}
diff --git a/domain-models-runtime/src/test/java/org/folio/rest/impl/TenantAPIIT.java b/domain-models-runtime/src/test/java/org/folio/rest/impl/TenantAPIIT.java
index eff8daf18..901d91891 100644
--- a/domain-models-runtime/src/test/java/org/folio/rest/impl/TenantAPIIT.java
+++ b/domain-models-runtime/src/test/java/org/folio/rest/impl/TenantAPIIT.java
@@ -3,6 +3,7 @@
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.startsWith;
import static org.mockito.Mockito.*;
import java.io.IOException;
@@ -260,6 +261,13 @@ private void testMetadata(TestContext context) {
assertThat(book.getMetadata(), is(nullValue()));
}
+ @Test
+ public void requirePostgres(TestContext context) {
+ new TenantAPI().requirePostgres(vertx.getOrCreateContext(), "990000", "99.0")
+ .onComplete(context.asyncAssertFailure(
+ e -> assertThat(e.getMessage(), startsWith("Expected PostgreSQL server version 99.0 or later"))));
+ }
+
@Test
public void previousSchemaSqlExistsTrue(TestContext context) {
TenantAPI tenantAPI = new TenantAPI();
@@ -294,6 +302,11 @@ PostgresClient postgresClient(Context context) {
return postgresClient;
}
+ @Override
+ Future requirePostgres12(Context context) {
+ return Future.succeededFuture();
+ }
+
@Override
Future tenantExists(Context context, String tenantId) {
return Future.succeededFuture(false);
@@ -318,6 +331,11 @@ PostgresClient postgresClient(Context context) {
return postgresClient;
}
+ @Override
+ Future requirePostgres12(Context context) {
+ return Future.succeededFuture();
+ }
+
@Override
Future tenantExists(Context context, String tenantId) {
return Future.succeededFuture(false);
diff --git a/domain-models-runtime/src/test/java/org/folio/rest/persist/PgUtilIT.java b/domain-models-runtime/src/test/java/org/folio/rest/persist/PgUtilIT.java
index c01fc1017..db2367b5b 100644
--- a/domain-models-runtime/src/test/java/org/folio/rest/persist/PgUtilIT.java
+++ b/domain-models-runtime/src/test/java/org/folio/rest/persist/PgUtilIT.java
@@ -413,6 +413,27 @@ public void deleteByCQLNullHeaders(TestContext testContext) {
asyncAssertSuccess(testContext, 400, "null"));
}
+ @Test
+ public void deleteByCQLWithoutCql(TestContext testContext) {
+ PgUtil.delete("users", null,
+ null, vertx.getOrCreateContext(), Users.DeleteUsersByUserIdResponse.class,
+ asyncAssertSuccess(testContext, 400, "query with CQL expression is required"));
+ }
+
+ @Test
+ public void deleteByCQLWithEmptyCql(TestContext testContext) {
+ PgUtil.delete("users", "",
+ null, vertx.getOrCreateContext(), Users.DeleteUsersByUserIdResponse.class,
+ asyncAssertSuccess(testContext, 400, "query with CQL expression is required"));
+ }
+
+ @Test
+ public void deleteByCQLWithWhitespaceCql(TestContext testContext) {
+ PgUtil.delete("users", "\t\n \t\n ",
+ null, vertx.getOrCreateContext(), Users.DeleteUsersByUserIdResponse.class,
+ asyncAssertSuccess(testContext, 400, "query with CQL expression is required"));
+ }
+
@Test
public void deleteByCQLOK(TestContext testContext) {
PostgresClient pg = PostgresClient.getInstance(vertx, "testtenant");
@@ -453,7 +474,6 @@ public void deleteByCQLOK(TestContext testContext) {
@Test
public void deleteByCQLSyntaxError(TestContext testContext) {
- PostgresClient pg = PostgresClient.getInstance(vertx, "testtenant");
PgUtil.delete("users", "username==",
okapiHeaders, vertx.getOrCreateContext(), Users.DeleteUsersByUserIdResponse.class,
asyncAssertSuccess(testContext, 400, "expected index or term, got EOF"));
@@ -461,7 +481,6 @@ public void deleteByCQLSyntaxError(TestContext testContext) {
@Test
public void deleteByCQLBadTable(TestContext testContext) {
- PostgresClient pg = PostgresClient.getInstance(vertx, "testtenant");
PgUtil.delete("users1", "username==delete_test",
okapiHeaders, vertx.getOrCreateContext(), Users.DeleteUsersByUserIdResponse.class,
asyncAssertSuccess(testContext, 400, "relation \"testtenant_raml_module_builder.users1\" does not exist"));
diff --git a/pom.xml b/pom.xml
index 08f159892..caf6a24e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.folio
raml-module-builder
- 33.2.10-SNAPSHOT
+ 33.2.11-SNAPSHOT
pom
raml-module-builder
@@ -30,8 +30,8 @@
1.9.7
5.8.1
3.8.4
- 4.2.6
- 1.6.3
+ 4.3.1
+ 1.8.4
@@ -54,14 +54,7 @@
com.google.guava
guava
- 31.0.1-jre
-
-
- com.fasterxml.jackson
- jackson-bom
- 2.13.2.20220324
- pom
- import
+ 31.1-jre
io.vertx
@@ -80,7 +73,7 @@
io.rest-assured
rest-assured
- 4.5.1
+ 5.1.0
javax.el
@@ -171,13 +164,10 @@
org.mockito
- mockito-core
- 4.3.1
-
-
- org.mockito
- mockito-junit-jupiter
- 4.3.1
+ mockito-bom
+ 4.6.0
+ pom
+ import
org.glassfish.jersey.media
@@ -192,7 +182,7 @@
org.hibernate.validator
hibernate-validator
- 6.2.2.Final
+ 6.2.3.Final
jakarta.validation
@@ -202,13 +192,18 @@
org.glassfish
- javax.el
- 3.0.1-b12
+ jakarta.el
+ 3.0.4
org.folio.okapi
okapi-common
- 4.12.0
+ 4.14.1
+
+
+ org.folio.okapi
+ okapi-testing
+ 4.14.1
org.apache.commons
@@ -218,7 +213,7 @@
org.testcontainers
testcontainers-bom
- 1.16.2
+ 1.17.2
pom
import
@@ -280,6 +275,7 @@
2.22.2
false
+ ${project.build.outputDirectory}
@@ -361,6 +357,13 @@
org.apache.maven.plugins
maven-checkstyle-plugin
3.1.2
+
+
+ com.puppycrawl.tools
+ checkstyle
+ 10.3
+
+
verify-style
diff --git a/postgres-testing/pom.xml b/postgres-testing/pom.xml
index cca302d6f..3e1bf6828 100644
--- a/postgres-testing/pom.xml
+++ b/postgres-testing/pom.xml
@@ -5,7 +5,7 @@
org.folio
raml-module-builder
- 33.2.10-SNAPSHOT
+ 33.2.11-SNAPSHOT
postgres-testing
diff --git a/testing/pom.xml b/testing/pom.xml
index b9b9a6657..5d3406253 100644
--- a/testing/pom.xml
+++ b/testing/pom.xml
@@ -5,7 +5,7 @@
org.folio
raml-module-builder
- 33.2.10-SNAPSHOT
+ 33.2.11-SNAPSHOT
testing
diff --git a/util/pom.xml b/util/pom.xml
index a99c094ea..ad78cf6ad 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -5,7 +5,7 @@
org.folio
raml-module-builder
- 33.2.10-SNAPSHOT
+ 33.2.11-SNAPSHOT
util