1 18 package org.apache.roller.webservices.adminapi; 19 20 import java.io.IOException ; 21 import org.apache.roller.webservices.adminapi.sdk.MemberEntrySet; 22 import org.apache.roller.webservices.adminapi.sdk.MissingElementException; 23 import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException; 24 import org.jdom.JDOMException; 25 26 public class MemberHandlerTest extends AappTest { 27 public void testHandler() { 28 try { 29 createSampleUser(); 30 createSampleWeblog(); 31 32 MemberEntrySet mesCreate = createSampleMember(); 34 assertNotNull(mesCreate); 35 assertNotNull(mesCreate.getEntries()); 36 assertEquals(mesCreate.getEntries().length, 1); 37 assertEquals(mesCreate, getSampleMemberEntrySet()); 38 39 MemberEntrySet mesFetch = fetchSampleMember(); 41 assertNotNull(mesFetch); 42 assertNotNull(mesFetch.getEntries()); 43 assertEquals(mesFetch.getEntries().length, 1); 44 assertEquals(mesFetch, mesCreate); 45 46 MemberEntrySet mesUpdate = updateSampleMember(); 48 assertNotNull(mesUpdate); 49 assertNotNull(mesUpdate.getEntries()); 50 assertEquals(mesUpdate.getEntries().length, 1); 51 assertEquals(mesUpdate, updateSampleMemberEntrySet(getSampleMemberEntrySet())); 52 53 MemberEntrySet mesDelete = deleteSampleMember(); 55 assertNotNull(mesDelete); 56 assertNotNull(mesCreate.getEntries()); 57 assertEquals(mesCreate.getEntries().length, 1); 58 assertEquals(mesDelete, mesUpdate); 59 60 deleteSampleWeblog(); 61 deleteSampleUser(); 62 } catch (IOException ioe) { 63 ioe.printStackTrace(); 64 fail(ioe.getMessage()); 65 } catch (JDOMException je) { 66 je.printStackTrace(); 67 fail(je.getMessage()); 68 } catch (MissingElementException mee) { 69 mee.printStackTrace(); 70 fail(mee.getMessage()); 71 } catch (UnexpectedRootElementException uree) { 72 uree.printStackTrace(); 73 fail(uree.getMessage()); 74 } finally { 75 try { 76 delete(getSampleMemberEntry().getHref(), getUser(), getPassword()); 77 delete(getSampleWeblogEntry().getHref(), getUser(), getPassword()); 78 delete(getSampleUserEntry().getHref(), getUser(), getPassword()); 79 } catch (Exception e) { 80 } 82 } 83 } 84 } 85 86 | Popular Tags |