1 16 package org.apache.juddi.handler; 17 18 import org.apache.juddi.datatype.RegistryObject; 19 import org.apache.juddi.datatype.request.AuthInfo; 20 import org.apache.juddi.datatype.request.GetPublisherAssertions; 21 import org.apache.juddi.util.xml.XMLUtils; 22 import org.w3c.dom.Element ; 23 24 27 public class GetPublisherAssertionsHandlerTests extends HandlerTestCase 28 { 29 private static final String TEST_ID = "juddi.handler.DeletePublisher.test"; 30 private GetPublisherAssertionsHandler handler = null; 31 32 public GetPublisherAssertionsHandlerTests(String arg0) 33 { 34 super(arg0); 35 } 36 37 public static void main(String [] args) 38 { 39 junit.textui.TestRunner.run( GetPublisherAssertionsHandlerTests.class); 40 } 41 42 public void setUp() 43 { 44 HandlerMaker maker = HandlerMaker.getInstance(); 45 handler = ( GetPublisherAssertionsHandler)maker.lookup( GetPublisherAssertionsHandler.TAG_NAME); 46 } 47 48 private RegistryObject getRegistryObject() 49 { 50 AuthInfo authInfo = new AuthInfo(); 51 authInfo.setValue("6f157513-844e-4a95-a856-d257e6ba9726"); 52 53 GetPublisherAssertions object = new GetPublisherAssertions(); 54 object.setAuthInfo(authInfo); 55 56 return object; 57 58 } 59 60 private Element getMarshalledElement(RegistryObject regObject) 61 { 62 Element parent = XMLUtils.newRootElement(); 63 Element child = null; 64 65 if(regObject == null) 66 regObject = this.getRegistryObject(); 67 68 handler.marshal(regObject,parent); 69 child = (Element )parent.getFirstChild(); 70 parent.removeChild(child); 71 72 return child; 73 } 74 75 public void testMarshal() 76 { 77 Element child = getMarshalledElement(null); 78 79 String marshalledString = this.getXMLString(child); 80 81 assertNotNull("Marshalled GetPublisherAssertions ", marshalledString); 82 83 } 84 85 public void testUnMarshal() 86 { 87 88 Element child = getMarshalledElement(null); 89 RegistryObject regObject = handler.unmarshal(child); 90 91 assertNotNull("UnMarshalled GetPublisherAssertions ", regObject); 92 93 } 94 95 public void testMarshUnMarshal() 96 { 97 Element child = getMarshalledElement(null); 98 99 String marshalledString = this.getXMLString(child); 100 101 assertNotNull("Marshalled GetPublisherAssertions ", marshalledString); 102 103 RegistryObject regObject = handler.unmarshal(child); 104 105 child = getMarshalledElement(regObject); 106 107 String unMarshalledString = this.getXMLString(child); 108 109 assertNotNull("Unmarshalled GetPublisherAssertions ", unMarshalledString); 110 111 boolean equals = marshalledString.equals(unMarshalledString); 112 113 assertEquals("Expected result: ", marshalledString, unMarshalledString ); 114 } 115 116 } 117 | Popular Tags |