Class 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, ...)
    • Constructor Detail

      • ResourceGettingTest

        public ResourceGettingTest()
    • 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()