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 useRuntimeHarnessImplAbstract base class for test cases that require a test runtime service.The runtime service itself is conveniently available as the
runtimeinstance 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[]>deploymentStackDeprecated.protected booleanisTestUnitDeprecated.Set to true when the instance of this class is a JUnit test case.protected org.jmock.MockeryjmcontextDeprecated.protected booleanrestartDeprecated.-
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 voidapplyInlineDeployments()Deprecated.Should be called by subclasses after one or more inline deployments are made inside a test method.voiddeployContrib(String uri)Deprecated.Deploy a contribution specified as a "bundleName:path" uriprotected voiddeployContrib(URL url)Deprecated.static URLgetResource(String name)Deprecated.protected OSGiRuntimeServicehandleNewRuntime(OSGiRuntimeService aRuntime)Deprecated.protected static booleanisVersionSuffix(String s)Deprecated.protected URLlookupBundleUrl(String bundle)Deprecated.Resolves an URL for bundle deployment code.voidpopInlineDeployments()Deprecated.Remove the latest deployed components usingpushInlineDeployments(String...).voidpopInlineDeployments(int index)Deprecated.protected voidpostSetUp()Deprecated.Called after framework was started (at the end of setUp).voidpushInlineDeployments(String... deploymentUris)Deprecated.Hot deploy the given components (identified by an URI).protected voidremoveInlineDeployments()Deprecated.Should be called by subclasses to remove any inline deployments made in the current test method.voidrestart()Deprecated.Restarts the runtime and preserve homes directory.protected voidsetUp()Deprecated.Implementors should override this method to setup tests and not thestartRuntime()method.voidstart()Deprecated.voidstartRuntime()Deprecated.voidstop()Deprecated.voidstopRuntime()Deprecated.protected voidtearDown()Deprecated.Implementors should override this method to implement any specific test tear down and not thestopRuntime()methodvoidundeployContrib(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 ExceptionDeprecated.Restarts the runtime and preserve homes directory.- Specified by:
restartin interfaceRuntimeHarness- Overrides:
restartin classRuntimeHarnessImpl- Throws:
Exception
-
start
public void start() throws ExceptionDeprecated.- Specified by:
startin interfaceRuntimeHarness- Overrides:
startin classRuntimeHarnessImpl- Throws:
Exception
-
setUp
protected void setUp() throws ExceptionDeprecated.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 ExceptionDeprecated.Implementors should override this method to implement any specific test tear down and not thestopRuntime()method- Throws:
Exception
-
postSetUp
protected void postSetUp() throws ExceptionDeprecated.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 ExceptionDeprecated.- Specified by:
stopin interfaceRuntimeHarness- Overrides:
stopin 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 ExceptionDeprecated.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 ExceptionDeprecated.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 ExceptionDeprecated.Remove the latest deployed components usingpushInlineDeployments(String...).- Throws:
Exception
-
-