Package org.silverpeas.web.test
Class ResourceGettingTest
- java.lang.Object
-
- org.silverpeas.web.test.RESTWebServiceTest
-
- org.silverpeas.web.test.ResourceGettingTest
-
- All Implemented Interfaces:
WebResourceTesting
public abstract class ResourceGettingTest extends RESTWebServiceTest 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, ...)
-
-
Field Summary
-
Fields inherited from class org.silverpeas.web.test.RESTWebServiceTest
dbSetupRule
-
-
Constructor Summary
Constructors Constructor Description ResourceGettingTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static javax.ws.rs.core.MediaType
asMediaType(javax.ws.rs.core.MediaType mediaType)
<C> C
getAt(String uri, Class<C> c)
Gets the web resource at the specified URI as an instance of the specified class.<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.<C> C
getAt(String uri, AuthId authId, Class<C> c)
Gets the web resource at the specified URI with the given authentication identification as an instance of the specified class.void
gettingAnUnexistingResource()
void
gettingAResourceByANonAuthenticatedUser()
void
gettingAResourceByAnUnauthorizedUser()
void
gettingAResourceWithAnExpiredSession()
-
Methods inherited from class org.silverpeas.web.test.RESTWebServiceTest
applyQueryParameters, authenticate, denyAuthorizationToUsers, denySpaceAuthorizationToUsers, getBaseURI, getDataSetScript, getExistingComponentInstances, getExistingTools, getSilverpeasEnvironmentTest, getTableCreationScript, getTokenKeyOf, getWebResourceBaseURIBuilder, reloadAdminCaches, resource, setUpHTTPRequest, setUserIdent, withAsAuthId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.web.test.WebResourceTesting
anUnexistingResourceURI, aResource, aResourceURI, getAPITokenValue, getWebEntityClass
-
-
-
-
Method Detail
-
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, AuthId authId, Class<C> c)
Gets the web resource at the specified URI with the given authentication identification 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 ?).authId
- the authentication identification to use to identify the user behind the request.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()
-
-