Class RuntimeHarnessImpl
- All Implemented Interfaces:
RuntimeHarness
- Direct Known Subclasses:
NXRuntimeTestCase
- Since:
- 10.2
-
Field Summary
Modifier and TypeFieldDescriptionprotected StandaloneBundleLoader
protected Map<String,
BundleFile> protected boolean
protected static final org.apache.logging.log4j.Logger
protected OSGiAdapter
protected OSGiRuntimeService
protected org.osgi.framework.Bundle
protected TargetResourceLocator
protected URL[]
protected List<WorkingDirectoryConfigurator>
protected File
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
deployBundle
(String name) Deploys a whole OSGI bundle.void
deployContrib
(String name, String contrib) Deploys a contribution from a given bundle.void
deployFolder
(File folder, ClassLoader loader) Deprecated.deployPartial
(String name, Set<TargetExtensions> targetExtensions) Deploys a subset of a Bundle defined per the targetExtensions parameterprotected void
deployPartialComponent
(RuntimeContext ctx, Set<TargetExtensions> extensionPoints, StreamRef component) Read a component from his StreamRef and create a new component (suffixed with `-partial`, and the base component name aliased) with only matching contributions of the extensionPoints parameter.deployTestContrib
(String bundle, String contrib) Deprecated.deployTestContrib
(String bundle, URL contrib) Deprecated.void
Resume the runtimeDeprecated.Runtime context for deploymentOSGI bridgeDeprecated.Gets the framework working directory.protected void
Inits the osgi runtime.protected void
initUrls()
Inits the urls.protected static URL[]
protected boolean
isAnEmptyTestProperty
(Map.Entry<Object, Object> entry) boolean
boolean
listBundleComponents
(org.osgi.framework.Bundle bundle) Listing component's urls of a bundle.protected BundleFile
lookupBundle
(String bundleName) Lookup bundle.protected String
Read symbolic name.void
restart()
void
start()
void
stop()
void
undeployContrib
(String name, String contrib) Undeploys a contribution from a given bundle.protected void
Removes Nuxeo test system properties that are empty.protected void
Makes sure there is no previous runtime hanging around.
-
Field Details
-
log
protected static final org.apache.logging.log4j.Logger log -
bundleLoader
-
bundles
-
frameworkStarted
protected boolean frameworkStarted -
osgi
-
readUris
-
runtime
-
runtimeBundle
protected org.osgi.framework.Bundle runtimeBundle -
targetResourceLocator
-
urls
-
wdConfigs
-
workingDir
-
-
Constructor Details
-
RuntimeHarnessImpl
protected RuntimeHarnessImpl() -
RuntimeHarnessImpl
-
-
Method Details
-
introspectClasspath
-
addWorkingDirectoryConfigurator
- Specified by:
addWorkingDirectoryConfigurator
in interfaceRuntimeHarness
-
deployBundle
Description copied from interface:RuntimeHarness
Deploys a whole OSGI bundle.The lookup is first done on symbolic name, as set in
MANIFEST.MF
and then falls back to the bundle url (e.g.,nuxeo-platform-search-api
) for backwards compatibility.- Specified by:
deployBundle
in interfaceRuntimeHarness
- Parameters:
name
- the symbolic name- Throws:
Exception
-
deployContrib
Description copied from interface:RuntimeHarness
Deploys a contribution from a given bundle.The path will be relative to the bundle root. Example:
deployContrib("org.nuxeo.ecm.core", "OSGI-INF/CoreExtensions.xml")
For compatibility reasons the name of the bundle may be a jar name, but this use is discouraged and deprecated.
- Specified by:
deployContrib
in interfaceRuntimeHarness
- Parameters:
name
- the name of the bundle to peek the contrib incontrib
- the path to contrib in the bundle.- Throws:
Exception
-
deployFolder
Deprecated.- Specified by:
deployFolder
in interfaceRuntimeHarness
- Throws:
Exception
-
deployPartial
public RuntimeContext deployPartial(String name, Set<TargetExtensions> targetExtensions) throws Exception Description copied from interface:RuntimeHarness
Deploys a subset of a Bundle defined per the targetExtensions parameter- Specified by:
deployPartial
in interfaceRuntimeHarness
- Parameters:
name
- the name of the componenttargetExtensions
- Set of allowed TargetExtensions in the final contribution- Throws:
Exception
-
deployTestContrib
Deprecated.Description copied from interface:RuntimeHarness
Deploys an XML contribution from outside a bundle.This should be used by tests wiling to deploy test contribution as part of a real bundle.
The bundle owner is important since the contribution may depend on resources deployed in that bundle.
Note that the owner bundle MUST be an already deployed bundle.
- Specified by:
deployTestContrib
in interfaceRuntimeHarness
- Parameters:
bundle
- the bundle that becomes the contribution ownercontrib
- the contribution to deploy as part of the given bundle- Throws:
Exception
-
deployTestContrib
Deprecated.- Specified by:
deployTestContrib
in interfaceRuntimeHarness
- Throws:
Exception
-
fireFrameworkStarted
public void fireFrameworkStarted()Description copied from interface:RuntimeHarness
Resume the runtime- Specified by:
fireFrameworkStarted
in interfaceRuntimeHarness
-
getClassLoaderFiles
Deprecated.- Specified by:
getClassLoaderFiles
in interfaceRuntimeHarness
- Throws:
URISyntaxException
-
getContext
Description copied from interface:RuntimeHarness
Runtime context for deployment- Specified by:
getContext
in interfaceRuntimeHarness
-
getOSGiAdapter
Description copied from interface:RuntimeHarness
OSGI bridge- Specified by:
getOSGiAdapter
in interfaceRuntimeHarness
-
getProperties
Deprecated.Description copied from interface:RuntimeHarness
Framework properties for variable injections- Specified by:
getProperties
in interfaceRuntimeHarness
-
getWorkingDir
Description copied from interface:RuntimeHarness
Gets the framework working directory.- Specified by:
getWorkingDir
in interfaceRuntimeHarness
-
isRestart
public boolean isRestart()- Specified by:
isRestart
in interfaceRuntimeHarness
-
isStarted
public boolean isStarted()- Specified by:
isStarted
in interfaceRuntimeHarness
-
restart
- Specified by:
restart
in interfaceRuntimeHarness
- Throws:
Exception
-
start
- Specified by:
start
in interfaceRuntimeHarness
- Throws:
Exception
-
stop
- Specified by:
stop
in interfaceRuntimeHarness
- Throws:
Exception
-
undeployContrib
Description copied from interface:RuntimeHarness
Undeploys a contribution from a given bundle.The path will be relative to the bundle root. Example:
undeployContrib("org.nuxeo.ecm.core", "OSGI-INF/CoreExtensions.xml")
- Specified by:
undeployContrib
in interfaceRuntimeHarness
- Parameters:
name
- the bundlecontrib
- the contribution
-
deployPartialComponent
protected void deployPartialComponent(RuntimeContext ctx, Set<TargetExtensions> extensionPoints, StreamRef component) throws IOException Read a component from his StreamRef and create a new component (suffixed with `-partial`, and the base component name aliased) with only matching contributions of the extensionPoints parameter.- Parameters:
ctx
- RuntimeContext in which the new component will be deployedextensionPoints
- Set of white listed TargetExtensionscomponent
- Reference to the original component- Throws:
IOException
- Signals that an I/O exception has occurred.
-
initOsgiRuntime
Inits the osgi runtime.- Throws:
Exception
- the exception
-
initUrls
protected void initUrls()Inits the urls. -
listBundleComponents
Listing component's urls of a bundle. Inspired from org.nuxeo.runtime.osgi.OSGiRuntimeService#loadComponents but without deploying anything.- Parameters:
bundle
- Bundle to be read- Returns:
- the stream
-
lookupBundle
Lookup bundle.- Parameters:
bundleName
- the bundle name- Returns:
- the bundle file
- Throws:
Exception
- the exception
-
readSymbolicName
Read symbolic name.- Parameters:
bf
- the bf- Returns:
- the string
-
wipeRuntime
protected void wipeRuntime()Makes sure there is no previous runtime hanging around.This happens for instance if a previous test had errors in its
setUp()
, becausetearDown()
has not been called. -
wipeEmptyTestSystemProperties
protected void wipeEmptyTestSystemProperties()Removes Nuxeo test system properties that are empty.This is needed when using maven surefire > 2.17 because since SUREFIRE-649 surefire propagates empty system properties.
-
isAnEmptyTestProperty
-