Search in sources :

Example 6 with Wikis

use of org.xwiki.rest.model.jaxb.Wikis in project xwiki-platform by xwiki.

the class WikisResourceTest method testRepresentation.

@Override
@Test
public void testRepresentation() throws Exception {
    GetMethod getMethod = executeGet(getFullUri(WikisResource.class));
    Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
    Wikis wikis = (Wikis) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
    Assert.assertTrue(getHttpMethodInfo(getMethod), wikis.getWikis().size() > 0);
    for (Wiki wiki : wikis.getWikis()) {
        Link link = getFirstLinkByRelation(wiki, Relations.SPACES);
        Assert.assertNotNull(link);
        link = getFirstLinkByRelation(wiki, Relations.CLASSES);
        Assert.assertNotNull(link);
        link = getFirstLinkByRelation(wiki, Relations.MODIFICATIONS);
        Assert.assertNotNull(link);
        link = getFirstLinkByRelation(wiki, Relations.SEARCH);
        Assert.assertNotNull(link);
        link = getFirstLinkByRelation(wiki, Relations.QUERY);
        Assert.assertNotNull(link);
        checkLinks(wiki);
    }
}
Also used : GetMethod(org.apache.commons.httpclient.methods.GetMethod) Wikis(org.xwiki.rest.model.jaxb.Wikis) Wiki(org.xwiki.rest.model.jaxb.Wiki) Link(org.xwiki.rest.model.jaxb.Link) WikisResource(org.xwiki.rest.resources.wikis.WikisResource) AbstractHttpTest(org.xwiki.test.rest.framework.AbstractHttpTest) Test(org.junit.Test)

Example 7 with Wikis

use of org.xwiki.rest.model.jaxb.Wikis in project xwiki-platform by xwiki.

the class AbstractHttpTest method getWiki.

protected String getWiki() throws Exception {
    GetMethod getMethod = executeGet(getFullUri(WikisResource.class));
    Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
    Wikis wikis = (Wikis) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
    Assert.assertTrue(wikis.getWikis().size() > 0);
    return wikis.getWikis().get(0).getName();
}
Also used : GetMethod(org.apache.commons.httpclient.methods.GetMethod) Wikis(org.xwiki.rest.model.jaxb.Wikis) WikisResource(org.xwiki.rest.resources.wikis.WikisResource)

Aggregations

Wikis (org.xwiki.rest.model.jaxb.Wikis)7 GetMethod (org.apache.commons.httpclient.methods.GetMethod)6 WikisResource (org.xwiki.rest.resources.wikis.WikisResource)6 Link (org.xwiki.rest.model.jaxb.Link)5 Wiki (org.xwiki.rest.model.jaxb.Wiki)5 Test (org.junit.Test)4 Space (org.xwiki.rest.model.jaxb.Space)3 Spaces (org.xwiki.rest.model.jaxb.Spaces)3 AbstractHttpTest (org.xwiki.test.rest.framework.AbstractHttpTest)3 Pages (org.xwiki.rest.model.jaxb.Pages)2 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1 DocumentReference (org.xwiki.model.reference.DocumentReference)1 EntityReference (org.xwiki.model.reference.EntityReference)1 XWikiRestException (org.xwiki.rest.XWikiRestException)1 Page (org.xwiki.rest.model.jaxb.Page)1 PageSummary (org.xwiki.rest.model.jaxb.PageSummary)1 WikisSearchQueryResource (org.xwiki.rest.resources.wikis.WikisSearchQueryResource)1 WikiManagerREST (org.xwiki.wiki.rest.WikiManagerREST)1