|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
public abstract class AbstractSynchronizedOsgiTests
JUnit superclass which offers synchronization for application context initialization. The class automatically determines Spring powered bundles that are installed by the testing framework and (by default), will wait for their application context to fully start. Only after all the application contexts have been fully refreshed, the actual test execution will commence.
The class also provides utility waiting methods for discovering Spring application context (published as OSGi services) in case programmatic waiting is required (for example, when installing bundles manually). As the rest of the other classes, the behaviour of this class can be customized by extending its methods.
Field Summary | |
---|---|
protected static long |
DEFAULT_WAIT_TIME
|
Fields inherited from class org.springframework.osgi.test.AbstractConfigurableOsgiTests |
---|
OSGI_FRAMEWORK_SELECTOR |
Fields inherited from class org.springframework.osgi.test.AbstractOsgiTests |
---|
resourceLoader |
Fields inherited from class org.springframework.osgi.test.AbstractOptionalDependencyInjectionTests |
---|
bundleContext |
Fields inherited from class org.springframework.test.AbstractDependencyInjectionSpringContextTests |
---|
AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_NO |
Fields inherited from class org.springframework.test.AbstractSingleSpringContextTests |
---|
applicationContext |
Fields inherited from class org.springframework.test.ConditionalTestCase |
---|
logger |
Constructor Summary | |
---|---|
AbstractSynchronizedOsgiTests()
Default constructor. |
|
AbstractSynchronizedOsgiTests(String name)
Constructs a new AbstractSynchronizedOsgiTests instance. |
Method Summary | |
---|---|
protected long |
getDefaultWaitTime()
Returns the test default waiting time (in seconds). |
protected void |
postProcessBundleContext(BundleContext platformBundleContext)
Post-processes the bundle context. |
protected boolean |
shouldWaitForSpringBundlesContextCreation()
Indicates whether the test class should wait or not for the context creation of Spring/OSGi bundles before executing the tests. |
protected void |
waitOnContextCreation(BundleContext context,
String forBundleWithSymbolicName,
long timeout)
Waits for a Spring powered bundle, given by its symbolic name, to be fully started. |
protected void |
waitOnContextCreation(String forBundleWithSymbolicName)
Waits for a Spring powered bundle, given by its symbolic name, to be fully started. |
protected void |
waitOnContextCreation(String forBundleWithSymbolicName,
long timeout)
Waits for a Spring powered bundle, given by its symbolic name to be fully started. |
Methods inherited from class org.springframework.osgi.test.AbstractConfigurableOsgiTests |
---|
createPlatform, getBootDelegationPackages, getPlatformName |
Methods inherited from class org.springframework.osgi.test.AbstractOsgiTests |
---|
getTestBundles, getTestFrameworkBundles, preProcessBundleContext, run, runBare |
Methods inherited from class org.springframework.osgi.test.AbstractOptionalDependencyInjectionTests |
---|
createApplicationContext, isContextKeyEmpty |
Methods inherited from class org.springframework.test.AbstractDependencyInjectionSpringContextTests |
---|
getAutowireMode, injectDependencies, isDependencyCheck, isPopulateProtectedVariables, prepareTestInstance, setAutowireMode, setDependencyCheck, setPopulateProtectedVariables |
Methods inherited from class org.springframework.test.AbstractSingleSpringContextTests |
---|
contextKey, createBeanDefinitionReader, customizeBeanFactory, getApplicationContext, getConfigLocations, getConfigPath, getConfigPaths, getLoadCount, loadContext, loadContextLocations, onSetUp, onTearDown, prepareApplicationContext, setDirty, setUp, tearDown |
Methods inherited from class org.springframework.test.AbstractSpringContextTests |
---|
addContext, contextKeyString, getContext, hasCachedContext, setDirty |
Methods inherited from class org.springframework.test.ConditionalTestCase |
---|
getDisabledTestCount, isDisabledInThisEnvironment, recordDisabled |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, runTest, setName, toString |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final long DEFAULT_WAIT_TIME
Constructor Detail |
---|
public AbstractSynchronizedOsgiTests()
AbstractSynchronizedOsgiTests
instance.
public AbstractSynchronizedOsgiTests(String name)
AbstractSynchronizedOsgiTests
instance.
name
- test nameMethod Detail |
---|
protected void waitOnContextCreation(String forBundleWithSymbolicName, long timeout)
forBundleWithSymbolicName
- bundle symbolic nametimeout
- maximum time to wait (in seconds) for the application
context to be publishedprotected void waitOnContextCreation(BundleContext context, String forBundleWithSymbolicName, long timeout)
context
- bundle context to use for service lookupforBundleWithSymbolicName
- bundle symbolic nametimeout
- maximum time to wait (in seconds) for the application
context to be publishedprotected void waitOnContextCreation(String forBundleWithSymbolicName)
getDefaultWaitTime()
).
This method is used by the testing framework at startup before
executing the actual tests.
forBundleWithSymbolicName
- bundle symbolic namegetDefaultWaitTime()
,
waitOnContextCreation(BundleContext, String, long)
protected long getDefaultWaitTime()
DEFAULT_WAIT_TIME
is not enough. For
more customization, consider setting
shouldWaitForSpringBundlesContextCreation()
to false and using
waitOnContextCreation(BundleContext, String, long)
.
protected boolean shouldWaitForSpringBundlesContextCreation()
protected void postProcessBundleContext(BundleContext platformBundleContext) throws Exception
AbstractOsgiTests
BundleContext
belongs to the underlying OSGi
framework.
Normally, this method is called only one during the lifecycle of a
test suite.
postProcessBundleContext
in class AbstractOsgiTests
platformBundleContext
- the platform bundle context
Exception
AbstractOsgiTests.preProcessBundleContext(BundleContext)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |