Class RuntimeHarnessImpl

    • Constructor Detail

      • RuntimeHarnessImpl

        protected RuntimeHarnessImpl()
      • RuntimeHarnessImpl

        public RuntimeHarnessImpl​(Class<?> clazz)
    • Method Detail

      • introspectClasspath

        protected static URL[] introspectClasspath()
      • deployBundle

        public void deployBundle​(String name)
                          throws Exception
        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 interface RuntimeHarness
        Parameters:
        name - the symbolic name
        Throws:
        Exception
      • deployContrib

        public void deployContrib​(String name,
                                  String contrib)
                           throws Exception
        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 interface RuntimeHarness
        Parameters:
        name - the name of the bundle to peek the contrib in
        contrib - the path to contrib in the bundle.
        Throws:
        Exception
      • deployTestContrib

        @Deprecated
        public RuntimeContext deployTestContrib​(String bundle,
                                                String contrib)
                                         throws Exception
        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 interface RuntimeHarness
        Parameters:
        bundle - the bundle that becomes the contribution owner
        contrib - the contribution to deploy as part of the given bundle
        Throws:
        Exception
      • undeployContrib

        public void undeployContrib​(String name,
                                    String contrib)
        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 interface RuntimeHarness
        Parameters:
        name - the bundle
        contrib - 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 deployed
        extensionPoints - Set of white listed TargetExtensions
        component - Reference to the original component
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • initOsgiRuntime

        protected void initOsgiRuntime()
                                throws Exception
        Inits the osgi runtime.
        Throws:
        Exception - the exception
      • initUrls

        protected void initUrls()
        Inits the urls.
      • listBundleComponents

        protected Stream<URL> listBundleComponents​(org.osgi.framework.Bundle bundle)
        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

        protected BundleFile lookupBundle​(String bundleName)
                                   throws Exception
        Lookup bundle.
        Parameters:
        bundleName - the bundle name
        Returns:
        the bundle file
        Throws:
        Exception - the exception
      • readSymbolicName

        protected String readSymbolicName​(BundleFile bf)
        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(), because tearDown() 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.