Skip to content

Commit

Permalink
Always run OSGi HTTP service on random port in itests (#11523)
Browse files Browse the repository at this point in the history
It is probably always a good idea to run the OSGi HTTP service on a random available port in itests.
So when this is always done it prevents future issues and removes a bit of duplication.

Signed-off-by: Wouter Born <github@maindrain.net>
  • Loading branch information
wborn authored Nov 6, 2021
1 parent 207da1c commit d4510f3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 52 deletions.
4 changes: 4 additions & 0 deletions itests/itest-common.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Import-Package: org.osgi.framework.*;version="[1.8,2)",*
-runfw: org.eclipse.osgi
-runee: JavaSE-11

# An unused random HTTP port is used during tests to prevent resource conflicts
# This property is set by the build-helper-maven-plugin in the itests pom.xml
-runvm: -Dorg.osgi.service.http.port=${org.osgi.service.http.port}

# The integration test itself does not export anything.
Export-Package:
-exportcontents:
Expand Down
2 changes: 0 additions & 2 deletions itests/org.openhab.binding.feed.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Fragment-Host: org.openhab.binding.feed
-runblacklist: \
bnd.identity;id='org.openhab.core.storage.json'

-runvm: -Dorg.osgi.service.http.port=${org.osgi.service.http.port}

#
# done
#
Expand Down
25 changes: 0 additions & 25 deletions itests/org.openhab.binding.feed.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<name>openHAB Add-ons :: Integration Tests :: Feed Binding Tests</name>

<properties>
<org.osgi.service.http.port>9090</org.osgi.service.http.port>

<rome.version>1.15.0</rome.version>
</properties>

Expand Down Expand Up @@ -44,27 +42,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>reserve-network-port</id>
<goals>
<goal>reserve-network-port</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<portNames>
<portName>org.osgi.service.http.port</portName>
</portNames>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
2 changes: 0 additions & 2 deletions itests/org.openhab.binding.mielecloud.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Fragment-Host: org.openhab.binding.mielecloud
bnd.identity;id='org.openhab.core.storage.json',\
bnd.identity;id='org.openhab.core.storage.mapdb'

-runvm: -Dorg.osgi.service.http.port=${org.osgi.service.http.port}

#
# done
#
Expand Down
23 changes: 0 additions & 23 deletions itests/org.openhab.binding.mielecloud.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>reserve-network-port</id>
<goals>
<goal>reserve-network-port</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<portNames>
<portName>org.osgi.service.http.port</portName>
</portNames>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
19 changes: 19 additions & 0 deletions itests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

<properties>
<m2e.jdt.annotationpath>target/dependency</m2e.jdt.annotationpath>
<org.osgi.service.http.port>9090</org.osgi.service.http.port>
</properties>

<dependencies>
Expand Down Expand Up @@ -179,6 +180,24 @@
</bndruns>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>reserve-network-port</id>
<goals>
<goal>reserve-network-port</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<portNames>
<portName>org.osgi.service.http.port</portName>
</portNames>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit d4510f3

Please sign in to comment.