Package org.silverpeas.web.test
Class ResourceCreationTest
- java.lang.Object
-
- org.silverpeas.web.test.RESTWebServiceTest
-
- org.silverpeas.web.test.ResourceCreationTest
-
- All Implemented Interfaces:
WebResourceTesting
public abstract class ResourceCreationTest extends RESTWebServiceTest implements WebResourceTesting
Unit tests on the creation of a new 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 ResourceCreationTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
at(String uri)
A convenient method to improve the readability of the method calls.void
creationOfANewResourceByANonAuthenticatedUser()
void
creationOfANewResourceByANonAuthorizedUser()
void
creationOfANewResourceWithADeprecatedSession()
<C> javax.ws.rs.core.Response
post(C entity, String atURI)
Posts the specified web entity at the specified URI.<C> javax.ws.rs.core.Response
post(C entity, String atURI, AuthId authId)
Posts the specified web entity at the specified URI and with the given authentication identification.void
postAnInvalidResourceState()
-
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
-
at
public static String at(String uri)
A convenient method to improve the readability of the method calls.- Parameters:
uri
- a resource URI.- Returns:
- the specified resource URI.
-
post
public <C> javax.ws.rs.core.Response post(C entity, String atURI)
Posts the specified web entity at the specified URI.- Type Parameters:
C
- the type of the web entity to post.- Parameters:
entity
- the web entity to post.atURI
- the URI at which the entity has to be posted.- Returns:
- the response of the post.
-
post
public <C> javax.ws.rs.core.Response post(C entity, String atURI, AuthId authId)
Posts the specified web entity at the specified URI and with the given authentication identification.- Type Parameters:
C
- the type of the web entity to post.- Parameters:
entity
- the web entity to post.atURI
- the URI at which the entity has to be posted.authId
- the authentication identification to use to identify the user behind the request.- Returns:
- the response of the post.
-
creationOfANewResourceByANonAuthenticatedUser
public void creationOfANewResourceByANonAuthenticatedUser()
-
creationOfANewResourceWithADeprecatedSession
public void creationOfANewResourceWithADeprecatedSession()
-
creationOfANewResourceByANonAuthorizedUser
public void creationOfANewResourceByANonAuthorizedUser()
-
postAnInvalidResourceState
public void postAnInvalidResourceState()
-
-