public class RuntimeHarnessImpl extends Object implements RuntimeHarness
Modifier and Type | Field and Description |
---|---|
protected StandaloneBundleLoader |
bundleLoader |
protected Map<String,BundleFile> |
bundles |
protected boolean |
frameworkStarted |
protected static org.apache.logging.log4j.Logger |
log |
protected OSGiAdapter |
osgi |
protected Set<URI> |
readUris |
protected OSGiRuntimeService |
runtime |
protected org.osgi.framework.Bundle |
runtimeBundle |
protected TargetResourceLocator |
targetResourceLocator |
protected URL[] |
urls |
protected List<WorkingDirectoryConfigurator> |
wdConfigs |
protected File |
workingDir |
Modifier | Constructor and Description |
---|---|
protected |
RuntimeHarnessImpl() |
|
RuntimeHarnessImpl(Class<?> clazz) |
Modifier and Type | Method and Description |
---|---|
void |
addWorkingDirectoryConfigurator(WorkingDirectoryConfigurator config) |
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.
|
RuntimeContext |
deployPartial(String name,
Set<TargetExtensions> targetExtensions)
Deploys a subset of a Bundle defined per the targetExtensions parameter
|
protected 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.
|
RuntimeContext |
deployTestContrib(String bundle,
String contrib)
Deprecated.
|
RuntimeContext |
deployTestContrib(String bundle,
URL contrib)
Deprecated.
|
void |
fireFrameworkStarted()
Resume the runtime
|
List<String> |
getClassLoaderFiles()
Deprecated.
|
RuntimeContext |
getContext()
Runtime context for deployment
|
OSGiAdapter |
getOSGiAdapter()
OSGI bridge
|
Properties |
getProperties()
Deprecated.
|
File |
getWorkingDir()
Gets the framework working directory.
|
protected void |
initOsgiRuntime()
Inits the osgi runtime.
|
protected void |
initUrls()
Inits the urls.
|
protected static URL[] |
introspectClasspath() |
protected boolean |
isAnEmptyTestProperty(Map.Entry<Object,Object> entry) |
boolean |
isRestart() |
boolean |
isStarted() |
protected Stream<URL> |
listBundleComponents(org.osgi.framework.Bundle bundle)
Listing component's urls of a bundle.
|
protected BundleFile |
lookupBundle(String bundleName)
Lookup bundle.
|
protected String |
readSymbolicName(BundleFile bf)
Read symbolic name.
|
void |
restart() |
void |
start() |
void |
stop() |
void |
undeployContrib(String name,
String contrib)
Undeploys a contribution from a given bundle.
|
protected void |
wipeEmptyTestSystemProperties()
Removes Nuxeo test system properties that are empty.
|
protected void |
wipeRuntime()
Makes sure there is no previous runtime hanging around.
|
protected static final org.apache.logging.log4j.Logger log
protected StandaloneBundleLoader bundleLoader
protected Map<String,BundleFile> bundles
protected boolean frameworkStarted
protected OSGiAdapter osgi
protected OSGiRuntimeService runtime
protected org.osgi.framework.Bundle runtimeBundle
protected TargetResourceLocator targetResourceLocator
protected List<WorkingDirectoryConfigurator> wdConfigs
protected File workingDir
protected RuntimeHarnessImpl()
public RuntimeHarnessImpl(Class<?> clazz)
protected static URL[] introspectClasspath()
public void addWorkingDirectoryConfigurator(WorkingDirectoryConfigurator config)
addWorkingDirectoryConfigurator
in interface RuntimeHarness
public void deployBundle(String name) throws Exception
RuntimeHarness
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.
deployBundle
in interface RuntimeHarness
name
- the symbolic nameException
public void deployContrib(String name, String contrib) throws Exception
RuntimeHarness
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.
deployContrib
in interface RuntimeHarness
name
- the name of the bundle to peek the contrib incontrib
- the path to contrib in the bundle.Exception
@Deprecated public void deployFolder(File folder, ClassLoader loader) throws Exception
deployFolder
in interface RuntimeHarness
Exception
public RuntimeContext deployPartial(String name, Set<TargetExtensions> targetExtensions) throws Exception
RuntimeHarness
deployPartial
in interface RuntimeHarness
name
- the name of the componenttargetExtensions
- Set of allowed TargetExtensions in the final contributionException
@Deprecated public RuntimeContext deployTestContrib(String bundle, String contrib) throws Exception
RuntimeHarness
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.
deployTestContrib
in interface RuntimeHarness
bundle
- the bundle that becomes the contribution ownercontrib
- the contribution to deploy as part of the given bundleException
@Deprecated public RuntimeContext deployTestContrib(String bundle, URL contrib) throws Exception
deployTestContrib
in interface RuntimeHarness
Exception
public void fireFrameworkStarted()
RuntimeHarness
fireFrameworkStarted
in interface RuntimeHarness
@Deprecated public List<String> getClassLoaderFiles() throws URISyntaxException
getClassLoaderFiles
in interface RuntimeHarness
URISyntaxException
public RuntimeContext getContext()
RuntimeHarness
getContext
in interface RuntimeHarness
public OSGiAdapter getOSGiAdapter()
RuntimeHarness
getOSGiAdapter
in interface RuntimeHarness
@Deprecated public Properties getProperties()
RuntimeHarness
getProperties
in interface RuntimeHarness
public File getWorkingDir()
RuntimeHarness
getWorkingDir
in interface RuntimeHarness
public boolean isRestart()
isRestart
in interface RuntimeHarness
public boolean isStarted()
isStarted
in interface RuntimeHarness
public void restart() throws Exception
restart
in interface RuntimeHarness
Exception
public void start() throws Exception
start
in interface RuntimeHarness
Exception
public void stop() throws Exception
stop
in interface RuntimeHarness
Exception
public void undeployContrib(String name, String contrib)
RuntimeHarness
The path will be relative to the bundle root. Example:
undeployContrib("org.nuxeo.ecm.core", "OSGI-INF/CoreExtensions.xml")
undeployContrib
in interface RuntimeHarness
name
- the bundlecontrib
- the contributionprotected void deployPartialComponent(RuntimeContext ctx, Set<TargetExtensions> extensionPoints, StreamRef component) throws IOException
ctx
- RuntimeContext in which the new component will be deployedextensionPoints
- Set of white listed TargetExtensionscomponent
- Reference to the original componentIOException
- Signals that an I/O exception has occurred.protected void initOsgiRuntime() throws Exception
Exception
- the exceptionprotected void initUrls()
protected Stream<URL> listBundleComponents(org.osgi.framework.Bundle bundle)
bundle
- Bundle to be readprotected BundleFile lookupBundle(String bundleName) throws Exception
bundleName
- the bundle nameException
- the exceptionprotected String readSymbolicName(BundleFile bf)
bf
- the bfprotected void wipeRuntime()
This happens for instance if a previous test had errors in its setUp()
, because
tearDown()
has not been called.
protected void wipeEmptyTestSystemProperties()
This is needed when using maven surefire > 2.17 because since SUREFIRE-649 surefire propagates empty system properties.
protected boolean isAnEmptyTestProperty(Map.Entry<Object,Object> entry)
Copyright © 2019 Nuxeo. All rights reserved.