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 UserEntryTest extends AappTest { 28 public void testEquals() { 29 UserEntrySet ues1 = getSampleUserEntrySet(); 30 UserEntrySet ues2 = getSampleUserEntrySet(); 31 32 assertEquals(ues1, ues2); 33 } 34 35 public void testDocumentMarshal() { 36 try { 37 UserEntrySet ues1 = getSampleUserEntrySet(); 38 Document d = ues1.toDocument(); 39 40 UserEntrySet ues2 = new UserEntrySet(d, getEndpointUrl()); 41 42 assertEquals(ues1, ues2); 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 UserEntrySet ues1 = getSampleUserEntrySet(); 53 String s = ues1.toString(); 54 InputStream stream = new ByteArrayInputStream (s.getBytes("UTF-8")); 55 56 UserEntrySet ues2 = new UserEntrySet(stream, getEndpointUrl()); 57 58 assertEquals(ues1, ues2); 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 |