org.springframework.osgi.test
Class AbstractSynchronizedOsgiTests
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.springframework.test.ConditionalTestCase
org.springframework.test.AbstractSpringContextTests
org.springframework.test.AbstractSingleSpringContextTests
org.springframework.test.AbstractDependencyInjectionSpringContextTests
org.springframework.osgi.test.AbstractOptionalDependencyInjectionTests
org.springframework.osgi.test.AbstractOsgiTests
org.springframework.osgi.test.AbstractConfigurableOsgiTests
org.springframework.osgi.test.AbstractSynchronizedOsgiTests
- All Implemented Interfaces:
- Test, org.springframework.osgi.internal.test.OsgiJUnitTest
- Direct Known Subclasses:
- AbstractDependencyManagerTests
public abstract class AbstractSynchronizedOsgiTests
- extends AbstractConfigurableOsgiTests
JUnit superclass which offers synchronization for bundle initialization. It
provides utility waiting methods for bundle initialization.
- Author:
- Costin Leau, Adrian Colyer
Fields inherited from interface org.springframework.osgi.internal.test.OsgiJUnitTest |
FOR_OSGI, FROM_OSGI, OSGI_TEST, OSGI_TEST_BUNDLE_ID |
Methods inherited from class org.springframework.osgi.test.AbstractOsgiTests |
getBundleContext, getBundleLocations, getBundles, getMandatoryBundles, getResourceLoader, getTestBundles, getTestFrameworkBundles, injectBundleContext, injectOsgiJUnitTest, osgiRunTest, osgiSetUp, osgiTearDown, preProcessBundleContext, run, runBare, setName |
Methods inherited from class org.springframework.test.AbstractSingleSpringContextTests |
contextKey, customizeBeanFactory, getApplicationContext, getConfigLocations, getConfigPath, getConfigPaths, getLoadCount, loadContext, loadContextLocations, onSetUp, onTearDown, setDirty, setUp, tearDown |
Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame |
DEFAULT_WAIT_TIME
protected static final long DEFAULT_WAIT_TIME
- See Also:
- Constant Field Values
AbstractSynchronizedOsgiTests
public AbstractSynchronizedOsgiTests()
AbstractSynchronizedOsgiTests
public AbstractSynchronizedOsgiTests(String name)
waitOnContextCreation
public void waitOnContextCreation(String forBundleWithSymbolicName,
long timeout)
- Place the current (test) thread to wait for the a Spring application
context to be published under the given symbolic name. This method allows
waiting for full initialization of Spring OSGi bundles before starting
the actual test execution.
- Parameters:
context
- forBundleWithSymbolicName
- timeout
- time to wait (in seconds) for the application context to be published
waitOnContextCreation
public void waitOnContextCreation(BundleContext context,
String forBundleWithSymbolicName,
long timeout)
- Place the current (test) thread to wait for the a Spring application
context to be published under the given symbolic name. This method allows
waiting for full initialization of Spring OSGi bundles before starting
the actual test execution.
- Parameters:
context
- forBundleWithSymbolicName
- timeout
-
waitOnContextCreation
public void waitOnContextCreation(String forBundleWithSymbolicName)
- 'Sugar' method - identical to waitOnContextCreation(
AbstractOsgiTests.getBundleContext()
,
forBundleWithSymbolicName, getDefaultWaitTime()
).
- Parameters:
forBundleWithSymbolicName
-
getDefaultWaitTime
protected long getDefaultWaitTime()
- Return the default waiting time in seconds for
waitOnContextCreation(String)
. Subclasses should override this
method if the DEFAULT_WAIT_TIME
is not enough. For more
customization, consider setting
shouldWaitForSpringBundlesContextCreation()
to false and using
waitOnContextCreation(BundleContext, String, long)
.
- Returns:
- the default wait time (in seconds) for each spring bundle context
to be published as an OSGi service
shouldWaitForSpringBundlesContextCreation
protected boolean shouldWaitForSpringBundlesContextCreation()
- Should the test class wait for the context creation of Spring/OSGi
bundles before executing the tests or not? Default is true.
- Returns:
- true if the test will wait for spring bundle context creation or
false otherwise
postProcessBundleContext
protected void postProcessBundleContext(BundleContext platformBundleContext)
throws Exception
- Take care of waiting for Spring powered bundle application context
creation.
- Overrides:
postProcessBundleContext
in class AbstractOsgiTests
- Throws:
Exception
- See Also:
AbstractOsgiTests.preProcessBundleContext(BundleContext)
Copyright © 2006-2007 Spring Framework. All Rights Reserved.