This is an automated email from the ASF dual-hosted git repository. ggrzybek pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/karaf.git
commit 905c3fd1ae0e7fe314bb0689424f259382ba3b92 Author: Grzegorz Grzybek <gr.grzy...@gmail.com> AuthorDate: Wed Mar 3 14:50:55 2021 +0100 [KARAF-7057] Fix integration tests after Pax Transx/JMS/JDBC update --- .../enterprise/src/main/feature/feature.xml | 6 +-- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../karaf-jpa-example-provider-ds-openjpa/pom.xml | 2 +- itests/common/pom.xml | 6 +++ ...org.apache.servicemix.bundles.javax-inject.link | 20 +++++++++ .../org/apache/karaf/itests/KarafTestSupport.java | 49 ++++++++++++++++++++-- itests/test/pom.xml | 1 + .../src/test/resources/controlled-exam.properties | 29 +++++++++++++ 12 files changed, 110 insertions(+), 13 deletions(-) diff --git a/assemblies/features/enterprise/src/main/feature/feature.xml b/assemblies/features/enterprise/src/main/feature/feature.xml index 93e93af..f60de3f 100644 --- a/assemblies/features/enterprise/src/main/feature/feature.xml +++ b/assemblies/features/enterprise/src/main/feature/feature.xml @@ -31,8 +31,8 @@ <repository>mvn:org.apache.openjpa/openjpa-features/${openjpa.version}/xml/features</repository> <feature name="transaction-api" version="1.2.0"> - <bundle dependency="true">mvn:javax.interceptor/javax.interceptor-api/1.2</bundle> - <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_2</bundle> + <bundle dependency="true">mvn:javax.interceptor/javax.interceptor-api/1.2.2</bundle> + <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_3</bundle> <bundle dependency="true">mvn:javax.el/javax.el-api/3.0.0</bundle> <bundle dependency="true">mvn:javax.enterprise/cdi-api/1.2</bundle> <bundle>mvn:javax.transaction/javax.transaction-api/1.2</bundle> @@ -177,7 +177,7 @@ com.atomikos.icatch.log_base_dir=${karaf.data}/atomikos <bundle>wrap:mvn:org.dom4j/dom4j/2.1.1</bundle> <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/5.1.0.Final</bundle> <bundle>mvn:org.hibernate/hibernate-core/${hibernate.version}</bundle> - <bundle>mvn:javax.interceptor/javax.interceptor-api/1.2</bundle> + <bundle>mvn:javax.interceptor/javax.interceptor-api/1.2.2</bundle> <bundle>mvn:org.hibernate/hibernate-osgi/${hibernate.version}</bundle> <capability> osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider diff --git a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-eclipselink/pom.xml b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-eclipselink/pom.xml index 65ffbd5..5d91a95 100644 --- a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-eclipselink/pom.xml +++ b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-eclipselink/pom.xml @@ -51,7 +51,7 @@ <dependency> <groupId>javax.interceptor</groupId> <artifactId>javax.interceptor-api</artifactId> - <version>1.2</version> + <version>1.2.2</version> </dependency> </dependencies> diff --git a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-hibernate/pom.xml b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-hibernate/pom.xml index 0553303..555a0e5 100644 --- a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-hibernate/pom.xml +++ b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-hibernate/pom.xml @@ -51,7 +51,7 @@ <dependency> <groupId>javax.interceptor</groupId> <artifactId>javax.interceptor-api</artifactId> - <version>1.2</version> + <version>1.2.2</version> </dependency> </dependencies> diff --git a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-openjpa/pom.xml b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-openjpa/pom.xml index ca9d7d2..922b49f 100644 --- a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-openjpa/pom.xml +++ b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-blueprint/karaf-jpa-example-provider-blueprint-openjpa/pom.xml @@ -51,7 +51,7 @@ <dependency> <groupId>javax.interceptor</groupId> <artifactId>javax.interceptor-api</artifactId> - <version>1.2</version> + <version>1.2.2</version> </dependency> </dependencies> diff --git a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-eclipselink/pom.xml b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-eclipselink/pom.xml index cb22cea..cbb9012 100644 --- a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-eclipselink/pom.xml +++ b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-eclipselink/pom.xml @@ -63,7 +63,7 @@ <dependency> <groupId>javax.interceptor</groupId> <artifactId>javax.interceptor-api</artifactId> - <version>1.2</version> + <version>1.2.2</version> </dependency> <dependency> <groupId>org.osgi</groupId> diff --git a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-hibernate/pom.xml b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-hibernate/pom.xml index 0f07180..04f9768 100644 --- a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-hibernate/pom.xml +++ b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-hibernate/pom.xml @@ -63,7 +63,7 @@ <dependency> <groupId>javax.interceptor</groupId> <artifactId>javax.interceptor-api</artifactId> - <version>1.2</version> + <version>1.2.2</version> </dependency> <dependency> <groupId>org.osgi</groupId> diff --git a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-openjpa/pom.xml b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-openjpa/pom.xml index 08e7058..3a395f4 100644 --- a/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-openjpa/pom.xml +++ b/examples/karaf-jpa-example/karaf-jpa-example-provider/karaf-jpa-example-provider-ds/karaf-jpa-example-provider-ds-openjpa/pom.xml @@ -63,7 +63,7 @@ <dependency> <groupId>javax.interceptor</groupId> <artifactId>javax.interceptor-api</artifactId> - <version>1.2</version> + <version>1.2.2</version> </dependency> <dependency> <groupId>org.osgi</groupId> diff --git a/itests/common/pom.xml b/itests/common/pom.xml index a1b1d35..ce97066 100644 --- a/itests/common/pom.xml +++ b/itests/common/pom.xml @@ -100,6 +100,12 @@ </dependencies> <build> + <resources> + <resource> + <directory>src/main/filtered-resources</directory> + <filtering>true</filtering> + </resource> + </resources> <plugins> <plugin> <groupId>org.apache.felix</groupId> diff --git a/itests/common/src/main/filtered-resources/org.apache.servicemix.bundles.javax-inject.link b/itests/common/src/main/filtered-resources/org.apache.servicemix.bundles.javax-inject.link new file mode 100644 index 0000000..7216e21 --- /dev/null +++ b/itests/common/src/main/filtered-resources/org.apache.servicemix.bundles.javax-inject.link @@ -0,0 +1,20 @@ +################################################################################ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_3 diff --git a/itests/common/src/main/java/org/apache/karaf/itests/KarafTestSupport.java b/itests/common/src/main/java/org/apache/karaf/itests/KarafTestSupport.java index 3e9739e..990b633 100644 --- a/itests/common/src/main/java/org/apache/karaf/itests/KarafTestSupport.java +++ b/itests/common/src/main/java/org/apache/karaf/itests/KarafTestSupport.java @@ -56,8 +56,13 @@ import org.junit.Rule; import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; - -import org.ops4j.pax.exam.*; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.ConfigurationManager; +import org.ops4j.pax.exam.CoreOptions; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.ProbeBuilder; +import org.ops4j.pax.exam.RerunTestException; +import org.ops4j.pax.exam.TestProbeBuilder; import org.ops4j.pax.exam.container.remote.RBCRemoteTargetOptions; import org.ops4j.pax.exam.karaf.container.internal.JavaVersionUtil; import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; @@ -76,6 +81,13 @@ import org.osgi.util.tracker.ServiceTracker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.ops4j.pax.exam.Constants.START_LEVEL_SYSTEM_BUNDLES; +import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackage; +import static org.ops4j.pax.exam.CoreOptions.frameworkStartLevel; +import static org.ops4j.pax.exam.CoreOptions.url; +import static org.ops4j.pax.exam.CoreOptions.when; +import static org.ops4j.pax.exam.OptionUtils.combine; + public class KarafTestSupport { private static final EnumSet<FeaturesService.Option> NO_AUTO_REFRESH = EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles); @@ -187,8 +199,35 @@ public class KarafTestSupport { if (localRepository == null) { localRepository = ""; } + + // org.ops4j.pax.exam.spi.PaxExamRuntime.defaultTestSystemOptions() does it implicitly when pax.exam.system = test + ConfigurationManager cm = new ConfigurationManager(); + String logging = cm.getProperty(org.ops4j.pax.exam.Constants.EXAM_LOGGING_KEY, org.ops4j.pax.exam.Constants.EXAM_LOGGING_PAX_LOGGING); + Option[] examOptions = new Option[] { + bootDelegationPackage("sun.*"), + frameworkStartLevel(org.ops4j.pax.exam.Constants.START_LEVEL_TEST_BUNDLE), + url("link:classpath:META-INF/links/org.ops4j.pax.exam.link").startLevel(START_LEVEL_SYSTEM_BUNDLES), + url("link:classpath:META-INF/links/org.ops4j.pax.exam.inject.link").startLevel(START_LEVEL_SYSTEM_BUNDLES), + url("link:classpath:META-INF/links/org.ops4j.pax.extender.service.link").startLevel(START_LEVEL_SYSTEM_BUNDLES), + + when(logging.equals(org.ops4j.pax.exam.Constants.EXAM_LOGGING_PAX_LOGGING)).useOptions( + url("link:classpath:META-INF/links/org.ops4j.pax.logging.api.link").startLevel(START_LEVEL_SYSTEM_BUNDLES)), + + url("link:classpath:META-INF/links/org.ops4j.base.link").startLevel(START_LEVEL_SYSTEM_BUNDLES), + url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.core.link").startLevel(START_LEVEL_SYSTEM_BUNDLES), + url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.extender.link").startLevel(START_LEVEL_SYSTEM_BUNDLES), + url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.framework.link").startLevel(START_LEVEL_SYSTEM_BUNDLES), + url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.lifecycle.link").startLevel(START_LEVEL_SYSTEM_BUNDLES), + url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.tracker.link").startLevel(START_LEVEL_SYSTEM_BUNDLES), + // but we don't want geronimo atinject... +// url("link:classpath:META-INF/links/org.apache.geronimo.specs.atinject.link").startLevel(START_LEVEL_SYSTEM_BUNDLES) + // we want SMX inject 1_3 + url("link:classpath:org.apache.servicemix.bundles.javax-inject.link").startLevel(START_LEVEL_SYSTEM_BUNDLES) + }; + + Option[] testOptions = null; if (JavaVersionUtil.getMajorVersion() >= 9) { - return new Option[]{ + testOptions = new Option[] { // debugConfiguration("8889", true), KarafDistributionOption.karafDistributionConfiguration().frameworkUrl(getKarafDistribution()).name("Apache Karaf").unpackDirectory(new File("target/exam")), // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder @@ -242,7 +281,7 @@ public class KarafTestSupport { }; } else { - return new Option[]{ + testOptions = new Option[] { //debugConfiguration("8889", true), KarafDistributionOption.karafDistributionConfiguration().frameworkUrl(getKarafDistribution()).name("Apache Karaf").unpackDirectory(new File("target/exam")), // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder @@ -266,6 +305,8 @@ public class KarafTestSupport { KarafDistributionOption.editConfigurationFilePut("etc/branding-ssh.properties", "welcome", "") }; } + + return combine(examOptions, testOptions); } public static int getAvailablePort(int min, int max) { diff --git a/itests/test/pom.xml b/itests/test/pom.xml index 6b3ccf7..e5c1d73 100644 --- a/itests/test/pom.xml +++ b/itests/test/pom.xml @@ -326,6 +326,7 @@ <spring.security42.version>${spring.security42.version}</spring.security42.version> <spring.security53.version>${spring.security53.version}</spring.security53.version> <activemq.version>${activemq.version}</activemq.version> + <pax.exam.configuration>file:src/test/resources/controlled-exam.properties</pax.exam.configuration> </systemPropertyVariables> <excludes> <exclude>MavenTest</exclude> diff --git a/itests/test/src/test/resources/controlled-exam.properties b/itests/test/src/test/resources/controlled-exam.properties new file mode 100644 index 0000000..a3ddc11 --- /dev/null +++ b/itests/test/src/test/resources/controlled-exam.properties @@ -0,0 +1,29 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +# default, javaee, test (default), cdi +# for "cdi" we use PaxExam.delegate = org.ops4j.pax.exam.junit.impl.InjectingRunner +# otherwise it's PaxExam.delegate = org.ops4j.pax.exam.junit.impl.ProbeRunner +# "test" adds some default @Configuration Option[] +# "default" allows manual control over provided @Configuration/Option[] +pax.exam.system = default + +# 10000 ms by default +pax.exam.service.timeout = 3600000 + +# "pax-logging" by default which adds link:classpath:META-INF/links/org.ops4j.pax.logging.api.link;start-level=2 +pax.exam.logging = pax-logging