aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core_test/integration_test/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'jdisc_core_test/integration_test/src/test/java/com')
-rw-r--r--jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/application/BundleActivatorIntegrationTest.java16
-rw-r--r--jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/ExportPackagesIntegrationTest.java2
2 files changed, 15 insertions, 3 deletions
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();