[jboss-cvs] JBossAS SVN: r85255 - in projects/jboss-osgi/trunk: runtime/spi/src/main/java/org/jboss/osgi/spi/junit and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 4 16:23:46 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-03-04 16:23:45 -0500 (Wed, 04 Mar 2009)
New Revision: 85255
Added:
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38EmbeddedTestCase.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39EmbeddedTestCase.java
Removed:
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
Modified:
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java
projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java
projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java
projects/jboss-osgi/trunk/testsuite/pom.xml
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38DeployerTestCase.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/bundleA/ServiceA.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39DeployerTestCase.java
Log:
[JBOSGI-39] more insights, see jira
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -90,7 +90,7 @@
unresolvedBundles.remove(bundle);
String state = StateFormat.formatBundleState(bundle.getState());
- log.info(bundle.getSymbolicName() + ",state=" + state);
+ log.info("Stoped: " + bundle.getSymbolicName() + ",state=" + state);
}
catch (BundleException e)
{
@@ -104,7 +104,7 @@
{
bundle.start();
String state = StateFormat.formatBundleState(bundle.getState());
- log.info(bundle.getSymbolicName() + ",state=" + state);
+ log.info("Started: " + bundle.getSymbolicName() + ",state=" + state);
}
catch (BundleException e)
{
@@ -144,7 +144,7 @@
{
auxBundle.start();
String state = StateFormat.formatBundleState(bundle.getState());
- log.info(bundle.getSymbolicName() + ",state=" + state);
+ log.info("Started: " + bundle.getSymbolicName() + ",state=" + state);
}
catch (BundleException e)
{
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -78,7 +78,7 @@
unit.addAttachment(Bundle.class, bundle);
String state = StateFormat.formatBundleState(bundle.getState());
- log.info(bundle.getSymbolicName() + ",state=" + state);
+ log.info("Installed: " + bundle.getSymbolicName() + ",state=" + state);
}
}
catch (BundleException ex)
@@ -97,7 +97,7 @@
{
bundle.uninstall();
String state = StateFormat.formatBundleState(bundle.getState());
- log.info(bundle.getSymbolicName() + ",state=" + state);
+ log.info("Uninstalled: " + bundle.getSymbolicName() + ",state=" + state);
}
catch (BundleException ex)
{
Modified: projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -27,7 +27,9 @@
import javax.management.MBeanServerConnection;
+import org.jboss.osgi.spi.management.MBeanProxyException;
import org.jboss.osgi.spi.management.ManagedBundleMBean;
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
/**
* An integration test case
@@ -83,6 +85,16 @@
getDelegate().undeploy(archive);
}
+ protected void undeployBundle(String bundleName) throws Exception
+ {
+ getDelegate().undeployBundle(bundleName);
+ }
+
+ protected ManagedFrameworkMBean getManagedFramework() throws MBeanProxyException
+ {
+ return getDelegate().getManagedFramework();
+ }
+
protected MBeanServerConnection getServer()
{
return getDelegate().getServer();
Modified: projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -32,6 +32,7 @@
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MBeanProxyException;
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
@@ -139,12 +140,23 @@
public ManagedBundleMBean deployBundle(String bundleName) throws Exception
{
+ deploy(bundleName + ".jar");
+
+ ObjectName bundleOName = getManagedFramework().getBundle(bundleName);
+ return MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getServer());
+ }
+
+ public void undeployBundle(String bundleName) throws Exception
+ {
+ undeploy(bundleName + ".jar");
+ }
+
+ public ManagedFrameworkMBean getManagedFramework() throws MBeanProxyException
+ {
if (managedFramework == null)
managedFramework = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.OBJECT_NAME, getServer());
- deploy(bundleName + ".jar");
-
- return MBeanProxy.get(ManagedBundleMBean.class, managedFramework.getBundle(bundleName), getServer());
+ return managedFramework;
}
public static boolean isRemoteIntegration()
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-03-04 21:23:45 UTC (rev 85255)
@@ -116,9 +116,9 @@
<configuration>
<excludes>
<!-- Exclude tests that require remote access -->
+ <exclude>org/jboss/test/osgi/**/*DeployerTestCase.java</exclude>
<exclude>org/jboss/test/osgi/service/http/junit/*TestCase.java</exclude>
<exclude>org/jboss/test/osgi/service/microcontainer/junit/*TestCase.java</exclude>
- <exclude>org/jboss/test/osgi/jbosgi38/OSGI38DeployerTestCase.java</exclude>
<!-- [JBOSGI-36] Bundle classes leak into system classloader -->
<exclude>org/jboss/test/osgi/jbosgi36/junit/*TestCase.java</exclude>
</excludes>
@@ -155,8 +155,10 @@
<argLine>${surefire.security.args}</argLine>
<excludes>
<!-- [JBOSGI-40] Cannot run embedded tests with SecurityManager -->
- <exclude>org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java</exclude>
+ <exclude>org/jboss/test/osgi/**/*EmbeddedTestCase.java</exclude>
<exclude>org/jboss/test/osgi/service/http/junit/EndpointServiceTestCase.java</exclude>
+ <!-- [JBOSGI-39] Bundle undeploy does not clean up properly -->
+ <exclude>org/jboss/test/osgi/jbosgi39/*TestCase.java</exclude>
</excludes>
</configuration>
</plugin>
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38DeployerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38DeployerTestCase.java 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38DeployerTestCase.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -110,8 +110,8 @@
assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+ undeploy("jbosgi38-bundleB.jar");
undeploy("jbosgi38-bundleX.jar");
- undeploy("jbosgi38-bundleB.jar");
}
/*
@@ -133,8 +133,8 @@
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
+ undeploy("jbosgi38-bundleA.jar");
+ undeploy("jbosgi38-bundleB.jar");
undeploy("jbosgi38-bundleX.jar");
- undeploy("jbosgi38-bundleB.jar");
- undeploy("jbosgi38-bundleA.jar");
}
}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38EmbeddedTestCase.java (from rev 85249, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38EmbeddedTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38EmbeddedTestCase.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -0,0 +1,228 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi38;
+
+//$Id$
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.junit.IntegrationTest;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * [JBOSGI-38] Investigate bundle install/start behaviour with random deployment order
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-38
+ *
+ * Bundle A depends on bundle B, both share bundle X.
+ *
+ * A ---> B
+ * A ---> X <--- B
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 02-Mar-2009
+ */
+public class OSGI38EmbeddedTestCase extends IntegrationTest
+{
+ /*
+ * Install/Start the common bundle
+ */
+ public void testInstallStartX() throws Exception
+ {
+ OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
+ BundleContext sysContext = framework.getSystemBundleContext();
+
+ Bundle bundleX = null;
+ try
+ {
+ bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
+
+ bundleX.start();
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
+ }
+ finally
+ {
+ uninstall(bundleX);
+ }
+ }
+
+ /*
+ * Install X, B
+ */
+ public void testInstallXBeforeB() throws Exception
+ {
+ OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
+ BundleContext sysContext = framework.getSystemBundleContext();
+
+ Bundle bundleB = null;
+ Bundle bundleX = null;
+ try
+ {
+ bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
+
+ bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
+
+ bundleB.start();
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+ }
+ finally
+ {
+ uninstall(bundleB);
+ uninstall(bundleX);
+ }
+ }
+
+ /*
+ * Install X, B, A
+ */
+ public void testInstallBBeforeA() throws Exception
+ {
+ OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
+ BundleContext sysContext = framework.getSystemBundleContext();
+
+ Bundle bundleA = null;
+ Bundle bundleB = null;
+ Bundle bundleX = null;
+ try
+ {
+ bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
+
+ bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
+
+ bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleA.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
+
+ bundleA.start();
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
+ }
+ finally
+ {
+ uninstall(bundleA);
+ uninstall(bundleB);
+ uninstall(bundleX);
+ }
+ }
+
+ /*
+ * Install B, X
+ */
+ public void testInstallBBeforeX() throws Exception
+ {
+ OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
+ BundleContext sysContext = framework.getSystemBundleContext();
+
+ Bundle bundleB = null;
+ Bundle bundleX = null;
+ try
+ {
+ bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
+
+ bundleB.start();
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+ }
+ finally
+ {
+ uninstall(bundleX);
+ uninstall(bundleB);
+ }
+ }
+
+ /*
+ * Install A, B, X
+ */
+ public void testInstallABeforeB() throws Exception
+ {
+ OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
+ BundleContext sysContext = framework.getSystemBundleContext();
+
+ Bundle bundleA = null;
+ Bundle bundleB = null;
+ Bundle bundleX = null;
+ try
+ {
+ bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleA.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
+
+ bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
+
+ bundleB.start();
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+
+ bundleA.start();
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
+ }
+ finally
+ {
+ uninstall(bundleA);
+ uninstall(bundleB);
+ uninstall(bundleX);
+ }
+ }
+
+ private void uninstall(Bundle bnd)
+ {
+ try
+ {
+ if (bnd != null)
+ bnd.uninstall();
+ }
+ catch (BundleException ex)
+ {
+ System.err.println(ex.toString());
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -1,228 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.jbosgi38;
-
-//$Id$
-
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * [JBOSGI-38] Investigate bundle install/start behaviour with random deployment order
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-38
- *
- * Bundle A depends on bundle B, both share bundle X.
- *
- * A ---> B
- * A ---> X <--- B
- *
- * @author thomas.diesler at jboss.com
- * @since 02-Mar-2009
- */
-public class OSGI38TestCase extends IntegrationTest
-{
- /*
- * Install/Start the common bundle
- */
- public void testInstallStartX() throws Exception
- {
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- Bundle bundleX = null;
- try
- {
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
-
- bundleX.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
- }
- finally
- {
- uninstall(bundleX);
- }
- }
-
- /*
- * Install X, B
- */
- public void testInstallXBeforeB() throws Exception
- {
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- Bundle bundleB = null;
- Bundle bundleX = null;
- try
- {
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
-
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- bundleB.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- }
- finally
- {
- uninstall(bundleB);
- uninstall(bundleX);
- }
- }
-
- /*
- * Install X, B, A
- */
- public void testInstallBBeforeA() throws Exception
- {
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- Bundle bundleA = null;
- Bundle bundleB = null;
- Bundle bundleX = null;
- try
- {
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
-
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleA.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
-
- bundleA.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
- }
- finally
- {
- uninstall(bundleA);
- uninstall(bundleB);
- uninstall(bundleX);
- }
- }
-
- /*
- * Install B, X
- */
- public void testInstallBBeforeX() throws Exception
- {
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- Bundle bundleB = null;
- Bundle bundleX = null;
- try
- {
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
-
- bundleB.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- }
- finally
- {
- uninstall(bundleX);
- uninstall(bundleB);
- }
- }
-
- /*
- * Install A, B, X
- */
- public void testInstallABeforeB() throws Exception
- {
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- Bundle bundleA = null;
- Bundle bundleB = null;
- Bundle bundleX = null;
- try
- {
- bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleA.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
-
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
-
- bundleB.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- bundleA.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
- }
- finally
- {
- uninstall(bundleA);
- uninstall(bundleB);
- uninstall(bundleX);
- }
- }
-
- private void uninstall(Bundle bnd)
- {
- try
- {
- if (bnd != null)
- bnd.uninstall();
- }
- catch (BundleException ex)
- {
- System.err.println(ex.toString());
- }
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/bundleA/ServiceA.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/bundleA/ServiceA.java 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/bundleA/ServiceA.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -48,7 +48,13 @@
serviceB.doStuffInB(new SomePojo("hello"));
return serviceB;
}
+
+ @Override
+ public void removedService(ServiceReference reference, Object service)
+ {
+ super.removedService(reference, service);
+ }
};
- tracker.open();
+ //tracker.open();
}
}
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39DeployerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39DeployerTestCase.java 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39DeployerTestCase.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -26,7 +26,6 @@
import org.jboss.osgi.spi.junit.IntegrationTest;
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
/**
* [JBOSGI-39] Bundle undeploy does not clean up properly
@@ -42,68 +41,29 @@
*/
public class OSGI39DeployerTestCase extends IntegrationTest
{
- public void testInstallBWithoutX() throws Exception
+ public void testFirstRun() throws Exception
{
- ManagedBundleMBean bundleB = deployBundle("jbosgi38-bundleB");
-
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("BundleException expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- undeploy("jbosgi38-bundleB.jar");
+ installBBeforeX();
}
- public void testInstallX() throws Exception
+ public void testSecondRun() throws Exception
{
- ManagedBundleMBean bundleX = deployBundle("jbosgi38-bundleX");
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
-
- undeploy("jbosgi38-bundleX.jar");
+ installBBeforeX();
}
- public void testInstallBAfterX() throws Exception
+ private void installBBeforeX() throws Exception
{
- ManagedBundleMBean bundleX = deployBundle("jbosgi38-bundleX");
ManagedBundleMBean bundleB = deployBundle("jbosgi38-bundleB");
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
- undeploy("jbosgi38-bundleB.jar");
- undeploy("jbosgi38-bundleX.jar");
- }
-
- public void testInstallBAfterUninstallX() throws Exception
- {
ManagedBundleMBean bundleX = deployBundle("jbosgi38-bundleX");
assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+ // Undeploy X before B
undeploy("jbosgi38-bundleX.jar");
-
- ManagedBundleMBean bundleB = deployBundle("jbosgi38-bundleB");
-
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("BundleException expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
undeploy("jbosgi38-bundleB.jar");
}
}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39EmbeddedTestCase.java (from rev 85249, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39EmbeddedTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39EmbeddedTestCase.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi39;
+
+//$Id$
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.junit.IntegrationTest;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * [JBOSGI-39] Bundle undeploy does not clean up properly
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-39
+ *
+ * Bundle B depends on bundle X.
+ *
+ * B ---> X
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 04-Mar-2009
+ */
+public class OSGI39EmbeddedTestCase extends IntegrationTest
+{
+ public void testFirstRun() throws Exception
+ {
+ installBBeforeX();
+ }
+
+ public void testSecondRun() throws Exception
+ {
+ installBBeforeX();
+ }
+
+ private void installBBeforeX() throws Exception
+ {
+ OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
+ BundleContext sysContext = framework.getSystemBundleContext();
+
+ Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+
+ bundleB.start();
+
+ assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+
+ // Uninstall X before B
+ bundleX.uninstall();
+ bundleB.uninstall();
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-03-04 21:04:14 UTC (rev 85254)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-03-04 21:23:45 UTC (rev 85255)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.jbosgi39;
-
-//$Id$
-
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * [JBOSGI-39] Bundle undeploy does not clean up properly
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-39
- *
- * Bundle B depends on bundle X.
- *
- * B ---> X
- *
- * @author thomas.diesler at jboss.com
- * @since 04-Mar-2009
- */
-public class OSGI39TestCase extends IntegrationTest
-{
- public void testInstallBWithoutX() throws Exception
- {
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("BundleException expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- bundleB.uninstall();
- }
-
- public void testInstallX() throws Exception
- {
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
-
- bundleX.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
-
- bundleX.uninstall();
- }
-
- public void testInstallBAfterX() throws Exception
- {
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
-
- bundleX.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
-
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- bundleB.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
- }
-
- public void testInstallBAfterUninstallX() throws Exception
- {
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
-
- bundleX.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
-
- bundleX.uninstall();
-
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("BundleException expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- bundleB.uninstall();
- }
-}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list