diff options
Diffstat (limited to 'jdisc_core_test/integration_test')
3 files changed, 21 insertions, 6 deletions
diff --git a/jdisc_core_test/integration_test/pom.xml b/jdisc_core_test/integration_test/pom.xml index e31fa122232..b1cebcdfcc6 100644 --- a/jdisc_core_test/integration_test/pom.xml +++ b/jdisc_core_test/integration_test/pom.xml @@ -8,10 +8,10 @@ <parent> <groupId>com.yahoo.vespa.jdisc_core</groupId> <artifactId>integration-test-parent</artifactId> - <version>6-SNAPSHOT</version> + <version>7-SNAPSHOT</version> </parent> <artifactId>integration_test</artifactId> - <version>6-SNAPSHOT</version> + <version>7-SNAPSHOT</version> <packaging>jar</packaging> <name>${project.artifactId}</name> <dependencies> @@ -243,8 +243,11 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <!-- Allow installing fragment bundles, see felix.framework:ExtensionManager.addExtensionBundle --> + <!-- java.lang + java.net are opened to avoid "WARNING: Illegal reflective access ... "--> + <!-- jdk.internal.loader is opened to allow installing extension bundles, see felix.framework:ExtensionManager.addExtensionBundle --> <argLine> + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED </argLine> </configuration> diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleActivatorIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleActivatorIntegrationTest.java index 03e56d7c26d..9450d2f26c1 100644 --- a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleActivatorIntegrationTest.java +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleActivatorIntegrationTest.java @@ -7,6 +7,7 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -25,8 +26,12 @@ public class BundleActivatorIntegrationTest { Class<?> serviceClass = bundle.loadClass("com.yahoo.jdisc.bundle.my_act.MyService"); assertNotNull(serviceClass); BundleContext ctx = osgi.bundleContext(); - ServiceReference<?> serviceRef = ctx.getServiceReference(serviceClass.getName()); + + ServiceReference<?>[] serviceRefs = bundle.getRegisteredServices(); + assertEquals(1, serviceRefs.length); + ServiceReference<?> serviceRef = serviceRefs[0]; assertNotNull(serviceRef); + Object service = ctx.getService(serviceRef); assertNotNull(service); assertTrue(serviceClass.isInstance(service)); @@ -37,11 +42,16 @@ public class BundleActivatorIntegrationTest { public void requireThatApplicationBundleActivatorHasAccessToCurrentContainer() throws Exception { TestDriver driver = TestDriver.newApplicationBundleInstance("app-g-act.jar", false); OsgiFramework osgi = driver.osgiFramework(); - Class<?> serviceClass = osgi.bundles().get(1).loadClass("com.yahoo.jdisc.bundle.g_act.MyService"); + Bundle bundle = osgi.bundles().get(1); + Class<?> serviceClass = bundle.loadClass("com.yahoo.jdisc.bundle.g_act.MyService"); assertNotNull(serviceClass); BundleContext ctx = osgi.bundleContext(); - ServiceReference<?> serviceRef = ctx.getServiceReference(serviceClass.getName()); + + ServiceReference<?>[] serviceRefs = bundle.getRegisteredServices(); + assertEquals(1, serviceRefs.length); + ServiceReference<?> serviceRef = serviceRefs[0]; assertNotNull(serviceRef); + Object service = ctx.getService(serviceRef); assertNotNull(service); assertTrue(serviceClass.isInstance(service)); diff --git a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ExportPackagesIntegrationTest.java b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ExportPackagesIntegrationTest.java index c965bec8544..d2c1d3b5140 100644 --- a/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ExportPackagesIntegrationTest.java +++ b/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ExportPackagesIntegrationTest.java @@ -2,6 +2,7 @@ package com.yahoo.jdisc.core; import com.yahoo.jdisc.test.TestDriver; +import org.junit.Ignore; import org.junit.Test; import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; @@ -17,6 +18,7 @@ import static org.junit.Assert.assertTrue; */ public class ExportPackagesIntegrationTest { + @Ignore // jdisc_core.jar cannot be installed as a bundle since Felix 6.0, due to exporting java.* packages. @Test public void requireThatManifestContainsExportPackage() throws BundleException { FelixFramework felix = TestDriver.newOsgiFramework(); |