You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2021/05/25 13:37:16 UTC

[sling-org-apache-sling-starter] branch SLING-10402/also-test-mongo updated: SLING-10402 - make mongo port dynamic for testing (does not work yet)

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch SLING-10402/also-test-mongo
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter.git


The following commit(s) were added to refs/heads/SLING-10402/also-test-mongo by this push:
     new 9016e1b  SLING-10402 - make mongo port dynamic for testing (does not work yet)
9016e1b is described below

commit 9016e1b2da3f80062842dd7feb07888feb4d1f29
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue May 25 15:36:57 2021 +0200

    SLING-10402 - make mongo port dynamic for testing (does not work yet)
---
 pom.xml                                            | 25 +++++++---------------
 .../oak/persistence/oak_persistence_mongods.json   |  5 ++++-
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/pom.xml b/pom.xml
index 05d6128..3ebcf6e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,6 +50,9 @@
         <groovy.version>3.0.7</groovy.version>
         <!-- skip index generation for all builds except for CI and release -->
         <bnd.index.generation.skip>true</bnd.index.generation.skip>
+
+        <!-- TODO remove this to get a dynamic mongo.port -->
+        <mongo.port>27017</mongo.port>
     </properties>
 
     <build>
@@ -182,7 +185,7 @@
                     </execution>
                 </executions>
             </plugin>
-            <!-- reserve a network port for the integration tests -->
+            <!-- reserve network ports for the integration tests -->
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>build-helper-maven-plugin</artifactId>
@@ -196,18 +199,8 @@
                         <configuration>
                             <portNames>
                                 <portName>http.port</portName>
-                            </portNames>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>reserve-network-port-mongo</id>
-                        <goals>
-                            <goal>reserve-network-port</goal>
-                        </goals>
-                        <phase>pre-integration-test</phase>
-                        <configuration>
-                            <portNames>
                                 <portName>http.port.mongo</portName>
+                                <portName>mongo.port</portName>
                             </portNames>
                         </configuration>
                     </execution>
@@ -230,11 +223,7 @@
                             <name>mongo:4.4.6</name>
                             <run>
                                 <ports>
-                                    <!--
-                                        TODO the local port should by dynamic for tests, but
-                                        currently the oak feature file hardcodes the default port
-                                    -->
-                                    <port>27017:27017</port>
+                                    <port>${mongo.port}:27017</port>
                                 </ports>
                                 <wait>
                                     <log>CONTROL</log>
@@ -296,6 +285,8 @@
                             <launcherArguments>
                                 <frameworkProperties>
                                     <org.osgi.service.http.port>${http.port.mongo}</org.osgi.service.http.port>
+                                    <!-- TODO this does not seem to work, for now mongo.port must be 27017 -->
+                                    <mongo.port>${mongo.port}</mongo.port>
                                 </frameworkProperties>
                             </launcherArguments>
                         </launch>
diff --git a/src/main/features/oak/persistence/oak_persistence_mongods.json b/src/main/features/oak/persistence/oak_persistence_mongods.json
index bbdfef0..11c17ce 100644
--- a/src/main/features/oak/persistence/oak_persistence_mongods.json
+++ b/src/main/features/oak/persistence/oak_persistence_mongods.json
@@ -1,4 +1,7 @@
 {
+    "variables": {
+        "mongo.port":"27017"
+    },
     "bundles":[
          {
              "id":"com.h2database:h2-mvstore:1.4.200",
@@ -13,7 +16,7 @@
     "configurations":{
         "org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService":{
             "db":"sling",
-            "mongouri":"mongodb://localhost:27017"
+            "mongouri":"mongodb://localhost:${mongo.port}"
          }
     }
 }