org.springframework.osgi.test
Class AbstractDependencyManagerTests

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
All Implemented Interfaces:
Test, org.springframework.osgi.internal.test.OsgiJUnitTest
Direct Known Subclasses:
AbstractOnTheFlyBundleCreatorTests

public abstract class AbstractDependencyManagerTests
extends AbstractSynchronizedOsgiTests

Dependency manager layer - uses internally an ArtifactLocator to retrieve the required dependencies for the running test.

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
AbstractDependencyManagerTests()
           
AbstractDependencyManagerTests(String name)
           
 
Method Summary
protected  String[] getBundleLocations()
          Deprecated. no replacement provided for it
protected  String[] getBundles()
          Deprecated. use getTestBundlesNames() instead.
 ArtifactLocator getLocator()
           
protected  String[] getMandatoryBundles()
          Deprecated. use getTestFrameworkBundlesNames() instead.
protected  String getSpringBundledVersion()
          Return the Spring osgified version used by the test core bundles.
protected  String getSpringOsgiVersion()
          Return the Spring/OSGi version used by the core bundles.
protected  Resource[] getTestBundles()
          Default implementation that uses the ArtifactLocator to resolve the bundles specified in getTestBundlesNames().
protected  String[] getTestBundlesNames()
          Bundles that have to be installed as part of the test setup.
protected  Resource[] getTestFrameworkBundles()
          Default implementation that uses getTestFrameworkBundlesNames() to discover the bundles part of the testing framework.
protected  String[] getTestFrameworkBundlesNames()
          Declarative method indicating the bundles required by the test framework, by their names rather then as Resources.
protected  Resource getTestingFrameworkBundlesConfiguration()
          Return the location of the test framework bundles configuration.
 void injectLocator(ArtifactLocator locator)
           
protected  String localMavenArtifact(String groupId, String artifactId, String version)
          Deprecated. this method will be removed after M3; use {@link #getLocator() and ArtifactLocator#locateArtifact(String, String, String) method instead or simply #locateBundle(String)
protected  String localMavenArtifact(String groupId, String artifactId, String version, String type)
          Deprecated. this method will be removed after M3; use {@link #getLocator() and ArtifactLocator#locateArtifact(String, String, String) method instead or simply #locateBundle(String)
protected  Resource locateBundle(String bundleId)
          Locate (through the ArtifactLocator) an OSGi bundle given as a String.
protected  void preProcessBundleContext(BundleContext platformBundleContext)
          Callback for processing the platform bundle context before any bundles have been installed.
 
Methods inherited from class org.springframework.osgi.test.AbstractSynchronizedOsgiTests
getDefaultWaitTime, postProcessBundleContext, 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

AbstractDependencyManagerTests

public AbstractDependencyManagerTests()

AbstractDependencyManagerTests

public AbstractDependencyManagerTests(String name)
Method Detail

getSpringOsgiVersion

protected String getSpringOsgiVersion()
Return the Spring/OSGi version used by the core bundles.

Returns:

getSpringBundledVersion

protected String getSpringBundledVersion()
Return the Spring osgified version used by the test core bundles.

Returns:

getTestBundlesNames

protected String[] getTestBundlesNames()
Bundles that have to be installed as part of the test setup. This method provides an alternative to getTestBundles() as it allows subclasses to specify just the bundle name w/o worrying about locating the artifact (which is resolved through the ArtifactLocator).

A bundle name can have any value and depends on the format expected by the ArtifactLocator implementation. By default, a CSV format is expected.

This method allows a declarative approach in declaring bundles as opposed to getTestBundles() which provides a programmatic one.

Returns:
an array of bundle identificators
See Also:
locateBundle(String)

getTestFrameworkBundlesNames

protected String[] getTestFrameworkBundlesNames()
Declarative method indicating the bundles required by the test framework, by their names rather then as Resources.

This implementation reads a predefined properties file to determine the bundles needed.

This method allows a declarative approach in declaring bundles as opposed to getTestBundles() which provides a programmatic one.

Returns:
an array of bundle identificators
See Also:
getTestingFrameworkBundlesConfiguration(), locateBundle(String)

getTestingFrameworkBundlesConfiguration

protected Resource getTestingFrameworkBundlesConfiguration()
Return the location of the test framework bundles configuration.

Returns:
location of the test framework bundles configuration

getTestBundles

protected Resource[] getTestBundles()
Default implementation that uses the ArtifactLocator to resolve the bundles specified in getTestBundlesNames(). Subclasses that override this method should decide whether they want to support getTestBundlesNames() or not.

Specified by:
getTestBundles in class AbstractOsgiTests
Returns:
the array of bundles to install
See Also:
AbstractOsgiTests.getTestBundles()

getTestFrameworkBundles

protected Resource[] getTestFrameworkBundles()
Default implementation that uses getTestFrameworkBundlesNames() to discover the bundles part of the testing framework.

Specified by:
getTestFrameworkBundles in class AbstractOsgiTests
Returns:
the array of test framework bundle resources
See Also:
AbstractOsgiTests.getTestFrameworkBundles()

preProcessBundleContext

protected void preProcessBundleContext(BundleContext platformBundleContext)
                                throws Exception
Description copied from class: AbstractOsgiTests
Callback for processing the platform bundle context before any bundles have been installed. The method is invoked after starting the OSGi environment but before any bundles are installed in the OSGi framework. Normally, this method is called only one during the lifecycle of a test suite.

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

locateBundle

protected Resource locateBundle(String bundleId)
Locate (through the ArtifactLocator) an OSGi bundle given as a String. The default implementation expects the argument to be in Comma Separated Values (CSV) format which indicates an artifact group, id, version and optionally the type.

Parameters:
bundleId - the bundle identificator in CSV format
Returns:
a resource pointing to the artifact location

injectLocator

public void injectLocator(ArtifactLocator locator)
Parameters:
locator - The locator to set.

getLocator

public ArtifactLocator getLocator()
Returns:
Returns the locator.

localMavenArtifact

protected String localMavenArtifact(String groupId,
                                    String artifactId,
                                    String version)
Deprecated. this method will be removed after M3; use {@link #getLocator() and ArtifactLocator#locateArtifact(String, String, String) method instead or simply #locateBundle(String)

Compatibility method - will be removed in the very near future.

Parameters:
groupId -
artifactId -
version -
Returns:

localMavenArtifact

protected String localMavenArtifact(String groupId,
                                    String artifactId,
                                    String version,
                                    String type)
Deprecated. this method will be removed after M3; use {@link #getLocator() and ArtifactLocator#locateArtifact(String, String, String) method instead or simply #locateBundle(String)

Compatibility method - will be removed in the very near future.

Parameters:
groupId -
artifactId -
version -
type -
Returns:

getMandatoryBundles

protected String[] getMandatoryBundles()
Deprecated. use getTestFrameworkBundlesNames() instead.

Description copied from class: AbstractOsgiTests
Mandatory bundles (part of the test setup). Used by the test infrastructure. Override this method only if you want to change the jars used by default, by the testing infrastructure. User subclasses should use AbstractOsgiTests.getBundles() instead.

Specified by:
getMandatoryBundles in class AbstractOsgiTests
Returns:
the array of mandatory bundle names.

getBundleLocations

protected String[] getBundleLocations()
Deprecated. no replacement provided for it

Description copied from class: AbstractOsgiTests
Legacy method - will be removed in future SVN revisions.

Overrides:
getBundleLocations in class AbstractOsgiTests
Returns:
See Also:
AbstractOsgiTests.getBundleLocations()

getBundles

protected String[] getBundles()
Deprecated. use getTestBundlesNames() instead.

Description copied from class: AbstractOsgiTests
Bundles that should be installed before the test execution.

Overrides:
getBundles in class AbstractOsgiTests
Returns:
the array of bundles to install
See Also:
AbstractOsgiTests.getBundles()


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