Package org.apache.roller.weblogger.webservices.adminprotocol.sdk

Examples of org.apache.roller.weblogger.webservices.adminprotocol.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(true);
            assertNotNull(wesDelete);
            assertNotNull(wesCreate.getEntries());
            assertEquals(wesCreate.getEntries().length, 1);
            assertEquals(0, wesDelete.getEntries().length);
           
        } catch (IOException ioe) {
            fail(ioe.getMessage());
            ioe.printStackTrace();
        } catch (JDOMException je) {
View Full Code Here


    }

    public void testEnabled() {
        try {
            createSampleUser();
            WeblogEntrySet wes = createSampleWeblog();
            WeblogEntry we = (WeblogEntry)wes.getEntries()[0];
            assertEquals(we.getEnabled(), Boolean.TRUE);
           
            wes = updateSampleWeblog();
            we = (WeblogEntry)wes.getEntries()[0];
            assertEquals(Boolean.FALSE, we.getEnabled());

            wes = fetchSampleWeblog();
            we = (WeblogEntry)wes.getEntries()[0];
            assertEquals(Boolean.FALSE, we.getEnabled());
        } catch (IOException ioe) {
            fail(ioe.getMessage());
            ioe.printStackTrace();
        } catch (JDOMException je) {
View Full Code Here

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

    private WeblogEntrySet toWeblogEntrySet(User[] 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++) {
            User ud = uds[i];
            List permissions = ud.getPermissions();
            for (Iterator j = permissions.iterator(); j.hasNext(); ) {
                WeblogPermission pd = (WeblogPermission)j.next();
                Weblog 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(Weblog[] 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

       
        return uesResponse;
    }
   
    protected WeblogEntrySet updateSampleWeblog() throws IOException, JDOMException, 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, 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

            assertEquals(200, res.getStatus());
        } else if (res.getStatus() != 200) {
            return null;
        }
       
        WeblogEntrySet wesResponse = null;
        InputStream responseBody = res.getResponseBody();
        if (responseBody != null) {
            wesResponse = new WeblogEntrySet(responseBody, getEndpointUrl());
        }
       
        return wesResponse;
    }
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

TOP

Related Classes of org.apache.roller.weblogger.webservices.adminprotocol.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.