Nuxeo Enterprise Platform 5.4

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:
junit.framework.Test, RuntimeHarness
Direct Known Subclasses:
QueryTestCase, SearchEngineBackendTestCase, SQLRepositoryTestCase

public class NXRuntimeTestCase
extends org.jmock.MockObjectTestCase
implements RuntimeHarness

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
 
Fields inherited from class org.jmock.core.MockObjectSupportTestCase
ANYTHING, NOT_NULL, NULL
 
Constructor Summary
NXRuntimeTestCase()
           
NXRuntimeTestCase(java.lang.String name)
           
 
Method Summary
 void addWorkingDirectoryConfigurator(WorkingDirectoryConfigurator config)
           
 void deploy(java.lang.String contrib)
          Deprecated. use deployContrib() instead
 void deployBundle(java.lang.String bundle)
          Deploys a whole OSGI bundle.
 void deployContrib(java.lang.String contrib)
          Deprecated. use the less ambiguous deployContrib(BundleFile,String)
 void deployContrib(java.lang.String bundle, java.lang.String contrib)
          Deploys a contribution from a given bundle.
 void deployFolder(java.io.File folder, java.lang.ClassLoader loader)
           
 RuntimeContext deployTestContrib(java.lang.String bundle, java.lang.String contrib)
          Deploy an XML contribution from outside a bundle.
 RuntimeContext deployTestContrib(java.lang.String bundle, java.net.URL contrib)
           
 void fireFrameworkStarted()
          Fire the event FrameworkEvent.STARTED.
static java.net.URL getResource(java.lang.String resource)
           
 java.io.File getWorkingDir()
          Gets the framework working directory.
 boolean isStarted()
           
 void setUp()
           
 void start()
           
 void stop()
           
 void tearDown()
           
 void undeploy(java.lang.String contrib)
          Deprecated. use undeployContrib(String, String) instead
 void undeployContrib(java.lang.String contrib)
          Deprecated. use undeployContrib(String, String) instead
 void undeployContrib(java.lang.String bundle, java.lang.String contrib)
          Undeploys a contribution from a given bundle.
 
Methods inherited from class org.jmock.MockObjectTestCase
atLeastOnce, atMostOnce, defaultMockNameForType, doAll, doAll, doAll, doAll, exactly, mock, mock, never, never, newDummy, newDummy, newDummy, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, returnIterator, returnIterator, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, throwException
 
Methods inherited from class org.jmock.core.MockObjectSupportTestCase
and, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, collectionContaining, collectionContaining, compatibleType, contains, endsWith, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, hasProperty, hasProperty, isA, isIn, isIn, mapContaining, mapContaining, mapWithKey, mapWithKey, mapWithValue, mapWithValue, not, or, same, startsWith, stringContains, toString
 
Methods inherited from class org.jmock.core.VerifyingTestCase
registerToVerify, runBare, unregisterToVerify, verify
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, 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, format
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NXRuntimeTestCase

public NXRuntimeTestCase()

NXRuntimeTestCase

public NXRuntimeTestCase(java.lang.String name)
Method Detail

addWorkingDirectoryConfigurator

public void addWorkingDirectoryConfigurator(WorkingDirectoryConfigurator config)
Specified by:
addWorkingDirectoryConfigurator in interface RuntimeHarness

getWorkingDir

public java.io.File getWorkingDir()
Description copied from interface: RuntimeHarness
Gets the framework working directory.

Specified by:
getWorkingDir in interface RuntimeHarness

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface RuntimeHarness
Throws:
java.lang.Exception

setUp

public void setUp()
           throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

fireFrameworkStarted

public void fireFrameworkStarted()
                          throws java.lang.Exception
Fire the event FrameworkEvent.STARTED.

Specified by:
fireFrameworkStarted in interface RuntimeHarness
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface RuntimeHarness
Throws:
java.lang.Exception

isStarted

public boolean isStarted()
Specified by:
isStarted in interface RuntimeHarness

getResource

public static java.net.URL getResource(java.lang.String resource)

deploy

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

Specified by:
deploy in interface RuntimeHarness

deployContrib

@Deprecated
public void deployContrib(java.lang.String contrib)
Deprecated. use the less ambiguous deployContrib(BundleFile,String)

Deploys a contribution file by looking for it in the class loader.

The first contribution file found by the class loader will be used. You have no guarantee in case of name collisions.

Specified by:
deployContrib in interface RuntimeHarness
Parameters:
contrib - the relative path to the contribution file

deployContrib

public void deployContrib(java.lang.String bundle,
                          java.lang.String contrib)
                   throws java.lang.Exception
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:
bundle - the name of the bundle to peek the contrib in
contrib - the path to contrib in the bundle.
Throws:
java.lang.Exception

deployTestContrib

public RuntimeContext deployTestContrib(java.lang.String bundle,
                                        java.lang.String contrib)
                                 throws java.lang.Exception
Deploy 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:
java.lang.Exception

deployTestContrib

public RuntimeContext deployTestContrib(java.lang.String bundle,
                                        java.net.URL contrib)
                                 throws java.lang.Exception
Specified by:
deployTestContrib in interface RuntimeHarness
Throws:
java.lang.Exception

undeploy

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

Specified by:
undeploy in interface RuntimeHarness

undeployContrib

@Deprecated
public void undeployContrib(java.lang.String contrib)
Deprecated. use undeployContrib(String, String) instead

Specified by:
undeployContrib in interface RuntimeHarness

undeployContrib

public void undeployContrib(java.lang.String bundle,
                            java.lang.String contrib)
                     throws java.lang.Exception
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:
bundle - the bundle
contrib - the contribution
Throws:
java.lang.Exception

deployBundle

public void deployBundle(java.lang.String bundle)
                  throws java.lang.Exception
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:
bundle - the symbolic name
Throws:
java.lang.Exception

deployFolder

public void deployFolder(java.io.File folder,
                         java.lang.ClassLoader loader)
                  throws java.lang.Exception
Specified by:
deployFolder in interface RuntimeHarness
Throws:
java.lang.Exception

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.