1 18 package org.apache.roller.webservices.adminapi; 19 20 import java.io.IOException ; 21 import org.apache.roller.webservices.adminapi.sdk.MissingElementException; 22 import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException; 23 import org.apache.roller.webservices.adminapi.sdk.WeblogEntrySet; 24 import org.jdom.JDOMException; 25 26 public class WeblogHandlerTest extends AappTest { 27 public void testHandler() { 28 try { 29 createSampleUser(); 30 31 WeblogEntrySet wesCreate = createSampleWeblog(); 33 assertNotNull(wesCreate); 34 assertNotNull(wesCreate.getEntries()); 35 assertEquals(wesCreate.getEntries().length, 1); 36 assertEquals(wesCreate, getSampleWeblogEntrySet()); 37 38 WeblogEntrySet wesFetch = fetchSampleWeblog(); 40 assertNotNull(wesFetch); 41 assertNotNull(wesFetch.getEntries()); 42 assertEquals(wesFetch.getEntries().length, 1); 43 assertEquals(wesFetch, wesCreate); 44 45 WeblogEntrySet wesUpdate = updateSampleWeblog(); 47 assertNotNull(wesUpdate); 48 assertNotNull(wesUpdate.getEntries()); 49 assertEquals(wesUpdate.getEntries().length, 1); 50 assertEquals(wesUpdate, updateSampleWeblogEntrySet(getSampleWeblogEntrySet())); 51 52 WeblogEntrySet wesDelete = deleteSampleWeblog(); 54 assertNotNull(wesDelete); 55 assertNotNull(wesCreate.getEntries()); 56 assertEquals(wesCreate.getEntries().length, 1); 57 assertEquals(wesDelete, wesUpdate); 58 59 deleteSampleUser(); 60 } catch (IOException ioe) { 61 fail(ioe.getMessage()); 62 ioe.printStackTrace(); 63 } catch (JDOMException je) { 64 fail(je.getMessage()); 65 je.printStackTrace(); 66 } catch (MissingElementException mee) { 67 fail(mee.getMessage()); 68 mee.printStackTrace(); 69 } catch (UnexpectedRootElementException uree) { 70 fail(uree.getMessage()); 71 uree.printStackTrace(); 72 } finally { 73 try { 74 delete(getSampleWeblogEntry().getHref(), getUser(), getPassword()); 75 delete(getSampleUserEntry().getHref(), getUser(), getPassword()); 76 } catch (Exception e) { 77 } 79 } 80 } 81 } 82 | Popular Tags |