Class NXRuntimeTestCase

java.lang.Object
org.nuxeo.runtime.test.RuntimeHarnessImpl
org.nuxeo.runtime.test.NXRuntimeTestCase
All Implemented Interfaces:
RuntimeHarness

@Deprecated public class NXRuntimeTestCase extends RuntimeHarnessImpl
Deprecated.
since 10.2 this class must not be subclassed anymore, for RuntimeHarness implementation use RuntimeHarnessImpl
Abstract base class for test cases that require a test runtime service.

The runtime service itself is conveniently available as the runtime instance variable in derived classes.

Warning: NXRuntimeTestCase subclasses must

  • not declare they own @Before and @After.
  • override doSetUp and doTearDown (and postSetUp if needed) instead of setUp and tearDown.
  • never call deployXXX methods outside the doSetUp method.
Author:
Bogdan Stefanescu
  • Field Details

    • jmcontext

      protected org.jmock.Mockery jmcontext
      Deprecated.
    • restart

      protected boolean restart
      Deprecated.
    • deploymentStack

      protected List<String[]> deploymentStack
      Deprecated.
    • isTestUnit

      protected final boolean isTestUnit
      Deprecated.
      Set to true when the instance of this class is a JUnit test case. Set to false when the instance of this class is instantiated by the FeaturesRunner to manage the framework If the class is a JUnit test case then the runtime components will be started at the end of the setUp method
  • Constructor Details

    • NXRuntimeTestCase

      public NXRuntimeTestCase()
      Deprecated.
      Used when subclassing to create standalone test cases
    • NXRuntimeTestCase

      public NXRuntimeTestCase(Class<?> clazz)
      Deprecated.
      Used by the features runner to manage the Nuxeo framework
  • Method Details

    • restart

      public void restart() throws Exception
      Deprecated.
      Restarts the runtime and preserve homes directory.
      Specified by:
      restart in interface RuntimeHarness
      Overrides:
      restart in class RuntimeHarnessImpl
      Throws:
      Exception
    • start

      public void start() throws Exception
      Deprecated.
      Specified by:
      start in interface RuntimeHarness
      Overrides:
      start in class RuntimeHarnessImpl
      Throws:
      Exception
    • startRuntime

      public void startRuntime() throws Exception
      Deprecated.
      Throws:
      Exception
    • setUp

      protected void setUp() throws Exception
      Deprecated.
      Implementors should override this method to setup tests and not the startRuntime() method. This method should contain all the bundle or component deployments needed by the tests. At the time this method is called the components are not yet started. If you need to perform component/service lookups use instead the postSetUp() method
      Throws:
      Exception
    • tearDown

      protected void tearDown() throws Exception
      Deprecated.
      Implementors should override this method to implement any specific test tear down and not the stopRuntime() method
      Throws:
      Exception
    • postSetUp

      protected void postSetUp() throws Exception
      Deprecated.
      Called after framework was started (at the end of setUp). Implementors may use this to use deployed services to initialize fields etc.
      Throws:
      Exception
    • stopRuntime

      public void stopRuntime() throws Exception
      Deprecated.
      Throws:
      Exception
    • stop

      public void stop() throws Exception
      Deprecated.
      Specified by:
      stop in interface RuntimeHarness
      Overrides:
      stop in class RuntimeHarnessImpl
      Throws:
      Exception
    • handleNewRuntime

      protected OSGiRuntimeService handleNewRuntime(OSGiRuntimeService aRuntime)
      Deprecated.
    • getResource

      public static URL getResource(String name)
      Deprecated.
    • deployContrib

      protected void deployContrib(URL url)
      Deprecated.
    • deployContrib

      public void deployContrib(String uri) throws Exception
      Deprecated.
      Deploy a contribution specified as a "bundleName:path" uri
      Throws:
      Exception
    • undeployContrib

      public void undeployContrib(String uri) throws Exception
      Deprecated.
      Throws:
      Exception
    • isVersionSuffix

      protected static boolean isVersionSuffix(String s)
      Deprecated.
    • lookupBundleUrl

      protected URL lookupBundleUrl(String bundle)
      Deprecated.
      Resolves an URL for bundle deployment code.

      TODO: Implementation could be finer...

      Returns:
      the resolved url
    • applyInlineDeployments

      protected void applyInlineDeployments() throws Exception
      Deprecated.
      Should be called by subclasses after one or more inline deployments are made inside a test method. Without calling this the inline deployment(s) will not have any effects.

      Be Warned that if you reference runtime services or components you should lookup them again after calling this method!

      This method also calls postSetUp() for convenience.

      Throws:
      Exception
    • removeInlineDeployments

      protected void removeInlineDeployments() throws Exception
      Deprecated.
      Should be called by subclasses to remove any inline deployments made in the current test method.

      Be Warned that if you reference runtime services or components you should lookup them again after calling this method!

      This method also calls postSetUp() for convenience.

      Throws:
      Exception
    • pushInlineDeployments

      public void pushInlineDeployments(String... deploymentUris) throws Exception
      Deprecated.
      Hot deploy the given components (identified by an URI). All the started components are stopped, the new ones are registered and then all components are started. You can undeploy these components by calling popInlineDeployments()

      A component URI is of the form: bundleSymbolicName:pathToComponentXmlInBundle

      Throws:
      Exception
    • popInlineDeployments

      public void popInlineDeployments() throws Exception
      Deprecated.
      Remove the latest deployed components using pushInlineDeployments(String...).
      Throws:
      Exception
    • popInlineDeployments

      public void popInlineDeployments(int index) throws Exception
      Deprecated.
      Throws:
      Exception