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