Skip to content

Commit

Permalink
Upgrade to OSGi R7 and Karaf 4.3.1 (openhab#2264)
Browse files Browse the repository at this point in the history
* Aligns compile dependencies with OSGi R7
* Aligns runtime dependencies with Karaf 4.3.1
* Fixes issues due to dependency changes:
  * AudioServletTest never ending due to Jetty upgrade
  * Feature resolution failing due to Karaf activation-api no longer visible
* Uses Pax Logging as runtime dependency instead of Felix Log
  This dependency change makes itests and Demo App behave more like the actual distro
  To change the log level in itests, change the value of org.ops4j.pax.logging.DefaultServiceLog.level in itest-include.bndrun
* Adds --add-opens and nashorn.args in itest-include.bndrun to prevent some warnings being logged in itests

Related to openhab/openhab-distro#1167

Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn authored Apr 2, 2021
1 parent 4964b51 commit ef1b86c
Show file tree
Hide file tree
Showing 32 changed files with 439 additions and 468 deletions.
4 changes: 2 additions & 2 deletions bom/compile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
<description>The dependencies that are used to compile the core bundles</description>

<properties>
<jetty.version>9.4.20.v20190813</jetty.version>
<jetty.version>9.4.38.v20210224</jetty.version>
<swagger.version>2.1.7</swagger.version>
</properties>

<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<version>6.0.0</version>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
Expand Down
72 changes: 14 additions & 58 deletions bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

<properties>
<jackson.version>2.12.2</jackson.version>
<jetty.version>9.4.20.v20190813</jetty.version>
<pax.web.version>7.2.19</pax.web.version>
<jetty.version>9.4.38.v20210224</jetty.version>
<pax.logging.version>2.0.8</pax.logging.version>
<pax.web.version>7.3.13</pax.web.version>
<swagger.version>2.1.7</swagger.version>
</properties>

Expand Down Expand Up @@ -47,15 +48,15 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.13.100</version>
<version>3.16.200</version>
<scope>compile</scope>
</dependency>

<!-- Declarative Services -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>2.1.10</version>
<version>2.1.26</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand All @@ -69,7 +70,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.configadmin</artifactId>
<version>1.9.8</version>
<version>1.9.20</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -151,7 +152,7 @@
<dependency>
<groupId>org.apache.aries.spec</groupId>
<artifactId>org.apache.aries.javax.jax.rs-api</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -224,7 +225,7 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.util.promise</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -300,26 +301,6 @@
<version>1.2.3</version>
</dependency>

<!-- Several implementations need to log using SLF4J -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.3</version>
<scope>compile</scope>
</dependency>

<!-- END: Slightly modified EnRoute implementation index artifacts -->

<!-- BEG: Slightly modified EnRoute debug tools index artifacts -->
Expand Down Expand Up @@ -372,21 +353,15 @@

<!-- BEG: logging -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.log</artifactId>
<version>1.2.0</version>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-api</artifactId>
<version>${pax.logging.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.logback</artifactId>
<version>1.0.2</version>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-log4j2</artifactId>
<version>${pax.logging.version}</version>
<scope>compile</scope>
</dependency>
<!-- END: logging -->
Expand Down Expand Up @@ -554,25 +529,6 @@
<scope>compile</scope>
</dependency>

<!-- Persistence -->
<!-- <dependency> -->
<!-- <groupId>org.hibernate</groupId> -->
<!-- <artifactId>hibernate-osgi</artifactId> -->
<!-- <version>5.2.12.Final</version> -->
<!-- </dependency> -->
<!-- BEG: Needed by Hibernate, but not present as OSGi bundles in Hibernate's dependencies -->
<!-- <dependency> -->
<!-- <groupId>org.apache.servicemix.bundles</groupId> -->
<!-- <artifactId>org.apache.servicemix.bundles.antlr</artifactId> -->
<!-- <version>2.7.7_5</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.apache.servicemix.bundles</groupId> -->
<!-- <artifactId>org.apache.servicemix.bundles.dom4j</artifactId> -->
<!-- <version>1.6.1_5</version> -->
<!-- </dependency> -->
<!-- END: Needed by Hibernate, but not present as OSGi bundles in Hibernate's dependencies -->

<!-- Jetty -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.concurrent.TimeUnit;

import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.http.HttpStatus;
import org.junit.jupiter.api.Test;
import org.openhab.core.audio.AudioFormat;
Expand Down Expand Up @@ -97,15 +96,13 @@ public void onlyOneRequestToOneTimeStreamsCanBeMade() throws Exception {

String url = serveStream(audioStream);

Request request = getHttpRequest(url);

ContentResponse response = request.send();
ContentResponse response = getHttpRequest(url).send();

assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.OK_200));
assertThat("The response content was not as expected", response.getContent(), is(testByteArray));
assertThat("The response media type was not as expected", response.getMediaType(), is(MEDIA_TYPE_AUDIO_MPEG));

response = request.send();
response = getHttpRequest(url).send();

assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.NOT_FOUND_404));
}
Expand All @@ -121,9 +118,7 @@ public void requestToMultitimeStreamCannotBeDoneAfterTheTimeoutOfTheStreamHasExi

String url = serveStream(audioStream, streamTimeout);

Request request = getHttpRequest(url);

ContentResponse response = request.send();
ContentResponse response = getHttpRequest(url).send();

final long end = System.currentTimeMillis();

Expand All @@ -142,15 +137,15 @@ public void requestToMultitimeStreamCannotBeDoneAfterTheTimeoutOfTheStreamHasExi

waitForAssert(() -> {
try {
request.send();
getHttpRequest(url).send();
} catch (Exception e) {
throw new IllegalStateException(e);
}
assertThat("The audio stream was not removed from multitime streams",
audioServlet.getMultiTimeStreams().containsValue(audioStream), is(false));
});

response = request.send();
response = getHttpRequest(url).send();
assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.NOT_FOUND_404));
}
}
2 changes: 2 additions & 0 deletions features/karaf/openhab-tp/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@

<feature name="openhab.tp-jaxws" description="JAX-WS (SOAP) bundles" version="${project.version}">
<capability>openhab.tp;feature=jax-ws;version=1.4.0</capability>
<bundle start-level="10">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.2.1/1.2.1_2</bundle>
<bundle start-level="10">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.4/1.4_2</bundle>
<bundle start-level="20">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saaj-impl/1.4.0_2</bundle>
<bundle start-level="20">mvn:org.jvnet.staxex/stax-ex/1.7.4</bundle>
Expand All @@ -161,6 +162,7 @@

<feature name="openhab.tp-jose4j" description="jose4j JWT library" version="${project.version}">
<capability>openhab.tp;feature=jose4j;version=0.7.0</capability>
<bundle start-level="10">mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.2.1/1.2.1_2</bundle>
<bundle>mvn:org.bitbucket.b_c/jose4j/0.7.0</bundle>
</feature>

Expand Down
37 changes: 27 additions & 10 deletions itests/itest-include.bndrun
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-standalone: \
../../bom/runtime-index/target/index.xml;name="org.openhab.core.bom.runtime-index",\
../../bom/test-index/target/index.xml;name="org.openhab.core.bom.test-index",\
../../bom/openhab-core-index/target/local-index.xml;name="org.openhab.core.bom.openhab-core-index",\
target/index.xml;name="self"
../../bom/runtime-index/target/index.xml;name="org.openhab.core.bom.runtime-index",\
../../bom/test-index/target/index.xml;name="org.openhab.core.bom.test-index",\
../../bom/openhab-core-index/target/local-index.xml;name="org.openhab.core.bom.openhab-core-index",\
target/index.xml;name="self"

-resolve.effective: active

Expand All @@ -25,11 +25,28 @@ Export-Package:
-exportcontents:

-runrequires.ee: \
bnd.identity;id='org.apache.servicemix.specs.activation-api-1.2.1',\
bnd.identity;id='org.apache.servicemix.specs.annotation-api-1.3',\
bnd.identity;id='org.glassfish.hk2.osgi-resource-locator',\
bnd.identity;id='com.sun.xml.bind.jaxb-osgi'
bnd.identity;id='org.apache.servicemix.specs.activation-api-1.2.1',\
bnd.identity;id='org.apache.servicemix.specs.annotation-api-1.3',\
bnd.identity;id='org.glassfish.hk2.osgi-resource-locator',\
bnd.identity;id='com.sun.xml.bind.jaxb-osgi'

-runrequires.junit: \
bnd.identity;id='biz.aQute.tester.junit-platform',\
bnd.identity;id='junit-jupiter-engine'
bnd.identity;id='biz.aQute.tester.junit-platform',\
bnd.identity;id='junit-jupiter-engine'

-runproperties: \
nashorn.args=--no-deprecation-warning,\
org.ops4j.pax.logging.DefaultServiceLog.level=WARN

-runvm.java9plus: \
--add-opens=java.base/java.io=ALL-UNNAMED,\
--add-opens=java.base/java.lang=ALL-UNNAMED,\
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED,\
--add-opens=java.base/java.net=ALL-UNNAMED,\
--add-opens=java.base/java.security=ALL-UNNAMED,\
--add-opens=java.base/java.text=ALL-UNNAMED,\
--add-opens=java.base/java.time=ALL-UNNAMED,\
--add-opens=java.base/java.util=ALL-UNNAMED,\
--add-opens=java.desktop/java.awt.font=ALL-UNNAMED,\
--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED,\
--add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED
34 changes: 17 additions & 17 deletions itests/org.openhab.core.auth.oauth2client.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,12 @@ Fragment-Host: org.openhab.core.auth.oauth2client
#
-runbundles: \
javax.measure.unit-api;version='[1.0.0,1.0.1)',\
org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
org.osgi.service.event;version='[1.4.0,1.4.1)',\
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
slf4j.api;version='[1.7.25,1.7.26)',\
ch.qos.logback.classic;version='[1.2.3,1.2.4)',\
org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\
tec.uom.lib.uom-lib-common;version='[1.0.3,1.0.4)',\
tec.uom.se;version='[1.0.10,1.0.11)',\
org.eclipse.jetty.client;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.http;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.io;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.security;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.server;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.websocket.api;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.websocket.client;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.websocket.common;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.xml;version='[9.4.20,9.4.21)',\
org.hamcrest;version='[2.2.0,2.2.1)',\
org.opentest4j;version='[1.2.0,1.2.1)',\
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
Expand All @@ -54,4 +38,20 @@ Fragment-Host: org.openhab.core.auth.oauth2client
org.objenesis;version='[3.1.0,3.1.1)',\
org.glassfish.hk2.osgi-resource-locator;version='[1.0.3,1.0.4)',\
biz.aQute.tester.junit-platform;version='[5.3.0,5.3.1)',\
com.google.gson;version='[2.8.6,2.8.7)'
com.google.gson;version='[2.8.6,2.8.7)',\
org.apache.felix.configadmin;version='[1.9.20,1.9.21)',\
org.apache.felix.scr;version='[2.1.26,2.1.27)',\
org.eclipse.jetty.client;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.http;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.io;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.security;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.server;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.servlet;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.util;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.util.ajax;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.websocket.api;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.websocket.client;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.websocket.common;version='[9.4.38,9.4.39)',\
org.ops4j.pax.logging.pax-logging-api;version='[2.0.8,2.0.9)',\
org.osgi.util.function;version='[1.1.0,1.1.1)',\
org.osgi.util.promise;version='[1.1.1,1.1.2)'
23 changes: 12 additions & 11 deletions itests/org.openhab.core.automation.integration.tests/itest.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,13 @@ Fragment-Host: org.openhab.core.automation
# done
#
-runbundles: \
ch.qos.logback.classic;version='[1.2.3,1.2.4)',\
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
javax.measure.unit-api;version='[1.0.0,1.0.1)',\
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
org.osgi.service.event;version='[1.4.0,1.4.1)',\
slf4j.api;version='[1.7.25,1.7.26)',\
tec.uom.lib.uom-lib-common;version='[1.0.3,1.0.4)',\
tec.uom.se;version='[1.0.10,1.0.11)',\
org.eclipse.jetty.http;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.io;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.security;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.server;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
org.hamcrest;version='[2.2.0,2.2.1)',\
org.opentest4j;version='[1.2.0,1.2.1)',\
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
Expand All @@ -48,4 +38,15 @@ Fragment-Host: org.openhab.core.automation
junit-platform-launcher;version='[1.7.0,1.7.1)',\
org.glassfish.hk2.osgi-resource-locator;version='[1.0.3,1.0.4)',\
biz.aQute.tester.junit-platform;version='[5.3.0,5.3.1)',\
com.google.gson;version='[2.8.6,2.8.7)'
com.google.gson;version='[2.8.6,2.8.7)',\
org.apache.felix.scr;version='[2.1.26,2.1.27)',\
org.eclipse.jetty.http;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.io;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.security;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.server;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.servlet;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.util;version='[9.4.38,9.4.39)',\
org.eclipse.jetty.util.ajax;version='[9.4.38,9.4.39)',\
org.ops4j.pax.logging.pax-logging-api;version='[2.0.8,2.0.9)',\
org.osgi.util.function;version='[1.1.0,1.1.1)',\
org.osgi.util.promise;version='[1.1.1,1.1.2)'
Loading

0 comments on commit ef1b86c

Please sign in to comment.