org.jboss.osgi.testing
Class OSGiFrameworkTest

java.lang.Object
  extended by org.jboss.osgi.testing.OSGiTest
      extended by org.jboss.osgi.testing.OSGiFrameworkTest
All Implemented Interfaces:
EventListener, BundleListener, FrameworkListener, ServiceListener, SynchronousBundleListener

public abstract class OSGiFrameworkTest
extends OSGiTest
implements ServiceListener, SynchronousBundleListener, FrameworkListener

Parent for native framework tests.

Since:
10-Mar-2010
Author:
Thomas.Diesler@jboss.com

Constructor Summary
OSGiFrameworkTest()
           
 
Method Summary
static void afterClass()
           
protected  void assertAllReferences(BundleContext bundleContext, String clazz, ServiceReference... expected)
           
protected  void assertAllReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected)
           
protected  void assertBundleEvent(int type, Bundle bundle)
           
protected  void assertFrameworkEvent(int type, Bundle bundle, Class<? extends Throwable> expectedThrowable)
           
protected  void assertGetReference(BundleContext bundleContext, String clazz, ServiceReference expected)
           
protected
<T> T
assertInstanceOf(Object o, Class<T> expectedType)
           
protected
<T> T
assertInstanceOf(Object o, Class<T> expectedType, boolean allowNull)
           
protected  void assertNoAllReferences(BundleContext bundleContext, String clazz)
           
protected  void assertNoAllReferences(BundleContext bundleContext, String clazz, String filter)
           
protected  void assertNoBundleEvent()
           
protected  void assertNoFrameworkEvent()
           
protected  void assertNoGetReference(BundleContext bundleContext, String clazz)
           
protected  void assertNoReferences(BundleContext bundleContext, String clazz)
           
protected  void assertNoReferences(BundleContext bundleContext, String clazz, String filter)
           
protected  void assertNoServiceEvent()
           
protected  void assertReferences(BundleContext bundleContext, String clazz, ServiceReference... expected)
           
protected  void assertReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected)
           
protected  void assertServiceEvent(int type, ServiceReference reference)
           
protected  void assertUsingBundles(ServiceReference reference, Bundle... bundles)
           
 void bundleChanged(BundleEvent event)
           
static Framework createFramework()
           
 void frameworkEvent(FrameworkEvent event)
           
protected  BundleStateMBean getBundleStateMBean()
           
static Framework getFramework()
           
protected  FrameworkMBean getFrameworkMBean()
           
protected
<T> T
getMBeanProxy(ObjectName name, Class<T> interf)
           
protected  MBeanServer getMBeanServer()
           
protected  PackageAdmin getPackageAdmin()
           
protected  PackageStateMBean getPackageStateMBean()
           
protected  ServiceReference getServiceReference(String clazz, long timeout)
          Get a ServiceReference within the given timeout.
protected  ServiceStateMBean getServiceStateMBean()
           
static BundleContext getSystemContext()
           
protected  Bundle installBundle(org.jboss.shrinkwrap.api.Archive<?> archive)
           
protected  Bundle installBundle(String location)
           
protected  Bundle installBundle(String location, InputStream inputStream)
           
protected  Bundle installBundle(VirtualFile virtualFile)
           
protected  void refreshPackages(Bundle[] bundles)
           
 void serviceChanged(ServiceEvent event)
           
 void setUp()
          Writes a a debug start messge
static void shutdownFramework()
           
 void tearDown()
          Writes a a debug stop messge
 
Methods inherited from class org.jboss.osgi.testing.OSGiTest
assembleArchive, assembleArchive, assertBundleState, assertLoadClass, assertLoadClass, assertLoadClassFail, getFrameworkName, getInitialContext, getLongName, getResourceFile, getResourceURL, getServerHost, getShortName, getTargetContainer, getTestArchiveFile, getTestArchivePath, getTestArchiveURL, getTestHelper, toInputStream, toVirtualFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSGiFrameworkTest

public OSGiFrameworkTest()
Method Detail

setUp

public void setUp()
           throws Exception
Description copied from class: OSGiTest
Writes a a debug start messge

Overrides:
setUp in class OSGiTest
Throws:
Exception

tearDown

public void tearDown()
              throws Exception
Description copied from class: OSGiTest
Writes a a debug stop messge

Overrides:
tearDown in class OSGiTest
Throws:
Exception

afterClass

public static void afterClass()
                       throws Exception
Throws:
Exception

createFramework

public static Framework createFramework()
                                 throws BundleException
Throws:
BundleException

getFramework

public static Framework getFramework()
                              throws BundleException
Throws:
BundleException

shutdownFramework

public static void shutdownFramework()
                              throws BundleException,
                                     InterruptedException
Throws:
BundleException
InterruptedException

getSystemContext

public static BundleContext getSystemContext()
                                      throws BundleException
Throws:
BundleException

getPackageAdmin

protected PackageAdmin getPackageAdmin()
                                throws BundleException
Throws:
BundleException

installBundle

protected Bundle installBundle(org.jboss.shrinkwrap.api.Archive<?> archive)
                        throws BundleException,
                               IOException
Throws:
BundleException
IOException

installBundle

protected Bundle installBundle(VirtualFile virtualFile)
                        throws BundleException,
                               IOException
Throws:
BundleException
IOException

installBundle

protected Bundle installBundle(String location)
                        throws BundleException,
                               IOException
Throws:
BundleException
IOException

installBundle

protected Bundle installBundle(String location,
                               InputStream inputStream)
                        throws BundleException
Throws:
BundleException

frameworkEvent

public void frameworkEvent(FrameworkEvent event)
Specified by:
frameworkEvent in interface FrameworkListener

assertNoFrameworkEvent

protected void assertNoFrameworkEvent()
                               throws Exception
Throws:
Exception

assertFrameworkEvent

protected void assertFrameworkEvent(int type,
                                    Bundle bundle,
                                    Class<? extends Throwable> expectedThrowable)
                             throws Exception
Throws:
Exception

bundleChanged

public void bundleChanged(BundleEvent event)
Specified by:
bundleChanged in interface BundleListener

assertNoBundleEvent

protected void assertNoBundleEvent()
                            throws Exception
Throws:
Exception

assertBundleEvent

protected void assertBundleEvent(int type,
                                 Bundle bundle)
                          throws Exception
Throws:
Exception

serviceChanged

public void serviceChanged(ServiceEvent event)
Specified by:
serviceChanged in interface ServiceListener

assertNoServiceEvent

protected void assertNoServiceEvent()
                             throws Exception
Throws:
Exception

assertServiceEvent

protected void assertServiceEvent(int type,
                                  ServiceReference reference)
                           throws Exception
Throws:
Exception

assertNoAllReferences

protected void assertNoAllReferences(BundleContext bundleContext,
                                     String clazz)
                              throws Exception
Throws:
Exception

assertNoAllReferences

protected void assertNoAllReferences(BundleContext bundleContext,
                                     String clazz,
                                     String filter)
                              throws Exception
Throws:
Exception

assertAllReferences

protected void assertAllReferences(BundleContext bundleContext,
                                   String clazz,
                                   ServiceReference... expected)
                            throws Exception
Throws:
Exception

assertAllReferences

protected void assertAllReferences(BundleContext bundleContext,
                                   String clazz,
                                   String filter,
                                   ServiceReference... expected)
                            throws Exception
Throws:
Exception

assertNoReferences

protected void assertNoReferences(BundleContext bundleContext,
                                  String clazz)
                           throws Exception
Throws:
Exception

assertNoReferences

protected void assertNoReferences(BundleContext bundleContext,
                                  String clazz,
                                  String filter)
                           throws Exception
Throws:
Exception

assertReferences

protected void assertReferences(BundleContext bundleContext,
                                String clazz,
                                ServiceReference... expected)
                         throws Exception
Throws:
Exception

assertReferences

protected void assertReferences(BundleContext bundleContext,
                                String clazz,
                                String filter,
                                ServiceReference... expected)
                         throws Exception
Throws:
Exception

assertNoGetReference

protected void assertNoGetReference(BundleContext bundleContext,
                                    String clazz)
                             throws Exception
Throws:
Exception

assertGetReference

protected void assertGetReference(BundleContext bundleContext,
                                  String clazz,
                                  ServiceReference expected)
                           throws Exception
Throws:
Exception

assertUsingBundles

protected void assertUsingBundles(ServiceReference reference,
                                  Bundle... bundles)

assertInstanceOf

protected <T> T assertInstanceOf(Object o,
                                 Class<T> expectedType)

assertInstanceOf

protected <T> T assertInstanceOf(Object o,
                                 Class<T> expectedType,
                                 boolean allowNull)

getMBeanServer

protected MBeanServer getMBeanServer()

getMBeanProxy

protected <T> T getMBeanProxy(ObjectName name,
                              Class<T> interf)

getFrameworkMBean

protected FrameworkMBean getFrameworkMBean()
                                    throws IOException
Throws:
IOException

getBundleStateMBean

protected BundleStateMBean getBundleStateMBean()
                                        throws IOException
Throws:
IOException

getPackageStateMBean

protected PackageStateMBean getPackageStateMBean()
                                          throws IOException
Throws:
IOException

getServiceStateMBean

protected ServiceStateMBean getServiceStateMBean()
                                          throws IOException
Throws:
IOException

getServiceReference

protected ServiceReference getServiceReference(String clazz,
                                               long timeout)
                                        throws BundleException
Get a ServiceReference within the given timeout.

Throws:
BundleException

refreshPackages

protected void refreshPackages(Bundle[] bundles)
                        throws Exception
Throws:
Exception


Copyright © 2010. All Rights Reserved.