Package org.exoplatform.commons.testing
Class BaseResourceTestCase
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.exoplatform.component.test.BaseGateInTest
-
- org.exoplatform.component.test.AbstractGateInTest
-
- org.exoplatform.component.test.AbstractKernelTest
-
- org.exoplatform.commons.testing.BaseExoTestCase
-
- org.exoplatform.commons.testing.BaseResourceTestCase
-
- All Implemented Interfaces:
junit.framework.Test
public abstract class BaseResourceTestCase extends BaseExoTestCase
Created by The eXo Platform SAS Author : eXoPlatform exo@exoplatform.com Apr 23, 2014
-
-
Field Summary
Fields Modifier and Type Field Description protected org.exoplatform.container.configuration.ConfigurationManagerconfigurationManagerprotected org.exoplatform.container.PortalContainercontainerprotected static org.exoplatform.services.log.Loglogprotected org.exoplatform.services.rest.impl.ProviderBinderproviderBinderprotected org.exoplatform.services.rest.impl.RequestHandlerImplrequestHandlerprotected org.exoplatform.services.rest.impl.ResourceBinderresourceBinder-
Fields inherited from class org.exoplatform.commons.testing.BaseExoTestCase
ownBootstrap
-
-
Constructor Summary
Constructors Constructor Description BaseResourceTestCase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResource(Class<?> resourceClass, javax.ws.rs.core.MultivaluedMap<String,String> properties)Register supplied class as per-request root resource if it has valid JAX-RS annotations and no one resource with the same UriPattern already registered.voidaddResource(Object resource, javax.ws.rs.core.MultivaluedMap<String,String> properties)Register supplied Object as singleton root resource if it has valid JAX-RS annotations and no one resource with the same UriPattern already registered.protected <T> TgetService(Class<T> clazz)voidremoveResource(Class clazz)Remove the resource instance of provided class from root resource container.org.exoplatform.services.rest.impl.ContainerResponseservice(String method, String requestURI, String baseURI, Map<String,List<String>> headers, byte[] data, org.exoplatform.services.rest.ContainerResponseWriter writer)Get response with provided writerorg.exoplatform.services.rest.impl.ContainerResponseservice(String method, String requestURI, String baseURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, byte[] data)Get response without provided writervoidsetUp()voidtearDown()-
Methods inherited from class org.exoplatform.commons.testing.BaseExoTestCase
afterRunBare, beforeRunBare, getContainer
-
Methods inherited from class org.exoplatform.component.test.AbstractKernelTest
afterClass, beforeClass, begin, end, isForceContainerReload, restartTransaction, setForceContainerReload
-
Methods inherited from class org.exoplatform.component.test.BaseGateInTest
assertInstanceOf, fail, fail, failure, failure
-
Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toString
-
-
-
-
Field Detail
-
log
protected static org.exoplatform.services.log.Log log
-
providerBinder
protected org.exoplatform.services.rest.impl.ProviderBinder providerBinder
-
resourceBinder
protected org.exoplatform.services.rest.impl.ResourceBinder resourceBinder
-
requestHandler
protected org.exoplatform.services.rest.impl.RequestHandlerImpl requestHandler
-
container
protected org.exoplatform.container.PortalContainer container
-
configurationManager
protected org.exoplatform.container.configuration.ConfigurationManager configurationManager
-
-
Method Detail
-
setUp
public void setUp() throws Exception- Overrides:
setUpin classjunit.framework.TestCase- Throws:
Exception
-
tearDown
public void tearDown() throws Exception- Overrides:
tearDownin classjunit.framework.TestCase- Throws:
Exception
-
service
public org.exoplatform.services.rest.impl.ContainerResponse service(String method, String requestURI, String baseURI, Map<String,List<String>> headers, byte[] data, org.exoplatform.services.rest.ContainerResponseWriter writer) throws Exception
Get response with provided writer- Parameters:
method-requestURI-baseURI-headers-data-writer-- Returns:
- Throws:
Exception
-
service
public org.exoplatform.services.rest.impl.ContainerResponse service(String method, String requestURI, String baseURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, byte[] data) throws Exception
Get response without provided writer- Parameters:
method-requestURI-baseURI-headers-data-- Returns:
- Throws:
Exception
-
addResource
public void addResource(Class<?> resourceClass, javax.ws.rs.core.MultivaluedMap<String,String> properties)
Register supplied class as per-request root resource if it has valid JAX-RS annotations and no one resource with the same UriPattern already registered.- Parameters:
resourceClass- class of candidate to be root resourceproperties- optional resource properties. It may contains additional info about resource, e.g. description of resource, its responsibility, etc. This info can be retrievedObjectModel.getProperties(). This parameter may benull
-
addResource
public void addResource(Object resource, javax.ws.rs.core.MultivaluedMap<String,String> properties)
Register supplied Object as singleton root resource if it has valid JAX-RS annotations and no one resource with the same UriPattern already registered.- Parameters:
resource- candidate to be root resourceproperties- optional resource properties. It may contains additional info about resource, e.g. description of resource, its responsibility, etc. This info can be retrievedObjectModel.getProperties(). This parameter may benull
-
removeResource
public void removeResource(Class clazz)
Remove the resource instance of provided class from root resource container.- Parameters:
clazz- the class of resource
-
getService
protected <T> T getService(Class<T> clazz)
-
-