org.glassfish.fighterfish.test.util
Class EjbBundle

java.lang.Object
  extended by org.glassfish.fighterfish.test.util.EjbBundle

public class EjbBundle
extends java.lang.Object

This class is used by tests to deploy Ejb Bundles. Since EJB deployment happens asynchronously when an EJB Bundle is activated, for a test case to know whether the deployment is successful or not is not as simple as checking if b.start() returns succesfully or not. This is where this class is helpful. Unlike OSGi Web Application container, OSGi EJB Spec does not raise events to indicating success or failure of events. So, this class relies on user to tell it at least one service that's being exported by this bundle to OSGi service registry. This class then uses a service tracker to wait for such a service to appear. If such a service does not show up in a specified amount of time, it times out the deployment operation.

Author:
Sanjeeb.Sahoo@Sun.COM

Constructor Summary
EjbBundle(org.osgi.framework.BundleContext ctx, org.osgi.framework.Bundle b, java.lang.String[] services)
          A handle to the EJB bundle being deployed.
 
Method Summary
 void deploy(long timeout, java.util.concurrent.TimeUnit timeUnit)
          Deploy the given EJB OSGi bundle.
 org.osgi.framework.Bundle getBundle()
           
 void undeploy()
          Undeploy the EJB OSGi bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EjbBundle

public EjbBundle(org.osgi.framework.BundleContext ctx,
                 org.osgi.framework.Bundle b,
                 java.lang.String[] services)
A handle to the EJB bundle being deployed.

Parameters:
ctx - BundleContext of test used for various OSGi operation.
b - Bundle to be deployed.
services - Services that are expected to be made available by this EJB bundle if deployment is successful.
Method Detail

deploy

public void deploy(long timeout,
                   java.util.concurrent.TimeUnit timeUnit)
            throws org.osgi.framework.BundleException,
                   java.lang.InterruptedException,
                   TimeoutException
Deploy the given EJB OSGi bundle. Deployment is triggered asynchronously by starting the bundle. If none of the user specified services show up in service registry in the specified amount of time, it assumes the operation has failed and throws TimeoutOperation.

Parameters:
timeout -
timeUnit -
Throws:
org.osgi.framework.BundleException
java.lang.InterruptedException
TimeoutException

undeploy

public void undeploy()
              throws org.osgi.framework.BundleException
Undeploy the EJB OSGi bundle. There is no need for any timeout argument, as undeployment is a synchronous process unlike deployment.

Throws:
org.osgi.framework.BundleException

getBundle

public org.osgi.framework.Bundle getBundle()


Copyright © 2013. All Rights Reserved.