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.UserEntrySet; 24 import org.jdom.JDOMException; 25 26 30 public class UserHandlerTest extends AappTest { 31 public void testHandler() { 32 try { 33 UserEntrySet uesCreate = createSampleUser(); 35 assertNotNull(uesCreate); 36 assertNotNull(uesCreate.getEntries()); 37 assertEquals(uesCreate.getEntries().length, 1); 38 assertEquals(uesCreate, getSampleUserEntrySet()); 39 40 UserEntrySet uesFetch = fetchSampleUser(); 42 assertNotNull(uesFetch); 43 assertNotNull(uesFetch.getEntries()); 44 assertEquals(uesFetch.getEntries().length, 1); 45 assertEquals(uesFetch, uesCreate); 46 47 UserEntrySet uesUpdate = updateSampleUser(); 49 assertNotNull(uesUpdate); 50 assertNotNull(uesUpdate.getEntries()); 51 assertEquals(uesUpdate.getEntries().length, 1); 52 assertEquals(uesUpdate, updateSampleUserEntrySet(getSampleUserEntrySet())); 53 54 UserEntrySet uesDelete = deleteSampleUser(); 56 assertNotNull(uesDelete); 57 assertNotNull(uesCreate.getEntries()); 58 assertEquals(uesCreate.getEntries().length, 1); 59 assertEquals(uesDelete, uesUpdate); 60 } catch (IOException ioe) { 61 ioe.printStackTrace(); 62 fail(ioe.getMessage()); 63 } catch (JDOMException je) { 64 je.printStackTrace(); 65 fail(je.getMessage()); 66 } catch (MissingElementException mee) { 67 mee.printStackTrace(); 68 fail(mee.getMessage()); 69 } catch (UnexpectedRootElementException uree) { 70 uree.printStackTrace(); 71 fail(uree.getMessage()); 72 } finally { 73 try { 74 delete(getSampleUserEntry().getHref(), getUser(), getPassword()); 75 } catch (Exception e) { 76 e.printStackTrace(); 77 } 78 } 79 } 80 } 81 | Popular Tags |