|
||||||||||
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
public abstract class AbstractDependencyManagerTests
Dependency manager class - deals with locating of various artifacts required by the OSGi test. The artifacts are considered to be OSGi bundles that will be installed during the OSGi platform startup. Additionally this class installs the testing framework required bundles (such as Spring, Spring-DM).
This implementation uses internally anArtifactLocator
to
retrieve the required dependencies for the running test. By default, the
artifact locator uses the local maven 2 repository. Currently, no Maven
configurations (such as <settings.xml>) are supported. If the maven
repository is located in a non-default location, use the
localRepository
system property to specify the folder URL.
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 | |
---|---|
AbstractDependencyManagerTests()
Default constructor. |
|
AbstractDependencyManagerTests(String name)
Constructs a new AbstractDependencyManagerTests instance. |
Method Summary | |
---|---|
protected ArtifactLocator |
getLocator()
Returns the ArtifactLocator used by this test suite. |
protected String |
getSpringDMVersion()
Returns the version of the Spring-DM bundles installed by the testing framework. |
protected String |
getSpringVersion()
Returns the version of the Spring bundles installed by the testing framework. |
protected Resource[] |
getTestBundles()
Returns the bundles required for the test execution. Default implementation that uses the ArtifactLocator to
resolve the bundles specified in getTestBundlesNames() . |
protected String[] |
getTestBundlesNames()
Returns the bundles that have to be installed as part of the test setup. |
protected Resource[] |
getTestFrameworkBundles()
Returns the test framework bundles (part of the test setup). Default implementation that uses getTestFrameworkBundlesNames() to discover the bundles part of
the testing framework. |
protected String[] |
getTestFrameworkBundlesNames()
Returns the bundles that have to be installed as part of the test setup. |
protected Resource |
getTestingFrameworkBundlesConfiguration()
Returns the location of the test framework bundles configuration. |
protected Resource |
locateBundle(String bundleId)
Locates (through the ArtifactLocator ) an OSGi bundle given as a
String. |
protected Resource[] |
locateBundles(String[] bundles)
Locates the given bundle identifiers. |
protected void |
preProcessBundleContext(BundleContext platformBundleContext)
Pre-processes the bundle context. Sets specific log4j propety to avoid class loading problems during start up related to the thread context class loader. |
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 |
---|
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, 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 AbstractDependencyManagerTests()
AbstractDependencyManagerTests
instance.
public AbstractDependencyManagerTests(String name)
AbstractDependencyManagerTests
instance.
name
- test nameMethod Detail |
---|
protected String getSpringDMVersion()
protected String getSpringVersion()
protected String[] getTestBundlesNames()
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 (Comma
Separated Values) format is expected.
This method allows a declarative approach in declaring bundles as
opposed to getTestBundles()
which provides a programmatic one.
locateBundle(String)
protected String[] getTestFrameworkBundlesNames()
Resource
s. It allows for a declarative approach for
specifying bundles as opposed to getTestBundles()
which provides
a programmatic one.
This implementation reads a predefined properties file to determine
the bundles needed. If the configuration needs to be changed, consider
changing the configuration location.
getTestingFrameworkBundlesConfiguration()
,
locateBundle(String)
protected Resource getTestingFrameworkBundlesConfiguration()
protected Resource[] getTestBundles()
ArtifactLocator
to
resolve the bundles specified in getTestBundlesNames()
.
Subclasses that override this method should decide whether they want to
support getTestBundlesNames()
or not.
getTestBundles
in class AbstractOsgiTests
AbstractOsgiTests.getTestBundles()
protected Resource[] getTestFrameworkBundles()
AbstractOsgiTests.getTestBundles()
instead.
Default implementation that uses
getTestFrameworkBundlesNames()
to discover the bundles part of
the testing framework.
getTestFrameworkBundles
in class AbstractOsgiTests
AbstractOsgiTests.getTestFrameworkBundles()
protected Resource[] locateBundles(String[] bundles)
locateBundle(String)
.
bundles
- bundle identifiers
protected void preProcessBundleContext(BundleContext platformBundleContext) throws Exception
preProcessBundleContext
in class AbstractOsgiTests
platformBundleContext
- the platform bundle context
Exception
- if processing the bundle context failsAbstractOsgiTests.postProcessBundleContext(BundleContext)
protected Resource locateBundle(String bundleId)
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.
bundleId
- the bundle identifier in CSV format
protected ArtifactLocator getLocator()
Note: This method will be used each time a bundle has to be retrieved; it is highly recommended to return a cached instance instead of a new one each time.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |