diff --git a/osgi/service/src/main/java/org/jboss/as/osgi/service/BundleLifecycleIntegration.java b/osgi/service/src/main/java/org/jboss/as/osgi/service/BundleLifecycleIntegration.java index fc230f874ae0..6c53061e267a 100644 --- a/osgi/service/src/main/java/org/jboss/as/osgi/service/BundleLifecycleIntegration.java +++ b/osgi/service/src/main/java/org/jboss/as/osgi/service/BundleLifecycleIntegration.java @@ -72,9 +72,11 @@ import org.jboss.osgi.resolver.XResolveContext; import org.jboss.osgi.resolver.XResolver; import org.jboss.vfs.VFSUtils; +import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; import org.osgi.framework.startlevel.BundleStartLevel; +import org.osgi.framework.startlevel.FrameworkStartLevel; import org.osgi.service.resolver.ResolutionException; /** @@ -253,9 +255,11 @@ public void uninstall(XBundle bundle, int options) throws BundleException { private void activateDeferredPhase(XBundle bundle, int options, DeploymentUnit depUnit, ServiceController phaseService) throws BundleException { // If the Framework's current start level is less than this bundle's start level + BundleManager bundleManager = injectedBundleManager.getValue(); + FrameworkStartLevel frameworkStartLevel = bundleManager.getSystemBundle().adapt(FrameworkStartLevel.class); BundleStartLevel bundleStartLevel = bundle.adapt(BundleStartLevel.class); int startlevel = bundleStartLevel.getStartLevel(); - if (startlevel > bundleStartLevel.getStartLevel()) { + if (startlevel > frameworkStartLevel.getStartLevel()) { LOGGER.debugf("Start level [%d] not valid for: %s", startlevel, bundle); return; } @@ -287,8 +291,20 @@ private void activateDeferredPhase(XBundle bundle, int options, DeploymentUnit d } // In case of failure we go back to NEVER - if (failed.size() > 0) { + if (failed.size() == 0) { + // The Bundle.ACTIVE service is not tracked by the {@link StabilityMonitor} + // Wait for it to come up explicitly + ServiceName activeName = bundleManager.getServiceName(bundle, Bundle.ACTIVE); + ServiceContainer serviceContainer = bundleManager.getServiceContainer(); + ServiceController activeService = serviceContainer.getRequiredService(activeName); + try { + FutureServiceValue future = new FutureServiceValue<>(activeService, State.UP); + future.get(2, TimeUnit.SECONDS); + } catch (Exception ex) { + // ignore + } + } else { // Collect the first start exception StartException startex = null; for (ServiceController aux : failed) { diff --git a/pom.xml b/pom.xml index dfbfc7e7c048..db7e410e8e8f 100644 --- a/pom.xml +++ b/pom.xml @@ -184,7 +184,7 @@ 1.2.0.CR2 1.1.1.Final 2.0.0.CR1 - 3.0.0.CR2 + 3.0.0.CR4 1.0.0.Final 3.0.0.Alpha5 4.0.0.Alpha6 diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/embedded/osgi/bootstrap/StandaloneBootstrapTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/embedded/osgi/bootstrap/StandaloneBootstrapTestCase.java index 07b3d993b43f..8d9ec605ece6 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/embedded/osgi/bootstrap/StandaloneBootstrapTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/embedded/osgi/bootstrap/StandaloneBootstrapTestCase.java @@ -44,7 +44,6 @@ * @author Thomas.Diesler@jboss.com * @since 12-Dec-2012 */ -@org.junit.Ignore("AS7-6511") public class StandaloneBootstrapTestCase { private static final String BUNDLE_A = "bundleA"; diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/LogServiceDynamicImportTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/LogServiceDynamicImportTestCase.java index a9cb60eba500..d1b55fbcff91 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/LogServiceDynamicImportTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/LogServiceDynamicImportTestCase.java @@ -28,7 +28,6 @@ import org.jboss.shrinkwrap.api.asset.Asset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.osgi.framework.Bundle; @@ -43,7 +42,6 @@ * @author thomas.diesler@jboss.com */ @RunWith(Arquillian.class) -@Ignore("AS7-6647") public class LogServiceDynamicImportTestCase { private static final String BUNDLE_A = "bundleA"; diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/LogServiceStaticImportTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/LogServiceStaticImportTestCase.java index b25ee18b1589..efb805bde07c 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/LogServiceStaticImportTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/LogServiceStaticImportTestCase.java @@ -42,7 +42,6 @@ * @author thomas.diesler@jboss.com */ @RunWith(Arquillian.class) -@org.junit.Ignore("AS7-6511") public class LogServiceStaticImportTestCase { private static final String BUNDLE_A = "bundleA"; diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/OptionalImportTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/OptionalImportTestCase.java index a9f13bc8b6e4..4c1e8d5322b7 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/OptionalImportTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/classloading/OptionalImportTestCase.java @@ -34,7 +34,6 @@ import org.jboss.shrinkwrap.api.asset.Asset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.osgi.framework.Bundle; @@ -47,7 +46,6 @@ * @since 23-Aug-2011 */ @RunWith(Arquillian.class) -@Ignore("AS7-6647") public class OptionalImportTestCase { static final String BUNDLE_A = "optional-import-a"; diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/configadmin/ConfigAdminIntegrationTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/configadmin/ConfigAdminIntegrationTestCase.java index e70737a54f58..b0145f1e05b3 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/configadmin/ConfigAdminIntegrationTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/configadmin/ConfigAdminIntegrationTestCase.java @@ -68,7 +68,6 @@ * @since 30-Sep-2012 */ @RunWith(Arquillian.class) -@org.junit.Ignore("AS7-6511") public class ConfigAdminIntegrationTestCase { static final String CONFIG_ADMIN_BUNDLE_A = "config-admin-bundle-a"; diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/core/StartLevelTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/core/StartLevelTestCase.java index 8df452cf0098..0e364e1424f0 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/core/StartLevelTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/core/StartLevelTestCase.java @@ -46,7 +46,6 @@ * @since 07-Jun-2011 */ @RunWith(Arquillian.class) -@org.junit.Ignore("AS7-6511") public class StartLevelTestCase { private static final String BUNDLE_A = "osgi-startlevel-a"; @@ -69,7 +68,7 @@ public InputStream openStream() { OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance(); builder.addBundleSymbolicName(archive.getName()); builder.addBundleManifestVersion(2); - builder.addImportPackages(ServiceTracker.class); + builder.addImportPackages(FrameworkStartLevel.class, ServiceTracker.class); return builder.openStream(); } }); diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/ArquillianDeployerTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/ArquillianDeployerTestCase.java index f8e67b3f97e8..a4e060b191c3 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/ArquillianDeployerTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/ArquillianDeployerTestCase.java @@ -31,7 +31,6 @@ import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.Asset; import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.osgi.framework.Bundle; @@ -45,7 +44,6 @@ * @since 09-Sep-2010 */ @RunWith(Arquillian.class) -@Ignore("AS7-6647") public class ArquillianDeployerTestCase { private static final String DEPLOYMENT_NAME = "arquillian-deployer-test-bundle"; diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/DeferredResolveTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/DeferredResolveTestCase.java index 79dbea43bda6..b9fc085e8808 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/DeferredResolveTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/DeferredResolveTestCase.java @@ -37,7 +37,6 @@ import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.osgi.framework.Bundle; @@ -56,7 +55,6 @@ * @since 25-Sep-2012 */ @RunWith(Arquillian.class) -@Ignore("AS7-6647") public class DeferredResolveTestCase { private static final String GOOD_BUNDLE = "good-bundle.jar"; @@ -87,7 +85,7 @@ public InputStream openStream() { builder.addBundleSymbolicName(archive.getName()); builder.addBundleManifestVersion(2); builder.addImportPackages(ModelControllerClient.class, ModelNode.class, ManagementClient.class); - builder.addImportPackages(ServiceTracker.class); + builder.addImportPackages(FrameworkStartLevel.class, FrameworkWiring.class, ServiceTracker.class); builder.addImportPackages(XBundle.class); return builder.openStream(); } @@ -150,7 +148,6 @@ public void testFailOnDeploy() throws Exception { } @Test - @org.junit.Ignore("AS7-6511") public void testFailAPICall() throws Exception { InputStream input = deployer.getDeployment(BAD_BUNDLE); Bundle bundle = context.installBundle(BAD_BUNDLE, input); @@ -174,7 +171,6 @@ public void testFailAPICall() throws Exception { } @Test - @org.junit.Ignore("AS7-6511") public void testFailStartLevel() throws Exception { int orglevel = FrameworkUtils.getFrameworkStartLevel(context); InputStream input = deployer.getDeployment(BAD_BUNDLE); diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/DeploymentMarkerTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/DeploymentMarkerTestCase.java index f9800767d379..b117353a57a7 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/DeploymentMarkerTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/DeploymentMarkerTestCase.java @@ -30,7 +30,6 @@ import org.jboss.shrinkwrap.api.asset.Asset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.osgi.framework.Bundle; @@ -45,7 +44,6 @@ * @since 19-Oct-2012 */ @RunWith(Arquillian.class) -@Ignore("AS7-6647") public class DeploymentMarkerTestCase { static final String BUNDLE_A = "deploymentmarker-bundle-a"; @@ -67,6 +65,7 @@ public InputStream openStream() { OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance(); builder.addBundleSymbolicName(archive.getName()); builder.addBundleManifestVersion(2); + builder.addImportPackages(BundleStartLevel.class); return builder.openStream(); } }); diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/ServerDeploymentTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/ServerDeploymentTestCase.java index 341954fa6c21..74123a5206b8 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/ServerDeploymentTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/deployment/ServerDeploymentTestCase.java @@ -39,7 +39,6 @@ import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.osgi.framework.Bundle; @@ -55,7 +54,6 @@ * @since 22-Mar-2012 */ @RunWith(Arquillian.class) -@Ignore("AS7-6647") public class ServerDeploymentTestCase { static final String GOOD_BUNDLE = "good-bundle.jar"; @@ -98,7 +96,7 @@ public void testAutoStart() throws Exception { String runtimeName = server.deploy("auto-start", input); // Find the deployed bundle - Bundle bundle = context.getBundle(GOOD_BUNDLE); + Bundle bundle = context.getBundle("auto-start"); Assert.assertEquals("Bundle ACTIVE", Bundle.ACTIVE, bundle.getState()); server.undeploy(runtimeName); @@ -128,7 +126,7 @@ public void testRedeployAfterUndeploy() throws Exception { String runtimeName = server.deploy("redeploy", input); // Find the deployed bundle - Bundle bundle = context.getBundle(GOOD_BUNDLE); + Bundle bundle = context.getBundle("redeploy"); Assert.assertEquals("Bundle ACTIVE", Bundle.ACTIVE, bundle.getState()); server.undeploy(runtimeName); @@ -139,7 +137,7 @@ public void testRedeployAfterUndeploy() throws Exception { runtimeName = server.deploy("redeploy", input); // Find the deployed bundle - bundle = context.getBundle(GOOD_BUNDLE); + bundle = context.getBundle("redeploy"); Assert.assertEquals("Bundle ACTIVE", Bundle.ACTIVE, bundle.getState()); server.undeploy(runtimeName); @@ -156,7 +154,7 @@ public void testAttachedFragment() throws Exception { String fragmentName = server.deploy("bundle-fragment-attached", input); // Find the deployed bundle - Bundle fragment = context.getBundle(GOOD_FRAGMENT); + Bundle fragment = context.getBundle("bundle-fragment-attached"); Assert.assertEquals("Bundle INSTALLED", Bundle.INSTALLED, fragment.getState()); // Deploy the bundle @@ -164,7 +162,7 @@ public void testAttachedFragment() throws Exception { String hostName = server.deploy("bundle-host-attached", input); // Find the deployed bundle - Bundle host = context.getBundle(GOOD_BUNDLE); + Bundle host = context.getBundle("bundle-host-attached"); Assert.assertEquals("Bundle ACTIVE", Bundle.ACTIVE, host.getState()); Assert.assertEquals("Bundle RESOLVED", Bundle.RESOLVED, fragment.getState()); @@ -189,7 +187,7 @@ public void testUnattachedFragment() throws Exception { String hostName = server.deploy("bundle-host", input); // Find the deployed bundle - Bundle host = context.getBundle(GOOD_BUNDLE); + Bundle host = context.getBundle("bundle-host"); Assert.assertEquals("Bundle ACTIVE", Bundle.ACTIVE, host.getState()); // Deploy the fragment @@ -197,7 +195,7 @@ public void testUnattachedFragment() throws Exception { String fragmentName = server.deploy("bundle-fragment", input); // Find the deployed bundle - Bundle fragment = context.getBundle(GOOD_FRAGMENT); + Bundle fragment = context.getBundle("bundle-fragment"); Assert.assertEquals("Bundle INSTALLED", Bundle.INSTALLED, fragment.getState()); try { diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/jaxrs/RestEndpointTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/jaxrs/RestEndpointTestCase.java index 75ec7dc233fc..908723e15917 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/jaxrs/RestEndpointTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/jaxrs/RestEndpointTestCase.java @@ -60,7 +60,6 @@ * @since 30-Aug-2012 */ @RunWith(Arquillian.class) -@Ignore("AS7-6647") public class RestEndpointTestCase { private static final String SIMPLE_WAR = "simple.war"; diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/jta/TransactionTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/jta/TransactionTestCase.java index 17988f967f6d..bbcc15e0ac12 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/jta/TransactionTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/jta/TransactionTestCase.java @@ -41,7 +41,6 @@ import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.Asset; import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.osgi.framework.Bundle; @@ -55,7 +54,6 @@ * @since 23-Oct-2009 */ @RunWith(Arquillian.class) -@Ignore("AS7-6627") public class TransactionTestCase { @ArquillianResource diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/repository/RepositoryTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/repository/RepositoryTestCase.java index bfd4a5df461b..8b04bd27eb7d 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/repository/RepositoryTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/repository/RepositoryTestCase.java @@ -56,7 +56,6 @@ * @since 19-Jan-2012 */ @RunWith(Arquillian.class) -@org.junit.Ignore("AS7-6511") public class RepositoryTestCase { @ArquillianResource @@ -102,7 +101,7 @@ public void testRepositoryService() throws Exception { try { bundle.start(); Assert.assertEquals(Bundle.ACTIVE, bundle.getState()); - ServiceReference sref = context.getServiceReference("org.osgi.service.event.EventAdmin"); + ServiceReference sref = context.getServiceReference("org.osgi.service.event.EventAdmin"); assertNotNull("EventAdmin service not null", sref); } finally { bundle.uninstall(); diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/webapp/WebAppTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/webapp/WebAppTestCase.java index 073424242e7c..13147cbd5fea 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/webapp/WebAppTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/webapp/WebAppTestCase.java @@ -239,7 +239,6 @@ public void testSimpleBundleWithJarExtension() throws Exception { } @Test - @org.junit.Ignore("AS7-6511") public void testDeferredBundleWithWabExtension() throws Exception { InputStream input = deployer.getDeployment(BUNDLE_C_WAB); Bundle bundle = context.installBundle(BUNDLE_C_WAB, input); diff --git a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/xservice/BundleAccessesModuleServiceTestCase.java b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/xservice/BundleAccessesModuleServiceTestCase.java index 2e9c7a2bb63e..9eee31991eb4 100644 --- a/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/xservice/BundleAccessesModuleServiceTestCase.java +++ b/testsuite/integration/osgi/src/test/java/org/jboss/as/test/integration/osgi/xservice/BundleAccessesModuleServiceTestCase.java @@ -61,7 +61,6 @@ * @since 14-Oct-2010 */ @RunWith(Arquillian.class) -@org.junit.Ignore("AS7-6511") public class BundleAccessesModuleServiceTestCase extends AbstractXServiceTestCase { private static final String TARGET_MODULE_NAME = "example-xservice-bam-target-module"; @@ -114,8 +113,8 @@ public void bundleInvokesModuleService() throws Exception { // The client bundle activator registers a StringBuffer service that // contains the result from the module service call BundleContext context = clientBundle.getBundleContext(); - ServiceReference sref = context.getServiceReference(StringBuffer.class.getName()); - StringBuffer service = (StringBuffer) context.getService(sref); + ServiceReference sref = context.getServiceReference(StringBuffer.class); + StringBuffer service = context.getService(sref); assertEquals("hello world", service.toString()); } finally { // Uninstall the client bundle