You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ba...@apache.org on 2024/11/05 12:58:25 UTC
(jackrabbit-oak) branch trunk updated: OAK-11233: Don't apply MongoDockerRule if the Mongo Docker image isn't actually used. (#1837)
This is an automated email from the ASF dual-hosted git repository.
baedke pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new 02e77a1229 OAK-11233: Don't apply MongoDockerRule if the Mongo Docker image isn't actually used. (#1837)
02e77a1229 is described below
commit 02e77a1229f01c974a607dc311ddf84eb7b3eb71
Author: mbaedke <ma...@gmail.com>
AuthorDate: Tue Nov 5 13:58:20 2024 +0100
OAK-11233: Don't apply MongoDockerRule if the Mongo Docker image isn't actually used. (#1837)
Implemented.
---
.../oak/plugins/document/MongoConnectionFactory.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoConnectionFactory.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoConnectionFactory.java
index 84ef3d171c..25296e3ebd 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoConnectionFactory.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoConnectionFactory.java
@@ -37,7 +37,19 @@ public class MongoConnectionFactory extends ExternalResource {
@Override
public Statement apply(Statement base, Description description) {
Statement s = super.apply(base, description);
- if (MongoDockerRule.isDockerAvailable()) {
+ MongoConnection c = null;
+ try {
+ c = MongoUtils.getConnection(MongoUtils.DB);
+ } finally {
+ try {
+ if (c != null) {
+ c.close();
+ }
+ } catch (IllegalStateException e) {
+ // may happen when connection is already closed (OAK-7447)
+ }
+ }
+ if (c == null && MongoDockerRule.isDockerAvailable()) {
s = mongo.apply(s, description);
}
return s;