Modifier and Type | Class and Description |
---|---|
static class |
TestUtils.RestTestUtils.ResourceAPI |
Modifier and Type | Field and Description |
---|---|
static Boolean |
ELEMENTS_ENCODED |
static Map<org.xwiki.model.EntityType,TestUtils.RestTestUtils.ResourceAPI> |
RESOURCES_MAP |
static String |
urlPrefix |
Constructor and Description |
---|
RestTestUtils(TestUtils testUtils) |
Modifier and Type | Method and Description |
---|---|
void |
add(org.xwiki.rest.model.jaxb.Object obj)
Add a new object.
|
org.apache.commons.httpclient.methods.EntityEnclosingMethod |
add(org.xwiki.rest.model.jaxb.Object obj,
boolean release)
Add a new object.
|
void |
attachFile(org.xwiki.model.reference.EntityReference reference,
Object is,
boolean failIfExists) |
URI |
createUri(Object resourceUri,
Map<String,Object[]> queryParams,
Object... elements) |
void |
delete(org.xwiki.model.reference.EntityReference reference) |
void |
deleteAttachement(org.xwiki.model.reference.EntityReference reference) |
void |
deletePage(String space,
String page) |
void |
deletePage(String space,
String page,
Locale locale) |
org.apache.commons.httpclient.methods.DeleteMethod |
executeDelete(Object resourceUri,
Map<String,Object[]> queryParams,
Object... elements) |
org.apache.commons.httpclient.methods.DeleteMethod |
executeDelete(Object resourceUri,
Object... elements) |
org.apache.commons.httpclient.methods.GetMethod |
executeGet(org.xwiki.model.reference.EntityReference reference) |
org.apache.commons.httpclient.methods.GetMethod |
executeGet(Object resourceURI,
org.xwiki.model.reference.EntityReference reference) |
org.apache.commons.httpclient.methods.GetMethod |
executeGet(Object resourceUri,
Map<String,Object[]> queryParams,
Object... elements) |
org.apache.commons.httpclient.methods.GetMethod |
executeGet(Object resourceUri,
Object... elements) |
org.apache.commons.httpclient.methods.PostMethod |
executePost(Object resourceUri,
Object restObject,
Map<String,Object[]> queryParams,
Object... elements) |
org.apache.commons.httpclient.methods.PostMethod |
executePost(Object resourceUri,
Object restObject,
Object... elements) |
org.apache.commons.httpclient.methods.PutMethod |
executePut(Object resourceUri,
Object restObject,
Map<String,Object[]> queryParams,
Object... elements) |
org.apache.commons.httpclient.methods.PutMethod |
executePut(Object resourceUri,
Object restObject,
Object... elements) |
boolean |
exists(org.xwiki.model.reference.EntityReference reference) |
<T> T |
get(org.xwiki.model.reference.EntityReference reference)
Return object model of the passed reference.
|
<T> T |
get(org.xwiki.model.reference.EntityReference reference,
boolean failIfNotFound)
Return object model of the passed reference or null if none could be found.
|
<T> T |
get(Object resourceURI,
boolean failIfNotFound) |
<T> T |
get(Object resourceURI,
org.xwiki.model.reference.EntityReference reference)
Return object model of the passed reference with the passed resource URI.
|
<T> T |
get(Object resourceURI,
org.xwiki.model.reference.EntityReference reference,
boolean failIfNotFound)
Return object model of the passed reference with the passed resource URI or null if none could be found.
|
String |
getBaseURL() |
byte[] |
getBuffer(String resourceUri,
Map<String,Object[]> queryParams,
Object... elements) |
InputStream |
getInputStream(String resourceUri,
Map<String,?> queryParams,
Object... elements) |
static org.xwiki.rest.model.jaxb.Property |
getProperty(String name,
org.xwiki.rest.model.jaxb.Object preferencesObject,
boolean create) |
<T> T |
getResource(String resourceUri,
Map<String,Object[]> queryParams,
Object... elements) |
Class<?> |
getResourceAPI(org.xwiki.model.reference.EntityReference reference) |
protected javax.ws.rs.core.UriBuilder |
getUriBuilder(Class<?> resource) |
javax.ws.rs.core.UriBuilder |
getUriBuilder(Object resourceUri,
Map<String,Object[]> queryParams) |
org.xwiki.rest.model.jaxb.Object |
object(org.xwiki.model.reference.EntityReference parentReference,
String className) |
org.xwiki.rest.model.jaxb.Object |
object(org.xwiki.model.reference.EntityReference parentReference,
String className,
int number) |
static org.xwiki.rest.model.jaxb.Object |
object(String className) |
org.xwiki.rest.model.jaxb.Page |
page(org.xwiki.model.reference.EntityReference reference) |
InputStream |
postInputStream(Object resourceUri,
Object restObject,
Map<String,Object[]> queryParams,
Object... elements) |
InputStream |
postRESTInputStream(Object resourceUri,
Object restObject,
Object... elements) |
static org.xwiki.rest.model.jaxb.Property |
property(String name,
Object value) |
org.apache.commons.httpclient.methods.EntityEnclosingMethod |
save(org.xwiki.rest.model.jaxb.Page page,
boolean release,
int... expectedCodes) |
void |
save(org.xwiki.rest.model.jaxb.Page page,
int... expectedCodes)
Add or update.
|
void |
savePage(org.xwiki.model.reference.EntityReference reference) |
void |
savePage(org.xwiki.model.reference.EntityReference reference,
String content,
String title) |
void |
savePage(org.xwiki.model.reference.EntityReference reference,
String content,
String syntaxId,
String title,
String parentFullPageName) |
void |
setURLPrefix(String newURLPrefix)
Used when running in a docker container for example and thus when we need a REST URL pointing to a host
different than the TestUTils baseURL which is used inside the Selenium docker container and is thus
different from a REST URL used outside of any container and that needs to call XWiki running inside a
container...
|
Object[] |
toElements(org.xwiki.model.reference.EntityReference reference) |
Object[] |
toElements(org.xwiki.rest.model.jaxb.Object obj,
boolean onlyDocument) |
protected Object[] |
toElements(org.xwiki.rest.model.jaxb.Page page) |
static String |
toPropertyString(Object value) |
<T> T |
toResource(InputStream is) |
protected InputStream |
toResourceInputStream(Object restObject) |
void |
update(org.xwiki.rest.model.jaxb.Object obj)
Fail if the object does not exist.
|
org.apache.commons.httpclient.methods.EntityEnclosingMethod |
update(org.xwiki.rest.model.jaxb.Object obj,
boolean release)
Fail if the object does not exist.
|
public static final Boolean ELEMENTS_ENCODED
public static final Map<org.xwiki.model.EntityType,TestUtils.RestTestUtils.ResourceAPI> RESOURCES_MAP
public static String urlPrefix
public RestTestUtils(TestUtils testUtils)
public static org.xwiki.rest.model.jaxb.Object object(String className)
public static org.xwiki.rest.model.jaxb.Property property(String name, Object value)
public String getBaseURL()
public void setURLPrefix(String newURLPrefix)
protected Object[] toElements(org.xwiki.rest.model.jaxb.Page page)
public Object[] toElements(org.xwiki.rest.model.jaxb.Object obj, boolean onlyDocument)
public Object[] toElements(org.xwiki.model.reference.EntityReference reference)
public void save(org.xwiki.rest.model.jaxb.Page page, int... expectedCodes) throws Exception
Exception
public org.apache.commons.httpclient.methods.EntityEnclosingMethod save(org.xwiki.rest.model.jaxb.Page page, boolean release, int... expectedCodes) throws Exception
Exception
public org.xwiki.rest.model.jaxb.Page page(org.xwiki.model.reference.EntityReference reference)
public org.xwiki.rest.model.jaxb.Object object(org.xwiki.model.reference.EntityReference parentReference, String className)
public org.xwiki.rest.model.jaxb.Object object(org.xwiki.model.reference.EntityReference parentReference, String className, int number)
public void savePage(org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public void savePage(org.xwiki.model.reference.EntityReference reference, String content, String title) throws Exception
Exception
public void savePage(org.xwiki.model.reference.EntityReference reference, String content, String syntaxId, String title, String parentFullPageName) throws Exception
Exception
public void add(org.xwiki.rest.model.jaxb.Object obj) throws Exception
Exception
public org.apache.commons.httpclient.methods.EntityEnclosingMethod add(org.xwiki.rest.model.jaxb.Object obj, boolean release) throws Exception
Exception
public void update(org.xwiki.rest.model.jaxb.Object obj) throws Exception
Exception
public org.apache.commons.httpclient.methods.EntityEnclosingMethod update(org.xwiki.rest.model.jaxb.Object obj, boolean release) throws Exception
Exception
public void delete(org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public void deletePage(String space, String page, Locale locale) throws Exception
Exception
public void attachFile(org.xwiki.model.reference.EntityReference reference, Object is, boolean failIfExists) throws Exception
Exception
public void deleteAttachement(org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public boolean exists(org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public <T> T get(org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public <T> T get(org.xwiki.model.reference.EntityReference reference, boolean failIfNotFound) throws Exception
Exception
public Class<?> getResourceAPI(org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public <T> T get(Object resourceURI, org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public <T> T get(Object resourceURI, org.xwiki.model.reference.EntityReference reference, boolean failIfNotFound) throws Exception
Exception
public InputStream getInputStream(String resourceUri, Map<String,?> queryParams, Object... elements) throws Exception
Exception
public InputStream postRESTInputStream(Object resourceUri, Object restObject, Object... elements) throws Exception
Exception
public InputStream postInputStream(Object resourceUri, Object restObject, Map<String,Object[]> queryParams, Object... elements) throws Exception
Exception
public <T> T toResource(InputStream is) throws JAXBException
JAXBException
protected InputStream toResourceInputStream(Object restObject) throws JAXBException
JAXBException
public org.apache.commons.httpclient.methods.GetMethod executeGet(org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public org.apache.commons.httpclient.methods.GetMethod executeGet(Object resourceURI, org.xwiki.model.reference.EntityReference reference) throws Exception
Exception
public org.apache.commons.httpclient.methods.GetMethod executeGet(Object resourceUri, Object... elements) throws Exception
Exception
public org.apache.commons.httpclient.methods.GetMethod executeGet(Object resourceUri, Map<String,Object[]> queryParams, Object... elements) throws Exception
Exception
public org.apache.commons.httpclient.methods.PostMethod executePost(Object resourceUri, Object restObject, Object... elements) throws Exception
Exception
public org.apache.commons.httpclient.methods.PostMethod executePost(Object resourceUri, Object restObject, Map<String,Object[]> queryParams, Object... elements) throws Exception
Exception
public org.apache.commons.httpclient.methods.PutMethod executePut(Object resourceUri, Object restObject, Object... elements) throws Exception
Exception
public org.apache.commons.httpclient.methods.PutMethod executePut(Object resourceUri, Object restObject, Map<String,Object[]> queryParams, Object... elements) throws Exception
Exception
public org.apache.commons.httpclient.methods.DeleteMethod executeDelete(Object resourceUri, Object... elements) throws Exception
Exception
public org.apache.commons.httpclient.methods.DeleteMethod executeDelete(Object resourceUri, Map<String,Object[]> queryParams, Object... elements) throws Exception
Exception
public URI createUri(Object resourceUri, Map<String,Object[]> queryParams, Object... elements)
public javax.ws.rs.core.UriBuilder getUriBuilder(Object resourceUri, Map<String,Object[]> queryParams)
protected javax.ws.rs.core.UriBuilder getUriBuilder(Class<?> resource)
public byte[] getBuffer(String resourceUri, Map<String,Object[]> queryParams, Object... elements) throws Exception
Exception
public <T> T getResource(String resourceUri, Map<String,Object[]> queryParams, Object... elements) throws Exception
Exception
public static org.xwiki.rest.model.jaxb.Property getProperty(String name, org.xwiki.rest.model.jaxb.Object preferencesObject, boolean create)
Copyright © 2004–2021 XWiki. All rights reserved.