Package org.nuxeo.runtime.test
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 useRuntimeHarnessImpl
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 Summary
Fields Modifier and Type Field Description protected List<String[]>
deploymentStack
Deprecated.protected boolean
isTestUnit
Deprecated.Set to true when the instance of this class is a JUnit test case.protected org.jmock.Mockery
jmcontext
Deprecated.protected boolean
restart
Deprecated.-
Fields inherited from class org.nuxeo.runtime.test.RuntimeHarnessImpl
bundleLoader, bundles, frameworkStarted, osgi, readUris, runtime, runtimeBundle, targetResourceLocator, urls, wdConfigs, workingDir
-
-
Constructor Summary
Constructors Constructor Description NXRuntimeTestCase()
Deprecated.Used when subclassing to create standalone test casesNXRuntimeTestCase(Class<?> clazz)
Deprecated.Used by the features runner to manage the Nuxeo framework
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
applyInlineDeployments()
Deprecated.Should be called by subclasses after one or more inline deployments are made inside a test method.void
deployContrib(String uri)
Deprecated.Deploy a contribution specified as a "bundleName:path" uriprotected void
deployContrib(URL url)
Deprecated.static URL
getResource(String name)
Deprecated.protected OSGiRuntimeService
handleNewRuntime(OSGiRuntimeService aRuntime)
Deprecated.protected static boolean
isVersionSuffix(String s)
Deprecated.protected URL
lookupBundleUrl(String bundle)
Deprecated.Resolves an URL for bundle deployment code.void
popInlineDeployments()
Deprecated.Remove the latest deployed components usingpushInlineDeployments(String...)
.void
popInlineDeployments(int index)
Deprecated.protected void
postSetUp()
Deprecated.Called after framework was started (at the end of setUp).void
pushInlineDeployments(String... deploymentUris)
Deprecated.Hot deploy the given components (identified by an URI).protected void
removeInlineDeployments()
Deprecated.Should be called by subclasses to remove any inline deployments made in the current test method.void
restart()
Deprecated.Restarts the runtime and preserve homes directory.protected void
setUp()
Deprecated.Implementors should override this method to setup tests and not thestartRuntime()
method.void
start()
Deprecated.void
startRuntime()
Deprecated.void
stop()
Deprecated.void
stopRuntime()
Deprecated.protected void
tearDown()
Deprecated.Implementors should override this method to implement any specific test tear down and not thestopRuntime()
methodvoid
undeployContrib(String uri)
Deprecated.-
Methods inherited from class org.nuxeo.runtime.test.RuntimeHarnessImpl
addWorkingDirectoryConfigurator, deployBundle, deployContrib, deployFolder, deployPartial, deployPartialComponent, deployTestContrib, deployTestContrib, fireFrameworkStarted, getClassLoaderFiles, getContext, getOSGiAdapter, getProperties, getWorkingDir, initOsgiRuntime, initUrls, introspectClasspath, isAnEmptyTestProperty, isRestart, isStarted, listBundleComponents, lookupBundle, readSymbolicName, undeployContrib, wipeEmptyTestSystemProperties, wipeRuntime
-
-
-
-
Field Detail
-
jmcontext
protected org.jmock.Mockery jmcontext
Deprecated.
-
restart
protected boolean restart
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 Detail
-
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 Detail
-
restart
public void restart() throws Exception
Deprecated.Restarts the runtime and preserve homes directory.- Specified by:
restart
in interfaceRuntimeHarness
- Overrides:
restart
in classRuntimeHarnessImpl
- Throws:
Exception
-
start
public void start() throws Exception
Deprecated.- Specified by:
start
in interfaceRuntimeHarness
- Overrides:
start
in classRuntimeHarnessImpl
- Throws:
Exception
-
setUp
protected void setUp() throws Exception
Deprecated.Implementors should override this method to setup tests and not thestartRuntime()
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 thepostSetUp()
method- Throws:
Exception
-
tearDown
protected void tearDown() throws Exception
Deprecated.Implementors should override this method to implement any specific test tear down and not thestopRuntime()
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
-
stop
public void stop() throws Exception
Deprecated.- Specified by:
stop
in interfaceRuntimeHarness
- Overrides:
stop
in classRuntimeHarnessImpl
- Throws:
Exception
-
handleNewRuntime
protected OSGiRuntimeService handleNewRuntime(OSGiRuntimeService aRuntime)
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 callingpopInlineDeployments()
A component URI is of the form: bundleSymbolicName:pathToComponentXmlInBundle
- Throws:
Exception
-
popInlineDeployments
public void popInlineDeployments() throws Exception
Deprecated.Remove the latest deployed components usingpushInlineDeployments(String...)
.- Throws:
Exception
-
-