org.springframework.osgi.test
Class AbstractOnTheFlyBundleCreatorTests

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.springframework.test.ConditionalTestCase
              extended by org.springframework.test.AbstractSpringContextTests
                  extended by org.springframework.test.AbstractSingleSpringContextTests
                      extended by org.springframework.test.AbstractDependencyInjectionSpringContextTests
                          extended by org.springframework.osgi.test.AbstractOptionalDependencyInjectionTests
                              extended by org.springframework.osgi.test.AbstractOsgiTests
                                  extended by org.springframework.osgi.test.AbstractConfigurableOsgiTests
                                      extended by org.springframework.osgi.test.AbstractSynchronizedOsgiTests
                                          extended by org.springframework.osgi.test.AbstractDependencyManagerTests
                                              extended by org.springframework.osgi.test.AbstractOnTheFlyBundleCreatorTests
All Implemented Interfaces:
Test, org.springframework.osgi.internal.test.OsgiJUnitTest
Direct Known Subclasses:
AbstractConfigurableBundleCreatorTests

public abstract class AbstractOnTheFlyBundleCreatorTests
extends AbstractDependencyManagerTests

Enhanced subclass of AbstractDependencyManagerTests which 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).

Note that in more complex scenarios, dedicated packaging tools (such as ant scripts or maven2) should be used.

Author:
Costin Leau

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
bundleContext, resourceLoader
 
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
 
Fields inherited from interface org.springframework.osgi.internal.test.OsgiJUnitTest
FOR_OSGI, FROM_OSGI, OSGI_TEST, OSGI_TEST_BUNDLE_ID
 
Constructor Summary
AbstractOnTheFlyBundleCreatorTests()
           
AbstractOnTheFlyBundleCreatorTests(String testName)
           
 
Method Summary
protected  Manifest createDefaultManifest()
          Create the default manifest in case none if found on the disk.
protected  String[] getBundleContentPattern()
          Patterns for identifying the resources added to the jar.
protected  Manifest getManifest()
          Return the current test bundle manifest.
protected  String getManifestLocation()
          Return the location (in Spring resource style) of the manifest location to be used.
protected  void postProcessBundleContext(BundleContext context)
          Take care of waiting for Spring powered bundle application context creation.
 
Methods inherited from class org.springframework.osgi.test.AbstractDependencyManagerTests
getBundleLocations, getBundles, getLocator, getMandatoryBundles, getSpringBundledVersion, getSpringOsgiVersion, getTestBundles, getTestBundlesNames, getTestFrameworkBundles, getTestFrameworkBundlesNames, getTestingFrameworkBundlesConfiguration, injectLocator, localMavenArtifact, localMavenArtifact, locateBundle, 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
getBundleContext, getResourceLoader, injectBundleContext, injectOsgiJUnitTest, osgiRunTest, osgiSetUp, osgiTearDown, run, runBare, setName
 
Methods inherited from class org.springframework.osgi.test.AbstractOptionalDependencyInjectionTests
createApplicationContext
 
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, customizeBeanFactory, getApplicationContext, getConfigLocations, getConfigPath, getConfigPaths, getLoadCount, loadContext, loadContextLocations, onSetUp, onTearDown, 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, 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

AbstractOnTheFlyBundleCreatorTests

public AbstractOnTheFlyBundleCreatorTests()

AbstractOnTheFlyBundleCreatorTests

public AbstractOnTheFlyBundleCreatorTests(String testName)
Method Detail

getBundleContentPattern

protected String[] getBundleContentPattern()
Patterns for identifying the resources added to the jar. The patterns are added to the root path when performing the search.

Returns:
the patterns

getManifestLocation

protected String getManifestLocation()
Return the location (in Spring resource style) of the manifest location to be used. If the manifest is created programatically, return a null string and use getManifest() and createDefaultManifest().

Returns:
the manifest location

getManifest

protected Manifest getManifest()
Return the current test bundle manifest. The method tries to read the manifest from the given location; in case the location is null, will create a Manifest object containing default entries. Subclasses should override this method to enhance the returned Manifest.

Returns:
Manifest used for this test suite.
Throws:
Exception
See Also:
createDefaultManifest()

createDefaultManifest

protected Manifest createDefaultManifest()
Create the default manifest in case none if found on the disk. By default, the imports are synthetised based on the test class bytecode.

Returns:

postProcessBundleContext

protected void postProcessBundleContext(BundleContext context)
                                 throws Exception
Description copied from class: AbstractSynchronizedOsgiTests
Take care of waiting for Spring powered bundle application context creation.

Overrides:
postProcessBundleContext in class AbstractSynchronizedOsgiTests
Throws:
Exception
See Also:
AbstractOsgiTests.preProcessBundleContext(BundleContext)


Copyright © 2006-2007 Spring Framework. All Rights Reserved.