Package org.apache.roller.webservices.adminapi.sdk

Examples of org.apache.roller.webservices.adminapi.sdk.WeblogEntrySet


    public void testHandler() {
        try {
            createSampleUser();
           
            //create
            WeblogEntrySet wesCreate = createSampleWeblog();
            assertNotNull(wesCreate);
            assertNotNull(wesCreate.getEntries());
            assertEquals(wesCreate.getEntries().length, 1);
            assertEquals(wesCreate, getSampleWeblogEntrySet());
           
            //get
            WeblogEntrySet wesFetch = fetchSampleWeblog();
            assertNotNull(wesFetch);
            assertNotNull(wesFetch.getEntries());
            assertEquals(wesFetch.getEntries().length, 1);
            assertEquals(wesFetch, wesCreate);
           
            //update
            WeblogEntrySet wesUpdate = updateSampleWeblog();
            assertNotNull(wesUpdate);
            assertNotNull(wesUpdate.getEntries());
            assertEquals(wesUpdate.getEntries().length, 1);
            assertEquals(wesUpdate, updateSampleWeblogEntrySet(getSampleWeblogEntrySet()));
           
            //delete
            WeblogEntrySet wesDelete = deleteSampleWeblog();
            assertNotNull(wesDelete);
            assertNotNull(wesCreate.getEntries());
            assertEquals(wesCreate.getEntries().length, 1);
            assertEquals(wesDelete, wesUpdate);
           
View Full Code Here


    }
   
    protected static WeblogEntrySet updateSampleWeblogEntrySet(WeblogEntrySet wes) {
        WeblogEntry we = (WeblogEntry)wes.getEntries()[0];
        WeblogEntry weUpdated = updateSampleWeblogEntry(we);       
        WeblogEntrySet wesUpdated = new WeblogEntrySet(getEndpointUrl());
        wesUpdated.setEntries(new WeblogEntry[] { weUpdated });
       
        return wesUpdated;
    }
View Full Code Here

        return ues;
    }
   
    protected static WeblogEntrySet getSampleWeblogEntrySet() {
        WeblogEntry we = getSampleWeblogEntry();
        WeblogEntrySet wes = new WeblogEntrySet(getEndpointUrl());
        wes.setEntries(new WeblogEntry[] { we });
       
        return wes;
    }
View Full Code Here

       
        return uesResponse;
    }

    protected WeblogEntrySet updateSampleWeblog() throws IOException, JDOMException, MissingElementException, UnexpectedRootElementException {
        WeblogEntrySet wes = updateSampleWeblogEntrySet(getSampleWeblogEntrySet());
       
        String url = wes.getHref();
        String user = getUser();
        String password = getPassword();
       
        String body = wes.toString();
       
        HttpResponse res = put(url, user, password, body);
        assertEquals(200, res.getStatus());
       
        WeblogEntrySet wesResponse = null;
        InputStream responseBody = res.getResponseBody();
        if (responseBody != null) {
           wesResponse = new WeblogEntrySet(responseBody, getEndpointUrl());
        }
       
        return wesResponse;
    }
View Full Code Here

       
        return mesResponse;
    }
   
    protected WeblogEntrySet createSampleWeblog() throws IOException, JDOMException, MissingElementException, UnexpectedRootElementException {
        WeblogEntrySet wes = getSampleWeblogEntrySet();
       
        String url = wes.getHref();
        String user = getUser();
        String password = getPassword();
       
        String body = wes.toString();
       
        HttpResponse res = post(url, user, password, body);
        assertEquals(201, res.getStatus());
       
        WeblogEntrySet wesResponse = null;
        InputStream responseBody = res.getResponseBody();
        if (responseBody != null) {
           wesResponse = new WeblogEntrySet(responseBody, getEndpointUrl());
        }
       
        return wesResponse;
    }
View Full Code Here

        WeblogEntry we = getSampleWeblogEntry();
       
        HttpResponse res = get(we.getHref(), getUser(), getPassword());
        assertEquals(200, res.getStatus());
       
        WeblogEntrySet wesResponse = null;
        InputStream responseBody = res.getResponseBody();
        if (responseBody != null) {
           wesResponse = new WeblogEntrySet(responseBody, getEndpointUrl());
        }
       
        return wesResponse;
    }
View Full Code Here

        WeblogEntry we = getSampleWeblogEntry();
       
        HttpResponse res = delete(we.getHref(), getUser(), getPassword());
        assertEquals(200, res.getStatus());
       
        WeblogEntrySet wesResponse = null;
        InputStream responseBody = res.getResponseBody();
        if (responseBody != null) {
           wesResponse = new WeblogEntrySet(responseBody, getEndpointUrl());
        }
       
        return wesResponse;
    }
View Full Code Here

    public RollerWeblogHandler(HttpServletRequest request) throws HandlerException {
        super(request);
    }
   
    protected EntrySet getEntrySet(Document d) throws MissingElementException, UnexpectedRootElementException {
        return new WeblogEntrySet(d, getUrlPrefix());
    }
View Full Code Here

    private WeblogEntrySet toWeblogEntrySet(UserData[] uds) throws HandlerException {
        if (uds == null) {
            throw new NullPointerException("ERROR: Null user data not allowed");
        }
       
        WeblogEntrySet wes = new WeblogEntrySet(getUrlPrefix());
        List entries = new ArrayList();
        for (int i = 0; i < uds.length; i++) {
            UserData ud = uds[i];
            List permissions = ud.getPermissions();
            for (Iterator j = permissions.iterator(); j.hasNext(); ) {
                PermissionsData pd = (PermissionsData)j.next();
                WebsiteData wd = pd.getWebsite();
                WeblogEntry we = toWeblogEntry(wd);
                entries.add(we);
            }
        }
        wes.setEntries((Entry[])entries.toArray(new Entry[0]));
       
        return wes;
    }
View Full Code Here

    private WeblogEntrySet toWeblogEntrySet(WebsiteData[] wds) throws HandlerException {
        if (wds == null) {
            throw new NullPointerException("ERROR: Null website datas not allowed");
        }
       
        WeblogEntrySet wes = new WeblogEntrySet(getUrlPrefix());
        List entries = new ArrayList();
        for (int i = 0; i < wds.length; i++) {
            WeblogEntry we = toWeblogEntry(wds[i]);
            entries.add(we);
        }
        wes.setEntries((Entry[])entries.toArray(new Entry[0]));
       
        return wes;
    }
View Full Code Here

TOP

Related Classes of org.apache.roller.webservices.adminapi.sdk.WeblogEntrySet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.