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, org.osgi.framework.BundleListener, org.osgi.framework.FrameworkListener, org.osgi.framework.ServiceListener, org.osgi.framework.SynchronousBundleListener

public abstract class OSGiFrameworkTest
extends OSGiTest
implements org.osgi.framework.ServiceListener, org.osgi.framework.SynchronousBundleListener, org.osgi.framework.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(org.osgi.framework.BundleContext bundleContext, String clazz, org.osgi.framework.ServiceReference... expected)
           
protected  void assertAllReferences(org.osgi.framework.BundleContext bundleContext, String clazz, String filter, org.osgi.framework.ServiceReference... expected)
           
protected  void assertBundleEvent(int type, org.osgi.framework.Bundle bundle)
           
protected  void assertFrameworkEvent(int type, org.osgi.framework.Bundle bundle, Class<? extends Throwable> expectedThrowable)
           
protected  void assertGetReference(org.osgi.framework.BundleContext bundleContext, String clazz, org.osgi.framework.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(org.osgi.framework.BundleContext bundleContext, String clazz)
           
protected  void assertNoAllReferences(org.osgi.framework.BundleContext bundleContext, String clazz, String filter)
           
protected  void assertNoBundleEvent()
           
protected  void assertNoFrameworkEvent()
           
protected  void assertNoGetReference(org.osgi.framework.BundleContext bundleContext, String clazz)
           
protected  void assertNoReferences(org.osgi.framework.BundleContext bundleContext, String clazz)
           
protected  void assertNoReferences(org.osgi.framework.BundleContext bundleContext, String clazz, String filter)
           
protected  void assertNoServiceEvent()
           
protected  void assertReferences(org.osgi.framework.BundleContext bundleContext, String clazz, org.osgi.framework.ServiceReference... expected)
           
protected  void assertReferences(org.osgi.framework.BundleContext bundleContext, String clazz, String filter, org.osgi.framework.ServiceReference... expected)
           
protected  void assertServiceEvent(int type, org.osgi.framework.ServiceReference reference)
           
protected  void assertUsingBundles(org.osgi.framework.ServiceReference reference, org.osgi.framework.Bundle... bundles)
           
 void bundleChanged(org.osgi.framework.BundleEvent event)
           
static org.osgi.framework.launch.Framework createFramework()
           
 void frameworkEvent(org.osgi.framework.FrameworkEvent event)
           
protected  org.osgi.jmx.framework.BundleStateMBean getBundleStateMBean()
           
protected  ClipboardMBean getClipboardMBean()
           
static org.osgi.framework.launch.Framework getFramework()
           
protected  org.osgi.jmx.framework.FrameworkMBean getFrameworkMBean()
           
protected
<T> T
getMBeanProxy(ObjectName name, Class<T> interf)
           
protected  MBeanServer getMBeanServer()
           
protected  org.osgi.service.packageadmin.PackageAdmin getPackageAdmin()
           
protected  org.osgi.jmx.framework.PackageStateMBean getPackageStateMBean()
           
protected  org.osgi.framework.ServiceReference getServiceReference(String clazz, long timeout)
          Get a ServiceReference within the given timeout.
protected  org.osgi.jmx.framework.ServiceStateMBean getServiceStateMBean()
           
static org.osgi.framework.BundleContext getSystemContext()
           
protected  org.osgi.framework.Bundle installBundle(org.jboss.shrinkwrap.api.Archive<?> archive)
           
protected  org.osgi.framework.Bundle installBundle(String location)
           
protected  org.osgi.framework.Bundle installBundle(String location, InputStream inputStream)
           
protected  org.osgi.framework.Bundle installBundle(org.jboss.osgi.vfs.VirtualFile virtualFile)
           
 void serviceChanged(org.osgi.framework.ServiceEvent event)
           
 void setUp()
          Writes a a debug start messge
static void shutdownFramework()
           
 
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, tearDown, 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

afterClass

public static void afterClass()
                       throws Exception
Throws:
Exception

createFramework

public static org.osgi.framework.launch.Framework createFramework()
                                                           throws org.osgi.framework.BundleException
Throws:
org.osgi.framework.BundleException

getFramework

public static org.osgi.framework.launch.Framework getFramework()
                                                        throws org.osgi.framework.BundleException
Throws:
org.osgi.framework.BundleException

shutdownFramework

public static void shutdownFramework()
                              throws org.osgi.framework.BundleException,
                                     InterruptedException
Throws:
org.osgi.framework.BundleException
InterruptedException

getSystemContext

public static org.osgi.framework.BundleContext getSystemContext()
                                                         throws org.osgi.framework.BundleException
Throws:
org.osgi.framework.BundleException

getPackageAdmin

protected org.osgi.service.packageadmin.PackageAdmin getPackageAdmin()
                                                              throws org.osgi.framework.BundleException
Throws:
org.osgi.framework.BundleException

installBundle

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

installBundle

protected org.osgi.framework.Bundle installBundle(org.jboss.osgi.vfs.VirtualFile virtualFile)
                                           throws org.osgi.framework.BundleException,
                                                  IOException
Throws:
org.osgi.framework.BundleException
IOException

installBundle

protected org.osgi.framework.Bundle installBundle(String location)
                                           throws org.osgi.framework.BundleException,
                                                  IOException
Throws:
org.osgi.framework.BundleException
IOException

installBundle

protected org.osgi.framework.Bundle installBundle(String location,
                                                  InputStream inputStream)
                                           throws org.osgi.framework.BundleException
Throws:
org.osgi.framework.BundleException

frameworkEvent

public void frameworkEvent(org.osgi.framework.FrameworkEvent event)
Specified by:
frameworkEvent in interface org.osgi.framework.FrameworkListener

assertNoFrameworkEvent

protected void assertNoFrameworkEvent()
                               throws Exception
Throws:
Exception

assertFrameworkEvent

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

bundleChanged

public void bundleChanged(org.osgi.framework.BundleEvent event)
Specified by:
bundleChanged in interface org.osgi.framework.BundleListener

assertNoBundleEvent

protected void assertNoBundleEvent()
                            throws Exception
Throws:
Exception

assertBundleEvent

protected void assertBundleEvent(int type,
                                 org.osgi.framework.Bundle bundle)
                          throws Exception
Throws:
Exception

serviceChanged

public void serviceChanged(org.osgi.framework.ServiceEvent event)
Specified by:
serviceChanged in interface org.osgi.framework.ServiceListener

assertNoServiceEvent

protected void assertNoServiceEvent()
                             throws Exception
Throws:
Exception

assertServiceEvent

protected void assertServiceEvent(int type,
                                  org.osgi.framework.ServiceReference reference)
                           throws Exception
Throws:
Exception

assertNoAllReferences

protected void assertNoAllReferences(org.osgi.framework.BundleContext bundleContext,
                                     String clazz)
                              throws Exception
Throws:
Exception

assertNoAllReferences

protected void assertNoAllReferences(org.osgi.framework.BundleContext bundleContext,
                                     String clazz,
                                     String filter)
                              throws Exception
Throws:
Exception

assertAllReferences

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

assertAllReferences

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

assertNoReferences

protected void assertNoReferences(org.osgi.framework.BundleContext bundleContext,
                                  String clazz)
                           throws Exception
Throws:
Exception

assertNoReferences

protected void assertNoReferences(org.osgi.framework.BundleContext bundleContext,
                                  String clazz,
                                  String filter)
                           throws Exception
Throws:
Exception

assertReferences

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

assertReferences

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

assertNoGetReference

protected void assertNoGetReference(org.osgi.framework.BundleContext bundleContext,
                                    String clazz)
                             throws Exception
Throws:
Exception

assertGetReference

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

assertUsingBundles

protected void assertUsingBundles(org.osgi.framework.ServiceReference reference,
                                  org.osgi.framework.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 org.osgi.jmx.framework.FrameworkMBean getFrameworkMBean()
                                                           throws IOException
Throws:
IOException

getBundleStateMBean

protected org.osgi.jmx.framework.BundleStateMBean getBundleStateMBean()
                                                               throws IOException
Throws:
IOException

getPackageStateMBean

protected org.osgi.jmx.framework.PackageStateMBean getPackageStateMBean()
                                                                 throws IOException
Throws:
IOException

getServiceStateMBean

protected org.osgi.jmx.framework.ServiceStateMBean getServiceStateMBean()
                                                                 throws IOException
Throws:
IOException

getClipboardMBean

protected ClipboardMBean getClipboardMBean()
                                    throws IOException
Throws:
IOException

getServiceReference

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

Throws:
org.osgi.framework.BundleException


Copyright © 2010. All Rights Reserved.