[jboss-cvs] JBossAS SVN: r88278 - in projects/jboss-osgi/trunk: spi/src/main/java/org/jboss/osgi/spi/testing and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 6 13:41:51 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-05-06 13:41:51 -0400 (Wed, 06 May 2009)
New Revision: 88278

Added:
   projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/
   projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java
   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/EmbeddedBundle.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
Modified:
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
Log:
Migrate tests to use abstract osgi runtime

Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java	2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,41 @@
+/*
+ * 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 org.osgi.framework.BundleException;
+
+/**
+ * An OSGi Test Case
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class AbstractBundle
+{
+   public abstract void start() throws BundleException;
+   
+   public abstract void stop() throws BundleException;
+   
+   public abstract void uninstall() throws BundleException;
+
+   public abstract int getState();
+}


Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java	2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,46 @@
+/*
+ * 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.net.URL;
+
+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
+{
+   public abstract AbstractBundle installBundle(URL bundleURL) throws BundleException;
+
+   public abstract void startLogEntryTracking(LogEntryCache logEntryCache);
+
+   public abstract void stopLogEntryTracking();
+   {
+      // TODO Auto-generated method stub
+      
+   }
+}


Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java	2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,65 @@
+/*
+ * 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 org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * An OSGi Test Case
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedBundle extends AbstractBundle
+{
+   private Bundle bundle;
+
+   public EmbeddedBundle(Bundle bundle)
+   {
+      this.bundle = bundle;
+   }
+
+   @Override
+   public void start() throws BundleException
+   {
+      bundle.start();
+   }
+
+   @Override
+   public void stop() throws BundleException
+   {
+      bundle.stop();
+   }
+
+   @Override
+   public void uninstall() throws BundleException
+   {
+      bundle.uninstall();
+   }
+
+   @Override
+   public int getState()
+   {
+      return bundle.getState();
+   }
+}


Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java	2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,85 @@
+/*
+ * 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.net.URL;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogReaderService;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * [TODO]
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedRuntime extends AbstractRuntime
+{
+   private OSGiBootstrapProvider bootProvider;
+   
+   public EmbeddedRuntime(OSGiBootstrapProvider bootProvider)
+   {
+      this.bootProvider = bootProvider;
+   }
+
+   @Override
+   public AbstractBundle installBundle(URL bundleURL) throws BundleException
+   {
+      Bundle bundle = getBundleContext().installBundle(bundleURL.toExternalForm());
+      return new EmbeddedBundle(bundle);
+   }
+
+   @Override
+   public void startLogEntryTracking(final LogEntryCache logEntryCache)
+   {
+      // Track the LogReaderService to add the LogEntryCache as LogListener
+      ServiceTracker tracker = new ServiceTracker(getBundleContext(), LogReaderService.class.getName(), null)
+      {
+         @Override
+         public Object addingService(ServiceReference sref)
+         {
+            LogReaderService service = (LogReaderService)super.addingService(sref);
+            service.addLogListener(logEntryCache);
+            return service;
+         }
+      };
+      tracker.open();
+   }
+   
+   @Override
+   public void stopLogEntryTracking()
+   {
+   }
+   
+   private BundleContext getBundleContext()
+   {
+      OSGiFramework framework = bootProvider.getFramework();
+      return framework.getBundleContext();
+   }
+}


Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java	2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,83 @@
+/*
+ * 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.net.URL;
+
+import junit.framework.TestCase;
+
+import org.jboss.logging.Logger;
+
+/**
+ * An OSGi Test Case
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class OSGiTest extends TestCase
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(OSGiTest.class);
+
+   private OSGiTestHelper delegate = new OSGiTestHelper();
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      log.debug("### START " + getLongName());
+      super.setUp();
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+      log.debug("### END " + getLongName());
+   }
+
+   protected String getShortName()
+   {
+      String shortName = getClass().getName();
+      shortName = shortName.substring(shortName.lastIndexOf(".") + 1);
+      return shortName;
+   }
+
+   protected String getLongName()
+   {
+      return getClass().getName() + "." + getName();
+   }
+
+   protected AbstractRuntime getRuntime()
+   {
+      return delegate.getRuntime();
+   }
+
+   protected URL getResourceURL(String resource)
+   {
+      return delegate.getResourceURL(resource);
+   }
+
+   protected URL getTestArchiveURL(String archive)
+   {
+      return delegate.getTestArchiveURL(archive);
+   }
+}


Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java	2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,128 @@
+/*
+ * 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.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+
+/**
+ * An OSGi Test Helper
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public class OSGiTestHelper
+{
+   private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
+   private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
+
+   private OSGiBootstrapProvider bootProvider;
+   
+   private static String testResourcesDir;
+   private static String testArchiveDir;
+   
+   public OSGiTestHelper()
+   {
+      testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY, "target/test-classes");
+      testArchiveDir = System.getProperty(SYSPROP_TEST_ARCHIVE_DIRECTORY, "target/test-libs");
+   }
+
+   public AbstractRuntime getRuntime()
+   {
+      return getEmbeddedRuntime();
+   }
+   
+   public AbstractRuntime getEmbeddedRuntime()
+   {
+      if (bootProvider == null)
+         bootProvider = OSGiBootstrap.getBootstrapProvider();
+         
+      return new EmbeddedRuntime(bootProvider);
+   }
+   
+   public AbstractRuntime getRemoteRuntime()
+   {
+      return null;
+   }
+
+   /** Try to discover the URL for the test resource */
+   public URL getResourceURL(String resource)
+   {
+      URL resURL = null;
+      try
+      {
+         File resourceFile = getResourceFile(resource);
+         resURL = resourceFile.toURI().toURL();
+      }
+      catch (MalformedURLException e)
+      {
+         // ignore
+      }
+      return resURL;
+   }
+
+   /** Try to discover the File for the test resource */
+   private File getResourceFile(String resource)
+   {
+      File file = new File(resource);
+      if (file.exists())
+         return file;
+
+      file = new File(testResourcesDir + "/" + resource);
+      if (file.exists())
+         return file;
+
+      throw new IllegalArgumentException("Cannot obtain '" + testResourcesDir + "/" + resource + "'");
+   }
+
+   /** Try to discover the URL for the deployment archive */
+   public URL getTestArchiveURL(String archive)
+   {
+      try
+      {
+         return getTestArchiveFile(archive).toURI().toURL();
+      }
+      catch (MalformedURLException ex)
+      {
+         throw new IllegalStateException(ex);
+      }
+   }
+
+   /** Try to discover the File for the deployment archive */
+   private File getTestArchiveFile(String archive)
+   {
+      File file = new File(archive);
+      if (file.exists())
+         return file;
+
+      file = new File(testArchiveDir + "/" + archive);
+      if (file.exists())
+         return file;
+
+      throw new IllegalArgumentException("Cannot obtain '" + testArchiveDir + "/" + archive + "'.");
+   }
+
+}


Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java	2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,74 @@
+/*
+ * 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.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.management.MBeanServer;
+
+import junit.extensions.TestSetup;
+import junit.framework.TestSuite;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.virtual.VFS;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * An OSGi Test Setup
+ * 
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public class OSGiTestSetup extends TestSetup
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(OSGiTestSetup.class);
+
+   private OSGiTestHelper delegate = new OSGiTestHelper();
+   private Class<?> testCase;
+
+   public OSGiTestSetup(Class<?> testCase)
+   {
+      super(new TestSuite(testCase));
+      this.testCase = testCase;
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      log.debug("### START SETUP " + testCase.getName());
+      super.setUp();
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+      log.debug("### END SETUP " + testCase.getName());
+   }
+}


Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.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-06 17:33:01 UTC (rev 88277)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java	2009-05-06 17:41:51 UTC (rev 88278)
@@ -27,7 +27,9 @@
 import java.util.List;
 
 import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
 import org.jboss.osgi.spi.logging.LogEntryCache;
 import org.jboss.osgi.spi.logging.LogEntryFilter;
 import org.osgi.framework.Bundle;
@@ -44,32 +46,31 @@
 public class LogServiceTestCase extends OSGiTest
 {
    private LogEntryCache logEntryCache;
+   private AbstractRuntime runtime;
 
    @Override
    protected void setUp() throws Exception
    {
       super.setUp();
 
+      runtime = getRuntime();
       logEntryCache = new LogEntryCache(new LogEntryFilter("example-log(.*)", LogService.LOG_INFO, "\\[ServiceA\\](.*)"));
-      startLogEntryTracking(logEntryCache);
+      runtime.startLogEntryTracking(logEntryCache);
    }
 
+
    @Override
    protected void tearDown() throws Exception
    {
-      stopLogEntryTracking();
+      runtime.stopLogEntryTracking();
       super.tearDown();
    }
 
    public void testLogEntryFilter() throws Exception
    {
-      // Bootstrap the Framework and get the system bundle
-      OSGiFramework framework = getBootstrapProvider().getFramework();
-      BundleContext sysContext = framework.getBundleContext();
-
       // Install and start the test bundle
       URL testURL = getTestArchiveURL("example/example-log.jar");
-      Bundle bundleA = sysContext.installBundle(testURL.toExternalForm());
+      AbstractBundle bundleA = runtime.installBundle(testURL);
       bundleA.start();
 
       // Verify that the bundle is active




More information about the jboss-cvs-commits mailing list