[jboss-cvs] JBossAS SVN: r88347 - in projects/jboss-osgi/trunk: bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 7 06:47:14 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-07 06:47:13 -0400 (Thu, 07 May 2009)
New Revision: 88347
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
Removed:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
Log:
Migrate tests to use abstract osgi runtime
Use OSGiRuntime interface
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -25,7 +25,7 @@
package org.jboss.test.osgi.blueprint.bootstrap;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -40,7 +40,7 @@
{
public void testApacheXercesBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
@@ -56,7 +56,7 @@
public void testJAXBBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/jaxb-bundle.jar");
@@ -72,7 +72,7 @@
public void testJBossCommonCoreBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
@@ -89,7 +89,7 @@
public void testJBossXBBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
@@ -108,7 +108,7 @@
public void testJNDIBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
@@ -125,7 +125,7 @@
public void testJMXBundle() throws Exception
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -31,7 +31,7 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.JMXCapability;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.OSGiTest;
@@ -46,7 +46,7 @@
*/
public class JMXTestCase extends OSGiTest
{
- private static AbstractRuntime runtime;
+ private static OSGiRuntime runtime;
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -29,7 +29,7 @@
import junit.framework.Test;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestSetup;
@@ -43,7 +43,7 @@
*/
public class JNDITestCase extends OSGiTest
{
- private static AbstractRuntime runtime;
+ private static OSGiRuntime runtime;
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -40,7 +40,7 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.JMXCapability;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.MicrocontainerCapability;
@@ -55,7 +55,7 @@
*/
public class MicrocontainerTestCase extends OSGiTest
{
- private static AbstractRuntime runtime;
+ private static OSGiRuntime runtime;
public static Test suite()
{
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -1,122 +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.osgi.spi.testing;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.MBeanServerConnection;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.logging.LogEntryCache;
-import org.osgi.framework.BundleException;
-
-/**
- * [TODO]
- *
- * @author Thomas.Diesler at jboss.org
- * @since 25-Sep-2008
- */
-public abstract class AbstractRuntime
-{
- // Provide logging
- final Logger log = Logger.getLogger(AbstractRuntime.class);
-
- private OSGiTestHelper helper;
- private Map<String, AbstractBundle> bundles = new HashMap<String, AbstractBundle>();
- private List<Capability> capabilities = new ArrayList<Capability>();
-
- public AbstractRuntime(OSGiTestHelper helper)
- {
- this.helper = helper;
- }
-
- public OSGiTestHelper getTestHelper()
- {
- return helper;
- }
-
- public abstract AbstractBundle installBundle(String location) throws BundleException;
-
- public abstract void deploy(String location) throws Exception;
-
- public abstract void undeploy(String location) throws Exception;
-
- public abstract AbstractBundle[] getBundles();
-
- public void addCapability(Capability capability) throws BundleException
- {
- for (String location : capability.getBundles())
- {
- AbstractBundle bundle = installBundle(location);
- bundle.start();
-
- bundles.put(location, bundle);
- }
- capabilities.add(capability);
- }
-
- public void removeCapability(Capability capability)
- {
- capabilities.remove(capability);
-
- List<String> bundleLocations = capability.getBundles();
- Collections.reverse(bundleLocations);
-
- for (String location : bundleLocations)
- {
- AbstractBundle bundle = bundles.get(location);
- try
- {
- bundle.uninstall();
- }
- catch (BundleException ex)
- {
- log.error("Cannot uninstall bundle: " + bundle);
- }
- }
- }
-
- public abstract AbstractPackageAdmin getPackageAdmin();
-
- public abstract InitialContext getInitialContext() throws NamingException;
-
- public abstract MBeanServerConnection getMBeanServer();
-
- public abstract void startLogEntryTracking(LogEntryCache logEntryCache);
-
- public abstract void stopLogEntryTracking();
-
- public void shutdown()
- {
- while (capabilities.size() > 0)
- {
- Capability capability = capabilities.get(0);
- removeCapability(capability);
- }
- }
-}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -43,6 +43,7 @@
import org.jboss.osgi.spi.logging.LogEntryCache;
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -57,14 +58,13 @@
* @author Thomas.Diesler at jboss.org
* @since 25-Sep-2008
*/
-public class EmbeddedRuntime extends AbstractRuntime
+public class EmbeddedRuntime extends OSGiRuntimeImpl
{
public EmbeddedRuntime(OSGiTestHelper helper)
{
super(helper);
}
- @Override
public AbstractBundle installBundle(String location) throws BundleException
{
URL bundleURL = getTestHelper().getTestArchiveURL(location);
@@ -72,7 +72,6 @@
return new EmbeddedBundle(bundle);
}
- @Override
public void deploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
@@ -80,7 +79,6 @@
mcService.deploy(archiveURL);
}
- @Override
public void undeploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
@@ -88,7 +86,6 @@
mcService.undeploy(archiveURL);
}
- @Override
public AbstractBundle[] getBundles()
{
List<AbstractBundle> absBundles = new ArrayList<AbstractBundle>();
@@ -117,7 +114,6 @@
super.addCapability(capability);
}
- @Override
public void startLogEntryTracking(final LogEntryCache logEntryCache)
{
// Track the LogReaderService to add the LogEntryCache as LogListener
@@ -134,7 +130,6 @@
tracker.open();
}
- @Override
public void stopLogEntryTracking()
{
}
@@ -154,7 +149,6 @@
return framework.getBundleContext();
}
- @Override
@SuppressWarnings("unchecked")
public MBeanServerConnection getMBeanServer()
{
@@ -172,7 +166,6 @@
return server;
}
- @Override
@SuppressWarnings("unchecked")
public InitialContext getInitialContext() throws NamingException
{
@@ -184,7 +177,6 @@
return new InitialContext(env);
}
- @Override
public AbstractPackageAdmin getPackageAdmin()
{
BundleContext context = getBundleContext();
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java (from rev 88346, projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -0,0 +1,62 @@
+/*
+ * 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.osgi.spi.testing;
+
+import javax.management.MBeanServerConnection;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.osgi.framework.BundleException;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public interface OSGiRuntime
+{
+ AbstractBundle installBundle(String location) throws BundleException;
+
+ void deploy(String location) throws Exception;
+
+ void undeploy(String location) throws Exception;
+
+ AbstractBundle[] getBundles();
+
+ void addCapability(Capability capability) throws BundleException;
+
+ void removeCapability(Capability capability);
+
+ AbstractPackageAdmin getPackageAdmin();
+
+ InitialContext getInitialContext() throws NamingException;
+
+ MBeanServerConnection getMBeanServer();
+
+ void startLogEntryTracking(LogEntryCache logEntryCache);
+
+ void stopLogEntryTracking();
+
+ void shutdown();
+}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -75,7 +75,7 @@
return getClass().getName() + "." + getName();
}
- protected AbstractRuntime getRuntime()
+ protected OSGiRuntime getRuntime()
{
return helper.getDefaultRuntime();
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -59,9 +59,9 @@
return bootProvider;
}
- public AbstractRuntime getDefaultRuntime()
+ public OSGiRuntime getDefaultRuntime()
{
- AbstractRuntime runtime;
+ OSGiRuntime runtime;
String target = System.getProperty("target.container");
if (target == null)
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -64,7 +64,7 @@
log.debug("### END SETUP " + testCase.getName());
}
- public AbstractRuntime getDefaultRuntime()
+ public OSGiRuntime getDefaultRuntime()
{
return helper.getDefaultRuntime();
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -50,6 +50,7 @@
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -59,7 +60,7 @@
* @author Thomas.Diesler at jboss.org
* @since 25-Sep-2008
*/
-public class RemoteRuntime extends AbstractRuntime
+public class RemoteRuntime extends OSGiRuntimeImpl
{
private MBeanServerConnection mbeanServer;
private ManagedFrameworkMBean managedFramework;
@@ -75,7 +76,6 @@
ignoredCaps.add(MicrocontainerCapability.class);
}
- @Override
public AbstractBundle installBundle(String location) throws BundleException
{
String symbolicName = null;
@@ -110,7 +110,6 @@
}
}
- @Override
public void deploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
@@ -118,7 +117,6 @@
mcService.deploy(archiveURL);
}
- @Override
public void undeploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
@@ -135,24 +133,20 @@
super.addCapability(capability);
}
- @Override
public AbstractBundle[] getBundles()
{
throw new NotImplementedException();
}
- @Override
public void startLogEntryTracking(final LogEntryCache logEntryCache)
{
throw new NotImplementedException();
}
- @Override
public void stopLogEntryTracking()
{
}
- @Override
public MBeanServerConnection getMBeanServer()
{
if (mbeanServer == null)
@@ -170,7 +164,6 @@
return mbeanServer;
}
- @Override
@SuppressWarnings("unchecked")
public InitialContext getInitialContext() throws NamingException
{
@@ -182,7 +175,6 @@
return new InitialContext(env);
}
- @Override
public AbstractPackageAdmin getPackageAdmin()
{
throw new NotImplementedException();
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -0,0 +1,103 @@
+/*
+ * 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.osgi.spi.testing.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.Capability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.osgi.framework.BundleException;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class OSGiRuntimeImpl implements OSGiRuntime
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(OSGiRuntimeImpl.class);
+
+ private OSGiTestHelper helper;
+ private Map<String, AbstractBundle> bundles = new HashMap<String, AbstractBundle>();
+ private List<Capability> capabilities = new ArrayList<Capability>();
+
+ public OSGiRuntimeImpl(OSGiTestHelper helper)
+ {
+ this.helper = helper;
+ }
+
+ public OSGiTestHelper getTestHelper()
+ {
+ return helper;
+ }
+
+ public void addCapability(Capability capability) throws BundleException
+ {
+ for (String location : capability.getBundles())
+ {
+ AbstractBundle bundle = installBundle(location);
+ bundle.start();
+
+ bundles.put(location, bundle);
+ }
+ capabilities.add(capability);
+ }
+
+ public void removeCapability(Capability capability)
+ {
+ capabilities.remove(capability);
+
+ List<String> bundleLocations = capability.getBundles();
+ Collections.reverse(bundleLocations);
+
+ for (String location : bundleLocations)
+ {
+ AbstractBundle bundle = bundles.get(location);
+ try
+ {
+ bundle.uninstall();
+ }
+ catch (BundleException ex)
+ {
+ log.error("Cannot uninstall bundle: " + bundle);
+ }
+ }
+ }
+
+ public void shutdown()
+ {
+ while (capabilities.size() > 0)
+ {
+ Capability capability = capabilities.get(0);
+ removeCapability(capability);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -28,7 +28,7 @@
import org.jboss.osgi.spi.logging.LogEntryCache;
import org.jboss.osgi.spi.logging.LogEntryFilter;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
import org.osgi.service.log.LogEntry;
@@ -43,7 +43,7 @@
public class LogServiceTestCase extends OSGiTest
{
private LogEntryCache logEntryCache;
- private AbstractRuntime runtime;
+ private OSGiRuntime runtime;
@Override
protected void setUp() throws Exception
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -28,7 +28,7 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.MBeanProxyException;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.JMXCapability;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.MicrocontainerCapability;
@@ -46,7 +46,7 @@
*/
public class OSGI36RemoteTestCase extends OSGiTest
{
- static AbstractRuntime runtime;
+ static OSGiRuntime runtime;
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -27,7 +27,7 @@
import java.util.List;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
@@ -43,7 +43,7 @@
{
public void testNestedBundle() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleA = runtime.installBundle("jbosgi37-bundleA.jar");
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -24,7 +24,7 @@
//$Id: OSGI38TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler at jboss.com $
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -49,7 +49,7 @@
*/
public void testInstallStartX() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -69,7 +69,7 @@
*/
public void testInstallXBeforeB() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -92,7 +92,7 @@
*/
public void testInstallBBeforeA() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -118,7 +118,7 @@
*/
public void testInstallBBeforeX() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
@@ -151,7 +151,7 @@
*/
public void testInstallABeforeB() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -25,7 +25,7 @@
import org.jboss.osgi.spi.testing.AbstractBundle;
import org.jboss.osgi.spi.testing.AbstractPackageAdmin;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -46,7 +46,7 @@
{
public void testVerifyUnresolved() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
@@ -88,7 +88,7 @@
*/
public void testWiringToUninstalled() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
@@ -120,7 +120,7 @@
public void testWiringToUninstalledPackageAdmin() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
More information about the jboss-cvs-commits
mailing list