1 18 package org.apache.roller.webservices.adminapi.sdk; 19 20 import org.jdom.Document; 21 import java.io.InputStream ; 22 import java.io.ByteArrayInputStream ; 23 import java.io.IOException ; 24 import org.apache.roller.webservices.adminapi.AappTest; 25 import org.jdom.JDOMException; 26 27 public class MemberEntryTest extends AappTest { 28 public void testEquals() { 29 MemberEntrySet wes1 = getSampleMemberEntrySet(); 30 MemberEntrySet wes2 = getSampleMemberEntrySet(); 31 32 assertEquals(wes1, wes2); 33 } 34 35 public void testDocumentMarshal() { 36 try { 37 MemberEntrySet wes1 = getSampleMemberEntrySet(); 38 Document d = wes1.toDocument(); 39 40 MemberEntrySet wes2 = new MemberEntrySet(d, getEndpointUrl()); 41 42 assertEquals(wes1, wes2); 43 } catch (MissingElementException mee) { 44 fail(mee.getMessage()); 45 } catch (UnexpectedRootElementException uree) { 46 fail(uree.getMessage()); 47 } 48 } 49 50 public void testStreamMarshal() { 51 try { 52 MemberEntrySet wes1 = getSampleMemberEntrySet(); 53 String s = wes1.toString(); 54 InputStream stream = new ByteArrayInputStream (s.getBytes("UTF-8")); 55 56 MemberEntrySet wes2 = new MemberEntrySet(stream, getEndpointUrl()); 57 58 assertEquals(wes1, wes2); 59 } catch (MissingElementException mee) { 60 fail(mee.getMessage()); 61 } catch (UnexpectedRootElementException uree) { 62 fail(uree.getMessage()); 63 } catch (IOException ioe) { 64 fail(ioe.getMessage()); 65 } catch (JDOMException je) { 66 fail(je.getMessage()); 67 } 68 } 69 } 70 | Popular Tags |