Nuxeo Enterprise Platform 5.1

org.nuxeo.runtime.test
Class NXRuntimeTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.jmock.core.VerifyingTestCase
              extended by org.jmock.core.MockObjectSupportTestCase
                  extended by org.jmock.MockObjectTestCase
                      extended by org.nuxeo.runtime.test.NXRuntimeTestCase
All Implemented Interfaces:
Test
Direct Known Subclasses:
RepositoryOSGITestCase, RepositoryTestCase, SearchEngineBackendTestCase

public abstract class NXRuntimeTestCase
extends org.jmock.MockObjectTestCase

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.

Author:
Bogdan Stefanescu

Field Summary
protected  RuntimeService runtime
           
protected  URL[] urls
           
 
Fields inherited from class org.jmock.core.MockObjectSupportTestCase
ANYTHING, NOT_NULL, NULL
 
Constructor Summary
protected NXRuntimeTestCase()
           
protected NXRuntimeTestCase(String name)
           
 
Method Summary
 void deploy(String contrib)
          Deprecated. use deployContrib() instead
 void deployBundle(String bundle)
          Deploy a whole OSGI bundle.
protected  void deployContrib(BundleFile bundleFile, String contrib)
           
 void deployContrib(String contrib)
          Deploys a contribution file by looking for it in the class loader.
 void deployContrib(String bundle, String contrib)
          Deploys a contribution from a given bundle.
protected  void deployContrib(URL url)
           
static URL getResource(String resource)
           
protected  void initOsgiRuntime()
           
protected  void initTestRuntime()
           
protected  void initUrls()
           
protected static boolean isVersionSuffix(String s)
           
protected  BundleFile lookupBundle(String bundle)
           
protected  URL lookupBundleUrl(String bundle)
          Resolves an URL for bundle deployment code.
protected  void setUp()
           
protected  void tearDown()
           
 void undeploy(String contrib)
          Deprecated. use undeployContrib() instead
 void undeployContrib(String contrib)
           
protected  void wipeRuntime()
          Makes sure there is no previous runtime hanging around.
 
Methods inherited from class org.jmock.MockObjectTestCase
atLeastOnce, defaultMockNameForType, mock, mock, never, newCoreMock, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, throwException
 
Methods inherited from class org.jmock.core.MockObjectSupportTestCase
and, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, isA, newDummy, newDummy, newDummy, not, or, same, stringContains
 
Methods inherited from class org.jmock.core.VerifyingTestCase
registerToVerify, runBare, unregisterToVerify, verify
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

runtime

protected RuntimeService runtime

urls

protected URL[] urls
Constructor Detail

NXRuntimeTestCase

protected NXRuntimeTestCase()

NXRuntimeTestCase

protected NXRuntimeTestCase(String name)
Method Detail

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class TestCase
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class TestCase
Throws:
Exception

initOsgiRuntime

protected void initOsgiRuntime()
                        throws Exception
Throws:
Exception

initTestRuntime

protected void initTestRuntime()
                        throws Exception
Throws:
Exception

initUrls

protected void initUrls()

wipeRuntime

protected void wipeRuntime()
                    throws Exception
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

Throws:
Exception

getResource

public static URL getResource(String resource)

deploy

@Deprecated
public void deploy(String contrib)
Deprecated. use deployContrib() instead


deployContrib

protected void deployContrib(URL url)

deployContrib

public void deployContrib(String contrib)
Deploys a contribution file by looking for it in the class loader.

Parameters:
contrib - the relative path to the contribution file

deployContrib

protected void deployContrib(BundleFile bundleFile,
                             String contrib)

deployContrib

public void deployContrib(String bundle,
                          String contrib)
                   throws Exception
Deploys a contribution from a given bundle.

The path will be relative to the bundle root. Example: deployContrib("nuxeo-core", "OSGI-INF/CoreExtensions.xml")

Parameters:
bundle - The name of the bundle to peek the contrib in
contrib - The path to contrib in the bundle.
Throws:
Exception

undeploy

@Deprecated
public void undeploy(String contrib)
Deprecated. use undeployContrib() instead


undeployContrib

public void undeployContrib(String contrib)

isVersionSuffix

protected static boolean isVersionSuffix(String s)

lookupBundleUrl

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

TODO: Implementation could be finer...

Returns:
the resolved url

deployBundle

public void deployBundle(String bundle)
                  throws Exception
Deploy a whole OSGI bundle.

Parameters:
bundle - the name of the bundle.
Throws:
Exception

lookupBundle

protected BundleFile lookupBundle(String bundle)
                           throws Exception
Throws:
Exception

Nuxeo Enterprise Platform 5.1

Copyright ? 2007 Nuxeo SAS. All Rights Reserved.