org.ops4j.pax.exam.spi.container
Interface TestContainer

All Known Implementing Classes:
RemoteBundleContextClient

public interface TestContainer

Management of an OSGi framework that can be used as a integration test container.

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

Method Summary
<T> T
getService(java.lang.Class<T> serviceType)
           
<T> T
getService(java.lang.Class<T> serviceType, long timeoutInMillis)
           
 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.
 

Method Detail

getService

<T> T getService(java.lang.Class<T> serviceType)
             throws TestContainerException
Throws:
TestContainerException

getService

<T> T getService(java.lang.Class<T> serviceType,
                 long timeoutInMillis)
             throws TestContainerException
Throws:
TestContainerException

installBundle

long installBundle(java.lang.String bundleUrl)
                   throws TestContainerException
Throws:
TestContainerException

installBundle

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

startBundle

void startBundle(long bundleId)
                 throws TestContainerException
Throws:
TestContainerException

setBundleStartLevel

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

Parameters:
bundleId - bundle id
startLevel - start level
Throws:
TestContainerException - if startlevel cannot be set

start

void start()
           throws TimeoutException
Starts the test container.

Throws:
TimeoutException - - if timeout occured and the test container cannot be started

stop

void stop()
          throws TimeoutException
Stops the test container.

Throws:
TimeoutException - - if timeout occured and the test container cannot be stopped

waitForState

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

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


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