|
||||||||||
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 org.springframework.osgi.test.AbstractDependencyManagerTests org.springframework.osgi.test.AbstractOnTheFlyBundleCreatorTests
public abstract class AbstractOnTheFlyBundleCreatorTests
Enhanced subclass of AbstractDependencyManagerTests
that facilitates
OSGi testing by creating at runtime, on the fly, a jar using the indicated
manifest and resource patterns (by default all files found under the root
path).
Import-Package
entries (for packages not found in the bundle)
are created.
Please see the reference documentation for an in-depth explanation and usage
examples.
Note that in more complex scenarios, dedicated packaging tools (such as
ant scripts or maven2) should be used.
It is recommend to extend AbstractConfigurableBundleCreatorTests
rather then this class as the former offers sensible defaults.
Field Summary |
---|
Fields inherited from class org.springframework.osgi.test.AbstractSynchronizedOsgiTests |
---|
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 | |
---|---|
AbstractOnTheFlyBundleCreatorTests()
|
|
AbstractOnTheFlyBundleCreatorTests(String testName)
|
Method Summary | |
---|---|
protected Manifest |
createDefaultManifest()
Creates the default manifest in case none if found on the disk. |
protected boolean |
createManifestOnlyFromTestClass()
Indicates if the automatic manifest creation should consider only the test class ( true ) or all classes included in the test
bundle(false ). |
protected String[] |
getBundleContentPattern()
Returns the patterns used for identifying the resources added to the jar. |
protected Manifest |
getManifest()
Returns the current test bundle manifest. |
protected String |
getManifestLocation()
Returns the location (in Spring resource style) of the manifest location to be used. |
protected String |
getRootPath()
Returns the root path used for locating the resources that will be packed in the test bundle (the root path does not become part of the jar). |
protected void |
postProcessBundleContext(BundleContext context)
Post-processes the bundle context. |
Methods inherited from class org.springframework.osgi.test.AbstractDependencyManagerTests |
---|
getLocator, getSpringDMVersion, getSpringVersion, getTestBundles, getTestBundlesNames, getTestFrameworkBundles, getTestFrameworkBundlesNames, getTestingFrameworkBundlesConfiguration, locateBundle, locateBundles, preProcessBundleContext |
Methods inherited from class org.springframework.osgi.test.AbstractSynchronizedOsgiTests |
---|
getDefaultWaitTime, shouldWaitForSpringBundlesContextCreation, waitOnContextCreation, waitOnContextCreation, waitOnContextCreation |
Methods inherited from class org.springframework.osgi.test.AbstractConfigurableOsgiTests |
---|
createPlatform, getBootDelegationPackages, getPlatformName |
Methods inherited from class org.springframework.osgi.test.AbstractOsgiTests |
---|
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 |
Constructor Detail |
---|
public AbstractOnTheFlyBundleCreatorTests()
public AbstractOnTheFlyBundleCreatorTests(String testName)
Method Detail |
---|
protected String getRootPath()
"file:./target/test-classes"
protected String[] getBundleContentPattern()
**/*
.
In large test environments, performance can be improved by limiting
the resource added to the bundle by selecting only certain packages or
classes. This results in a small test bundle which is faster to create,
deploy and install.
protected String getManifestLocation()
null
is returned, indicating that
the manifest should be picked up from the bundle content (if it's
available) or be automatically created based on the test class imports.
getManifest()
,
createDefaultManifest()
protected Manifest getManifest()
null
(default), it will search for
META-INF/MANIFEST.MF
file in jar content (as specified
through the patterns) and, if it cannot find the file,
automatically create a Manifest
object
containing default entries.
Subclasses can override this method to enhance the returned
Manifest.
createDefaultManifest()
protected boolean createManifestOnlyFromTestClass()
true
) or all classes included in the test
bundle(false
). The latter should be used when the test
bundle contains additional classes that help with the test case.
By default, this method returns true
, meaning that
only the test class will be searched for dependencies.
protected Manifest createDefaultManifest()
protected void postProcessBundleContext(BundleContext context) 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 AbstractSynchronizedOsgiTests
context
- the platform bundle context
Exception
AbstractOsgiTests.preProcessBundleContext(BundleContext)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |