com.silverpeas.web
Class ResourceGettingTest<T extends TestResources>
java.lang.Object
com.sun.jersey.test.framework.JerseyTest
com.silverpeas.web.RESTWebServiceTest<T>
com.silverpeas.web.ResourceGettingTest<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
- WebResourceTesting
public abstract class ResourceGettingTest<T extends TestResources>
- extends RESTWebServiceTest<T>
- implements WebResourceTesting
Unit tests on the getting of a resource in Silverpeas through a REST web service. This class is
an abstract one and it implements some tests that are redondant over all web resources in
Silverpeas (about authorization failure, authentication failure, ...)
Methods inherited from class com.silverpeas.web.RESTWebServiceTest |
addComponentInstance, addTool, aUser, authenticate, buildQueryParametersFrom, denieAuthorizationToUsers, denieSpaceAuthorizationToUsers, getAccessControllerMock, getExistingComponentInstances, getExistingTools, getMockedSpaceAccessController, getOrganizationControllerMock, getPersonalizationServiceMock, getTestResources, prepareMockedResources, resource, setComponentAccessibilityToUser |
Methods inherited from class com.sun.jersey.test.framework.JerseyTest |
client, configure, getBaseURI, getClient, getClientFactory, getPort, getTestContainerFactory, setClientFactory, setTestContainerFactory, setUp, tearDown |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResourceGettingTest
public ResourceGettingTest(String webServicePackage,
String springContext)
- See Also:
RESTWebServiceTest.RESTWebServiceTest(java.lang.String, java.lang.String)
withAsSessionKey
public static String withAsSessionKey(String sessionKey)
asMediaType
public static javax.ws.rs.core.MediaType asMediaType(javax.ws.rs.core.MediaType mediaType)
getAt
public <C> C getAt(String uri,
Class<C> c)
- Gets the web resource at the specified URI as an instance of the specified class. The state of
the resource sent back by the web resource is expected to be in JSON.
- Type Parameters:
C
- the type of the resource to return.- Parameters:
uri
- the URI identifying uniquely the resource. the uri can be compound of a query string
(starts at ?).c
- the class of which the returned resource should be an instance.
- Returns:
- the web entity representing the resource at the specified URI.
getAt
public <C> C getAt(String uri,
javax.ws.rs.core.MediaType mediaType,
Class<C> c)
- Gets the web resource at the specified URI as an instance of the specified class in the way it
is sent back by the web resource in the specified media type.
- Type Parameters:
C
- the type of the resource to return.- Parameters:
uri
- the URI identifying uniquely the resource. the uri can be compound of a query string
(starts at ?).mediaType
- the expected media type in which the returned resource state is encoded.c
- the class of which the returned resource should be an instance.
- Returns:
- the web entity representing the resource at the specified URI.
gettingAResourceByANonAuthenticatedUser
public void gettingAResourceByANonAuthenticatedUser()
gettingAResourceWithAnExpiredSession
public void gettingAResourceWithAnExpiredSession()
gettingAResourceByAnUnauthorizedUser
public void gettingAResourceByAnUnauthorizedUser()
gettingAnUnexistingResource
public void gettingAnUnexistingResource()
Copyright © 2016 Silverpeas. All Rights Reserved.