org.ops4j.pax.exam.rbc.client
Class RemoteBundleContextClient

java.lang.Object
  extended by org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient
All Implemented Interfaces:
TestContainer

public class RemoteBundleContextClient
extends java.lang.Object
implements TestContainer

A RemoteBundleContext client, that takes away RMI handling.

Since:
0.3.0, December 15, 2008
Author:
Alin Dreghiciu (adreghiciu@gmail.com)

Constructor Summary
RemoteBundleContextClient(java.lang.Integer rmiPort, long rmiLookupTimeout)
          Constructor.
 
Method Summary
 java.lang.Integer getRmiPort()
          Getter.
<T> T
getService(java.lang.Class<T> serviceType)
          
<T> T
getService(java.lang.Class<T> serviceType, long timeoutInMillis)
           Returns a dynamic proxy in place of the actual service, forwarding the calls via the remote bundle context.
 long installBundle(java.lang.String bundleUrl)
          
 long installBundle(java.lang.String bundleLocation, byte[] bundle)
          
 void setBundleStartLevel(long bundleId, int startLevel)
          Sets the start level for a bundle.
 void start()
          Starts the test container.
 void startBundle(long bundleId)
          
 void stop()
          Stops the test container.
 void waitForState(long bundleId, int state, long timeoutInMillis)
          Waits for a bundle to be in a certain state and returns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteBundleContextClient

public RemoteBundleContextClient(java.lang.Integer rmiPort,
                                 long rmiLookupTimeout)
Constructor.

Parameters:
rmiPort - RMI communication port (cannot be null)
rmiLookupTimeout - timeout for looking up the remote bundle context via RMI (cannot be null)
Method Detail

getService

public <T> T getService(java.lang.Class<T> serviceType)

Specified by:
getService in interface TestContainer

getService

public <T> T getService(java.lang.Class<T> serviceType,
                        long timeoutInMillis)
Returns a dynamic proxy in place of the actual service, forwarding the calls via the remote bundle context.

Specified by:
getService in interface TestContainer

installBundle

public long installBundle(java.lang.String bundleUrl)

Specified by:
installBundle in interface TestContainer

installBundle

public long installBundle(java.lang.String bundleLocation,
                          byte[] bundle)
                   throws TestContainerException

Specified by:
installBundle in interface TestContainer
Throws:
TestContainerException

startBundle

public void startBundle(long bundleId)
                 throws TestContainerException

Specified by:
startBundle in interface TestContainer
Throws:
TestContainerException

setBundleStartLevel

public void setBundleStartLevel(long bundleId,
                                int startLevel)
                         throws TestContainerException
Sets the start level for a bundle.

Specified by:
setBundleStartLevel in interface TestContainer
Parameters:
bundleId - bundle id
startLevel - start level
Throws:
TestContainerException - if startlevel cannot be set

start

public void start()
Starts the test container.

Specified by:
start in interface TestContainer

stop

public void stop()
Stops the test container.

Specified by:
stop in interface TestContainer

waitForState

public void waitForState(long bundleId,
                         int state,
                         long timeoutInMillis)
                  throws TimeoutException
Waits for a bundle to be in a certain state and returns.

Specified by:
waitForState in interface TestContainer
Parameters:
bundleId - bundle id
state - expected state
timeoutInMillis - max time to wait for state
Throws:
TimeoutException - - if timeout occured and expected state has not being reached

getRmiPort

public java.lang.Integer getRmiPort()
Getter.

Returns:
rmi port


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.