axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r516227 [4/4] - in /webservices/axis2/trunk/java/modules/addressing: ./ src/META-INF/ src/org/apache/axis2/addressing/ src/org/apache/axis2/addressing/i18n/ src/org/apache/axis2/handlers/addressing/ test-resources/ test-resources/fault-mess...
Date Thu, 08 Mar 2007 23:33:47 GMT
Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java?view=diff&rev=516227&r1=516226&r2=516227
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingFinalInHandlerTest.java Thu Mar  8 15:33:43 2007
@@ -16,11 +16,6 @@
 
 package org.apache.axis2.handlers.addressing;
 
-import java.util.ArrayList;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
@@ -30,13 +25,15 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Map;
+
 public class AddressingFinalInHandlerTest extends AddressingInHandlerTestBase {
 
     private Log log = LogFactory.getLog(getClass());
-   
-    /**
-     * @param testName
-     */
+
+    /** @param testName  */
     public AddressingFinalInHandlerTest(String testName) {
         super(testName);
     }
@@ -53,10 +50,10 @@
     public void testExtractAddressingInformationFromHeaders() {
         try {
             Options options = extractAddressingInformationFromHeaders();
-            
+
             assertNotNull(options);
             assertNotNull(options.getTo());
-   
+
             Map allReferenceParameters = options.getTo().getAllReferenceParameters();
             assertNotNull(allReferenceParameters);
             QName qName = new QName("http://ws.apache.org/namespaces/axis2", "ParamOne", "axis2");
@@ -65,14 +62,14 @@
             assertEPRHasCorrectMetadata(options.getFrom());
             assertEPRHasCorrectMetadata(options.getFaultTo());
             assertEPRHasCorrectMetadata(options.getReplyTo());
-            
+
         } catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
             fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedAction() {
         try {
             testMessageWithOmittedHeaders("noAction");
@@ -84,15 +81,15 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedFaultTo() {
         try {
             Options options = testMessageWithOmittedHeaders("noFaultTo");
             EndpointReference epr = options.getFaultTo();
-            
+
             assertNull("The FaultTo endpoint reference is not null.", epr);
         }
         catch (AxisFault af) {
@@ -103,15 +100,15 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedFrom() {
         try {
             Options options = testMessageWithOmittedHeaders("noFrom");
             EndpointReference epr = options.getFrom();
-            
+
             assertNull("The From endpoint reference is not null.", epr);
         }
         catch (AxisFault af) {
@@ -122,15 +119,15 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedMessageID() {
         try {
             Options options = testMessageWithOmittedHeaders("noMessageID");
             String messageID = options.getMessageId();
-            
+
             assertNull("The message id is not null.", messageID);
         }
         catch (AxisFault af) {
@@ -141,17 +138,18 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedReplyTo() {
         try {
             Options options = testMessageWithOmittedHeaders("noReplyTo");
             EndpointReference epr = options.getReplyTo();
             String address = epr.getAddress();
-            
-            assertEquals("The address of the ReplyTo endpoint reference is not the anonymous URI.", AddressingConstants.Final.WSA_ANONYMOUS_URL, address);
+
+            assertEquals("The address of the ReplyTo endpoint reference is not the anonymous URI.",
+                         AddressingConstants.Final.WSA_ANONYMOUS_URL, address);
         }
         catch (AxisFault af) {
             af.printStackTrace();
@@ -161,15 +159,15 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedTo() {
         try {
             Options options = testMessageWithOmittedHeaders("noTo");
             EndpointReference epr = options.getTo();
-            
+
             assertNull("The To endpoint reference is not null.", epr);
         }
         catch (AxisFault af) {
@@ -180,18 +178,18 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testDifferentSoapActionProcessing() {
-        String testfile = "valid-messages/"+versionDirectory+"/soapmessage.xml";
+        String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
         MessageContext mc = new MessageContext();
-        mc.setServerSide(true); 
+        mc.setServerSide(true);
         try {
             mc.setSoapAction("http://ws.apache.org/tests/differentAction");
             basicExtractAddressingInformationFromHeaders(testfile, mc);
-            fail("An AxisFault should have been thrown due to the soapaction being different to the ws-a action.");            
+            fail("An AxisFault should have been thrown due to the soapaction being different to the ws-a action.");
         }
         catch (AxisFault af) {
             //Test passed.
@@ -199,12 +197,12 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());                        
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testSameSoapAction() {
-        String testfile = "valid-messages/"+versionDirectory+"/soapmessage.xml";
+        String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
         MessageContext mc = new MessageContext();
         mc.setServerSide(true);
         try {
@@ -214,19 +212,19 @@
         catch (AxisFault af) {
             af.printStackTrace();
             log.error(af.getMessage());
-            fail("An unexpected AxisFault was thrown while testing with a soapaction and ws-a action that are the same.");            
+            fail("An unexpected AxisFault was thrown while testing with a soapaction and ws-a action that are the same.");
         }
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());                        
-        }        
+            fail(" An Exception has occured " + e.getMessage());
+        }
     }
-    
+
     public void testEmptySoapAction() {
-        String testfile = "valid-messages/"+versionDirectory+"/soapmessage.xml";
+        String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
         MessageContext mc = new MessageContext();
-        
+
         try {
             mc.setSoapAction("");
             basicExtractAddressingInformationFromHeaders(testfile, mc);
@@ -234,19 +232,19 @@
         catch (AxisFault af) {
             af.printStackTrace();
             log.error(af.getMessage());
-            fail("An unexpected AxisFault was thrown while testing with an empty soapaction.");            
+            fail("An unexpected AxisFault was thrown while testing with an empty soapaction.");
         }
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());                        
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testNullSoapAction() {
-        String testfile = "valid-messages/"+versionDirectory+"/soapmessage.xml";
+        String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
         MessageContext mc = new MessageContext();
-        
+
         try {
             mc.setSoapAction(null);
             basicExtractAddressingInformationFromHeaders(testfile, mc);
@@ -254,24 +252,26 @@
         catch (AxisFault af) {
             af.printStackTrace();
             log.error(af.getMessage());
-            fail("An unexpected AxisFault was thrown while testing with a null soapaction.");            
+            fail("An unexpected AxisFault was thrown while testing with a null soapaction.");
         }
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());                        
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
-    private void assertEPRHasCorrectMetadata(EndpointReference epr){
-    	ArrayList metadata = epr.getMetaData();
-    	if(metadata != null){
-    		OMElement md = (OMElement)metadata.get(0);
-    		assertEquals(md.getQName(),new QName("http://ws.apache.org/namespaces/axis2","MetaExt"));
-    		assertEquals(md.getText(),"123456789");
-    		assertEquals(md.getAttributeValue(new QName("http://ws.apache.org/namespaces/axis2","AttrExt")),"123456789");
-    	}else{
-    		fail("No Metadata found in EPR");
-    	}
+
+    private void assertEPRHasCorrectMetadata(EndpointReference epr) {
+        ArrayList metadata = epr.getMetaData();
+        if (metadata != null) {
+            OMElement md = (OMElement) metadata.get(0);
+            assertEquals(md.getQName(),
+                         new QName("http://ws.apache.org/namespaces/axis2", "MetaExt"));
+            assertEquals(md.getText(), "123456789");
+            assertEquals(md.getAttributeValue(
+                    new QName("http://ws.apache.org/namespaces/axis2", "AttrExt")), "123456789");
+        } else {
+            fail("No Metadata found in EPR");
+        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java?view=diff&rev=516227&r1=516226&r2=516227
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java Thu Mar  8 15:33:43 2007
@@ -15,7 +15,6 @@
 package org.apache.axis2.handlers.addressing;
 
 import junit.framework.TestCase;
-
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.AxisFault;
@@ -26,38 +25,41 @@
 public class AddressingInFaultHandlerTest extends TestCase {
 
     TestUtil testUtil = new TestUtil();
- 
-    /**
-     * @param testName
-     */
+
+    /** @param testName  */
     public AddressingInFaultHandlerTest(String testName) {
         super(testName);
     }
 
-    public void testInvalidAddressingHeaderWsaToSOAP11() throws Exception{
+    public void testInvalidAddressingHeaderWsaToSOAP11() throws Exception {
         AxisFault af = getFaultForTest("InvalidAddressingHeader", true);
         assertNotNull(af);
-        assertEquals("The server failed to process the WS-Addressing header: "+"wsa:To"+" [Reason]: A header representing a Message Addressing Property is not valid and the message cannot be processed", af.getMessage());
+        assertEquals("The server failed to process the WS-Addressing header: " + "wsa:To" +
+                " [Reason]: A header representing a Message Addressing Property is not valid and the message cannot be processed",
+                     af.getMessage());
     }
-    
-    public void testMissingActionSOAP11() throws Exception{
+
+    public void testMissingActionSOAP11() throws Exception {
         AxisFault af = getFaultForTest("MessageAddressingHeaderRequired", true);
         assertNotNull(af);
     }
-    
-    public void testInvalidAddressingHeaderWsaToSOAP12() throws Exception{
+
+    public void testInvalidAddressingHeaderWsaToSOAP12() throws Exception {
         AxisFault af = getFaultForTest("InvalidAddressingHeader", false);
         assertNotNull(af);
-        assertEquals("The server failed to process the WS-Addressing header: "+"wsa:To"+" [Reason]: A header representing a Message Addressing Property is not valid and the message cannot be processed", af.getMessage());
+        assertEquals("The server failed to process the WS-Addressing header: " + "wsa:To" +
+                " [Reason]: A header representing a Message Addressing Property is not valid and the message cannot be processed",
+                     af.getMessage());
     }
-    
-    public void testMissingActionSOAP12() throws Exception{
+
+    public void testMissingActionSOAP12() throws Exception {
         AxisFault af = getFaultForTest("MessageAddressingHeaderRequired", false);
         assertNotNull(af);
     }
-    
-    private AxisFault getFaultForTest(String testName, boolean isSOAP11) throws Exception{
-        String testfile = "fault-messages/"+(isSOAP11?"soap11":"soap12")+"/"+testName+".xml";
+
+    private AxisFault getFaultForTest(String testName, boolean isSOAP11) throws Exception {
+        String testfile =
+                "fault-messages/" + (isSOAP11 ? "soap11" : "soap12") + "/" + testName + ".xml";
         StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder(testfile);
         SOAPEnvelope envelope = ((SOAPEnvelope) omBuilder.getDocumentElement());
         MessageContext msgContext = new MessageContext();
@@ -66,8 +68,8 @@
         afih.invoke(msgContext);
         AddressingInFaultHandler aifh = new AddressingInFaultHandler();
         aifh.invoke(msgContext);
-        
-        return (AxisFault)msgContext.getProperty(Constants.INBOUND_FAULT_OVERRIDE);
+
+        return (AxisFault) msgContext.getProperty(Constants.INBOUND_FAULT_OVERRIDE);
     }
-    
+
 }

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java?view=diff&rev=516227&r1=516226&r2=516227
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTestBase.java Thu Mar  8 15:33:43 2007
@@ -16,14 +16,7 @@
 
 package org.apache.axis2.handlers.addressing;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
 import junit.framework.TestCase;
-
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -39,13 +32,18 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
 public abstract class AddressingInHandlerTestBase extends TestCase {
     private Log log = LogFactory.getLog(getClass());
     AddressingInHandler inHandler;
     String addressingNamespace;
     TestUtil testUtil = new TestUtil();
     private String testFileName = "soapmessage.xml";
-    
+
     String versionDirectory;
 
     private String action = "http://ws.apache.org/tests/action";
@@ -54,42 +52,43 @@
     String secondRelationshipType;
     private String faultAddress = "http://example.com/fabrikam/fault";
     private String replyAddress = "http://example.com/fabrikam/acct";
-    private String toAddress    = "http://localhost:8081/axis/services/BankPort";
- 
-    /**
-     * @param testName
-     */
+    private String toAddress = "http://localhost:8081/axis/services/BankPort";
+
+    /** @param testName  */
     public AddressingInHandlerTestBase(String testName) {
         super(testName);
     }
 
-    protected void basicExtractAddressingInformationFromHeaders(String testMessagePath, MessageContext mc) throws Exception{
-    	StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder(testMessagePath);
+    protected void basicExtractAddressingInformationFromHeaders(String testMessagePath,
+                                                                MessageContext mc)
+            throws Exception {
+        StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder(testMessagePath);
         SOAPHeader header = ((SOAPEnvelope) omBuilder.getDocumentElement()).getHeader();
         ArrayList addressingHeaderBlocks = header.getHeaderBlocksWithNSURI(addressingNamespace);
-        inHandler.extractAddressingInformation(header, mc, addressingHeaderBlocks, addressingNamespace);
+        inHandler.extractAddressingInformation(header, mc, addressingHeaderBlocks,
+                                               addressingNamespace);
     }
-    
-    protected Options extractAddressingInformationFromHeaders(){
-    	try {
-            String testfile = "valid-messages/"+versionDirectory+"/"+testFileName;
+
+    protected Options extractAddressingInformationFromHeaders() {
+        try {
+            String testfile = "valid-messages/" + versionDirectory + "/" + testFileName;
 
             MessageContext mc = new MessageContext();
-            
+
             basicExtractAddressingInformationFromHeaders(testfile, mc);
-         
+
             Options options = mc.getOptions();
 
             if (options == null) {
                 fail("Addressing Information Headers have not been retrieved properly");
             }
             assertEquals("action header is not correct",
-                    options.getAction(),
-                    action);
+                         options.getAction(),
+                         action);
             assertActionHasExtensibilityAttribute(mc);
             assertEquals("message id header is not correct",
-                    options.getMessageId().trim(),
-                    messageID.trim());
+                         options.getMessageId().trim(),
+                         messageID.trim());
             assertMessageIDHasExtensibilityAttribute(mc);
 
             assertFullFromEPR(options.getFrom());
@@ -97,61 +96,65 @@
             assertFullReplyToEPR(options.getReplyTo());
 
             assertRelationships(options);
-            
+
             return options;
-            
+
         } catch (Exception e) {
             e.printStackTrace();
             log.info(e.getMessage());
             fail(" An Exception has occured " + e.getMessage());
         }
-        
+
         return null;
     }
 
-	private void testExtractAddressingInformationFromHeadersInvalidCardinality(String headerName) {
-    	String testfile = "invalid-cardinality-messages/"+versionDirectory+"/invalidCardinality"+headerName+"Message.xml";
+    private void testExtractAddressingInformationFromHeadersInvalidCardinality(String headerName) {
+        String testfile = "invalid-cardinality-messages/" + versionDirectory +
+                "/invalidCardinality" + headerName + "Message.xml";
         try {
             MessageContext mc = new MessageContext();
-            try{
-            	basicExtractAddressingInformationFromHeaders(testfile, mc);            
-            	fail("An AxisFault should have been thrown due to 2 wsa:"+headerName+" headers.");
-            }catch(AxisFault af){
-            	if(headerName.equals(AddressingConstants.WSA_REPLY_TO)){
-            		assertNull("No ReplyTo should be set on the MessageContext", mc.getReplyTo());
-            	}else{
-            		assertReplyToEPR(mc.getReplyTo());
-            	}
-            	
-            	if(headerName.equals(AddressingConstants.WSA_FAULT_TO)){
-            		assertNull("No FaultTo should be set on the MessageContext", mc.getFaultTo());
-            	}else{
-            		assertFaultEPR(mc.getFaultTo());
-            	}
-            	
-            	if(headerName.equals(AddressingConstants.WSA_ACTION)){
-            		assertNull("No Action should be set on the MessageContext", mc.getWSAAction());
-            	}else{
-            		assertEquals("WSAAction property is not correct", mc.getWSAAction(), action);
-            	}
-            	
-            	if(headerName.equals(AddressingConstants.WSA_MESSAGE_ID)){
-            		assertNull("No MessageID should be set on the MessageContext", mc.getMessageID());
-            	}else{
-            		assertEquals("MessageID property is not correct", mc.getMessageID().trim(), messageID.trim());
-            	}
-            	
-            	if(headerName.equals(AddressingConstants.WSA_FROM)){
-            		assertNull("No From should be set on the MessageContext", mc.getFrom());
-            	}else{
-            		assertFromEPR(mc.getFrom());
-            	}
-            	
-            	if(headerName.equals(AddressingConstants.WSA_TO)){
-            		assertNull("No To should be set on the MessageContext", mc.getTo());
-            	}else{
-            		assertToEPR(mc.getTo());
-            	}
+            try {
+                basicExtractAddressingInformationFromHeaders(testfile, mc);
+                fail("An AxisFault should have been thrown due to 2 wsa:" + headerName +
+                        " headers.");
+            } catch (AxisFault af) {
+                if (headerName.equals(AddressingConstants.WSA_REPLY_TO)) {
+                    assertNull("No ReplyTo should be set on the MessageContext", mc.getReplyTo());
+                } else {
+                    assertReplyToEPR(mc.getReplyTo());
+                }
+
+                if (headerName.equals(AddressingConstants.WSA_FAULT_TO)) {
+                    assertNull("No FaultTo should be set on the MessageContext", mc.getFaultTo());
+                } else {
+                    assertFaultEPR(mc.getFaultTo());
+                }
+
+                if (headerName.equals(AddressingConstants.WSA_ACTION)) {
+                    assertNull("No Action should be set on the MessageContext", mc.getWSAAction());
+                } else {
+                    assertEquals("WSAAction property is not correct", mc.getWSAAction(), action);
+                }
+
+                if (headerName.equals(AddressingConstants.WSA_MESSAGE_ID)) {
+                    assertNull("No MessageID should be set on the MessageContext",
+                               mc.getMessageID());
+                } else {
+                    assertEquals("MessageID property is not correct", mc.getMessageID().trim(),
+                                 messageID.trim());
+                }
+
+                if (headerName.equals(AddressingConstants.WSA_FROM)) {
+                    assertNull("No From should be set on the MessageContext", mc.getFrom());
+                } else {
+                    assertFromEPR(mc.getFrom());
+                }
+
+                if (headerName.equals(AddressingConstants.WSA_TO)) {
+                    assertNull("No To should be set on the MessageContext", mc.getTo());
+                } else {
+                    assertToEPR(mc.getTo());
+                }
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -159,32 +162,37 @@
             fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     protected Options testMessageWithOmittedHeaders(String testName) throws Exception {
-        String testfile = "omitted-header-messages/"+versionDirectory+"/"+testName+"Message.xml";
-        
+        String testfile =
+                "omitted-header-messages/" + versionDirectory + "/" + testName + "Message.xml";
+
         MessageContext mc = new MessageContext();
         basicExtractAddressingInformationFromHeaders(testfile, mc);
-        
+
         return mc.getOptions();
     }
-    
+
     public void testExtractAddressingInformationFromHeadersInvalidCardinalityReplyTo() {
-    	testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_REPLY_TO);
+        testExtractAddressingInformationFromHeadersInvalidCardinality(
+                AddressingConstants.WSA_REPLY_TO);
     }
 
     public void testExtractAddressingInformationFromHeadersInvalidCardinalityFaultTo() {
-        testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_FAULT_TO);
+        testExtractAddressingInformationFromHeadersInvalidCardinality(
+                AddressingConstants.WSA_FAULT_TO);
     }
-    
+
     public void testExtractAddressingInformationFromHeadersInvalidCardinalityAction() {
-        testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_ACTION);
+        testExtractAddressingInformationFromHeadersInvalidCardinality(
+                AddressingConstants.WSA_ACTION);
     }
-    
+
     public void testExtractAddressingInformationFromHeadersInvalidCardinalityMessageID() {
-        testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_MESSAGE_ID);
+        testExtractAddressingInformationFromHeadersInvalidCardinality(
+                AddressingConstants.WSA_MESSAGE_ID);
     }
-    
+
     public void testExtractAddressingInformationFromHeadersInvalidCardinalityFrom() {
         testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_FROM);
     }
@@ -192,175 +200,185 @@
     public void testExtractAddressingInformationFromHeadersInvalidCardinalityTo() {
         testExtractAddressingInformationFromHeadersInvalidCardinality(AddressingConstants.WSA_TO);
     }
-    
+
     private void assertFromEPR(EndpointReference fromEPR) {
         assertEquals("Address in From EPR is not valid",
-                fromEPR.getAddress().trim(),
-                fromAddress.trim());
+                     fromEPR.getAddress().trim(),
+                     fromAddress.trim());
     }
-    
+
     private void assertFaultEPR(EndpointReference faultEPR) {
         assertEquals("Address in FaultTo EPR is not valid",
-        		faultEPR.getAddress().trim(),
-                faultAddress.trim());
+                     faultEPR.getAddress().trim(),
+                     faultAddress.trim());
     }
-    
+
     private void assertReplyToEPR(EndpointReference replyEPR) {
         assertEquals("Address in ReplytTo EPR is not valid",
-        		replyEPR.getAddress().trim(),
-                replyAddress.trim());
+                     replyEPR.getAddress().trim(),
+                     replyAddress.trim());
     }
-    
+
     private void assertToEPR(EndpointReference toEPR) {
         System.out.println(toEPR);
         assertEquals("Address in To EPR is not valid",
-        		toEPR.getAddress().trim(),
-                toAddress.trim());
+                     toEPR.getAddress().trim(),
+                     toAddress.trim());
         assertEPRAddressHasExtensibilityAttribute(toEPR);
     }
-    
+
     private void assertFullFromEPR(EndpointReference fromEPR) {
         assertEquals("Address in From EPR is not valid",
-                fromEPR.getAddress().trim(),
-                fromAddress.trim());
+                     fromEPR.getAddress().trim(),
+                     fromAddress.trim());
         assertEPRHasExtensibilityAttribute(fromEPR);
         assertEPRHasCorrectReferenceParameters(fromEPR);
         assertEPRHasCorrectExtensibilityElements(fromEPR);
     }
-    
+
     private void assertFullFaultEPR(EndpointReference faultEPR) {
         assertEquals("Address in FaultTo EPR is not valid",
-        		faultEPR.getAddress().trim(),
-                faultAddress.trim());
+                     faultEPR.getAddress().trim(),
+                     faultAddress.trim());
         assertEPRHasExtensibilityAttribute(faultEPR);
         assertEPRHasCorrectReferenceParameters(faultEPR);
         assertEPRHasCorrectExtensibilityElements(faultEPR);
     }
-    
+
     private void assertFullReplyToEPR(EndpointReference replyEPR) {
         assertEquals("Address in ReplytTo EPR is not valid",
-        		replyEPR.getAddress().trim(),
-                replyAddress.trim());
+                     replyEPR.getAddress().trim(),
+                     replyAddress.trim());
         assertEPRHasExtensibilityAttribute(replyEPR);
         assertEPRHasCorrectReferenceParameters(replyEPR);
         assertEPRHasCorrectExtensibilityElements(replyEPR);
     }
-    
-    private void assertEPRHasCorrectReferenceParameters(EndpointReference epr){
-    	//<wsa:ReferenceParameters>
+
+    private void assertEPRHasCorrectReferenceParameters(EndpointReference epr) {
+        //<wsa:ReferenceParameters>
         //  <fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
         //  <fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
-    	//</wsa:ReferenceParameters>
-    	Map referenceParameters = epr.getAllReferenceParameters();
-    	if(referenceParameters != null){
-    		OMElement refparm1 = (OMElement)referenceParameters.get(new QName("http://example.com/fabrikam","CustomerKey"));
-    		assertNotNull(refparm1);
-    		assertEquals("ReferenceParameter value incorrect.",refparm1.getText(),"123456789");
-    		
-    		OMElement refparm2 = (OMElement)referenceParameters.get(new QName("http://example.com/fabrikam","ShoppingCart"));
-    		assertNotNull(refparm2);
-    		assertEquals("ReferenceParameter value incorrect.",refparm2.getText(),"ABCDEFG");
-    	}else{
-    		fail("No ReferenceParameters found in EPR");
-    	}
-    }
-    
-    private void assertActionHasExtensibilityAttribute(MessageContext mc){
-        boolean attributeFound=false;
-        ArrayList attributes = (ArrayList)mc.getProperty(AddressingConstants.ACTION_ATTRIBUTES);
-        if(attributes!=null){
+        //</wsa:ReferenceParameters>
+        Map referenceParameters = epr.getAllReferenceParameters();
+        if (referenceParameters != null) {
+            OMElement refparm1 = (OMElement) referenceParameters
+                    .get(new QName("http://example.com/fabrikam", "CustomerKey"));
+            assertNotNull(refparm1);
+            assertEquals("ReferenceParameter value incorrect.", refparm1.getText(), "123456789");
+
+            OMElement refparm2 = (OMElement) referenceParameters
+                    .get(new QName("http://example.com/fabrikam", "ShoppingCart"));
+            assertNotNull(refparm2);
+            assertEquals("ReferenceParameter value incorrect.", refparm2.getText(), "ABCDEFG");
+        } else {
+            fail("No ReferenceParameters found in EPR");
+        }
+    }
+
+    private void assertActionHasExtensibilityAttribute(MessageContext mc) {
+        boolean attributeFound = false;
+        ArrayList attributes = (ArrayList) mc.getProperty(AddressingConstants.ACTION_ATTRIBUTES);
+        if (attributes != null) {
             Iterator iter = attributes.iterator();
-            while(iter.hasNext()){
-                OMAttribute oa = (OMAttribute)iter.next();
-                if(oa.getLocalName().equals("AttrExt")){
+            while (iter.hasNext()) {
+                OMAttribute oa = (OMAttribute) iter.next();
+                if (oa.getLocalName().equals("AttrExt")) {
                     attributeFound = true;
-                    assertEquals("Attribute value incorrectly deserialised",oa.getAttributeValue(),"123456789");
+                    assertEquals("Attribute value incorrectly deserialised", oa.getAttributeValue(),
+                                 "123456789");
                 }
             }
         }
         assertTrue("Extensibility attribute not found on Action", attributeFound);
     }
-    
-    private void assertMessageIDHasExtensibilityAttribute(MessageContext mc){
-        boolean attributeFound=false;
-        ArrayList attributes = (ArrayList)mc.getProperty(AddressingConstants.MESSAGEID_ATTRIBUTES);
-        if(attributes!=null){
+
+    private void assertMessageIDHasExtensibilityAttribute(MessageContext mc) {
+        boolean attributeFound = false;
+        ArrayList attributes = (ArrayList) mc.getProperty(AddressingConstants.MESSAGEID_ATTRIBUTES);
+        if (attributes != null) {
             Iterator iter = attributes.iterator();
-            while(iter.hasNext()){
-                OMAttribute oa = (OMAttribute)iter.next();
-                if(oa.getLocalName().equals("AttrExt")){
+            while (iter.hasNext()) {
+                OMAttribute oa = (OMAttribute) iter.next();
+                if (oa.getLocalName().equals("AttrExt")) {
                     attributeFound = true;
-                    assertEquals("Attribute value incorrectly deserialised",oa.getAttributeValue(),"123456789");
+                    assertEquals("Attribute value incorrectly deserialised", oa.getAttributeValue(),
+                                 "123456789");
                 }
             }
         }
         assertTrue("Extensibility attribute not found on MessageID", attributeFound);
     }
-    
-    private void assertRelatesToHasExtensibilityAttribute(RelatesTo rt){
-        boolean attributeFound=false;
+
+    private void assertRelatesToHasExtensibilityAttribute(RelatesTo rt) {
+        boolean attributeFound = false;
         ArrayList attributes = rt.getExtensibilityAttributes();
-        if(attributes!=null){
+        if (attributes != null) {
             Iterator iter = attributes.iterator();
-            while(iter.hasNext()){
-                OMAttribute oa = (OMAttribute)iter.next();
-                if(oa.getLocalName().equals("AttrExt")){
+            while (iter.hasNext()) {
+                OMAttribute oa = (OMAttribute) iter.next();
+                if (oa.getLocalName().equals("AttrExt")) {
                     attributeFound = true;
-                    assertEquals("Attribute value incorrectly deserialised",oa.getAttributeValue(),"123456789");
+                    assertEquals("Attribute value incorrectly deserialised", oa.getAttributeValue(),
+                                 "123456789");
                 }
             }
         }
         assertTrue("Extensibility attribute not found on RelatesTo", attributeFound);
     }
-    
-    private void assertEPRAddressHasExtensibilityAttribute(EndpointReference epr){
-        boolean attributeFound=false;
+
+    private void assertEPRAddressHasExtensibilityAttribute(EndpointReference epr) {
+        boolean attributeFound = false;
         ArrayList attributes = epr.getAddressAttributes();
-        if(attributes!=null){
+        if (attributes != null) {
             Iterator iter = attributes.iterator();
-            while(iter.hasNext()){
-                OMAttribute oa = (OMAttribute)iter.next();
-                if(oa.getLocalName().equals("AttrExt")){
+            while (iter.hasNext()) {
+                OMAttribute oa = (OMAttribute) iter.next();
+                if (oa.getLocalName().equals("AttrExt")) {
                     attributeFound = true;
-                    assertEquals("Attribute value incorrectly deserialised",oa.getAttributeValue(),"123456789");
+                    assertEquals("Attribute value incorrectly deserialised", oa.getAttributeValue(),
+                                 "123456789");
                 }
             }
         }
         assertTrue("Extensibility attribute not found on EPR Address", attributeFound);
     }
-    
-    private void assertEPRHasExtensibilityAttribute(EndpointReference epr){
-    	boolean attributeFound=false;
-    	ArrayList attributes = epr.getAttributes();
-    	if(attributes!=null){
-	        Iterator iter = attributes.iterator();
-	        while(iter.hasNext()){
-	        	OMAttribute oa = (OMAttribute)iter.next();
-	        	if(oa.getLocalName().equals("AttrExt")){
-	        		attributeFound = true;
-	        		assertEquals("Attribute value incorrectly deserialised",oa.getAttributeValue(),"123456789");
-	        	}
-	        }
-    	}
+
+    private void assertEPRHasExtensibilityAttribute(EndpointReference epr) {
+        boolean attributeFound = false;
+        ArrayList attributes = epr.getAttributes();
+        if (attributes != null) {
+            Iterator iter = attributes.iterator();
+            while (iter.hasNext()) {
+                OMAttribute oa = (OMAttribute) iter.next();
+                if (oa.getLocalName().equals("AttrExt")) {
+                    attributeFound = true;
+                    assertEquals("Attribute value incorrectly deserialised", oa.getAttributeValue(),
+                                 "123456789");
+                }
+            }
+        }
         assertTrue("Extensibility attribute not found on EPR", attributeFound);
     }
-    
-    private void assertEPRHasCorrectExtensibilityElements(EndpointReference epr){
-    	ArrayList eelements = epr.getExtensibleElements();
-    	if(eelements != null){
-    		OMElement ee = (OMElement)eelements.get(0);
-    		assertEquals(ee.getQName(),new QName("http://ws.apache.org/namespaces/axis2","EPRExt"));
-    		assertEquals(ee.getText(),"123456789");
-    		assertEquals(ee.getAttributeValue(new QName("http://ws.apache.org/namespaces/axis2","AttrExt")),"123456789");
-    	}else{
-    		fail("No Extensibility Elements found in EPR");
-    	}
+
+    private void assertEPRHasCorrectExtensibilityElements(EndpointReference epr) {
+        ArrayList eelements = epr.getExtensibleElements();
+        if (eelements != null) {
+            OMElement ee = (OMElement) eelements.get(0);
+            assertEquals(ee.getQName(),
+                         new QName("http://ws.apache.org/namespaces/axis2", "EPRExt"));
+            assertEquals(ee.getText(), "123456789");
+            assertEquals(ee.getAttributeValue(
+                    new QName("http://ws.apache.org/namespaces/axis2", "AttrExt")), "123456789");
+        } else {
+            fail("No Extensibility Elements found in EPR");
+        }
     }
-    
+
     private void assertRelationships(Options options) {
         assertNotNull(options.getRelatesTo());
         assertRelatesToHasExtensibilityAttribute(options.getRelatesTo());
-    	assertEquals(options.getRelatesTo().getValue(),"http://some.previous.message");
-    	assertEquals(options.getRelatesTo(secondRelationshipType).getValue(),"http://identifier.of.other.message/");
-	}
+        assertEquals(options.getRelatesTo().getValue(), "http://some.previous.message");
+        assertEquals(options.getRelatesTo(secondRelationshipType).getValue(),
+                     "http://identifier.of.other.message/");
+    }
 }

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java?view=diff&rev=516227&r1=516226&r2=516227
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java Thu Mar  8 15:33:43 2007
@@ -16,9 +16,6 @@
 
 package org.apache.axis2.handlers.addressing;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-
 import junit.framework.TestCase;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMAttribute;
@@ -28,17 +25,17 @@
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
-import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.handlers.util.TestUtil;
 
 import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 public class AddressingOutHandlerTest extends TestCase implements AddressingConstants {
     private AddressingOutHandler outHandler;
@@ -57,12 +54,14 @@
     }
 
     public void testAddToSOAPHeader() throws Exception {
-        EndpointReference replyTo = new EndpointReference("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
+        EndpointReference replyTo = new EndpointReference(
+                "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
         EndpointReference epr = new EndpointReference("http://www.to.org/service/");
 
         for (int i = 0; i < 5; i++) {
             epr.addReferenceParameter(
-                    new QName(Submission.WSA_NAMESPACE, "Reference" + i, AddressingConstants.WSA_DEFAULT_PREFIX),
+                    new QName(Submission.WSA_NAMESPACE, "Reference" + i,
+                              AddressingConstants.WSA_DEFAULT_PREFIX),
                     "Value " + i * 100);
 
         }
@@ -79,14 +78,19 @@
         msgCtxt.setEnvelope(defaultEnvelope);
         msgCtxt.setWSAAction("http://www.actions.org/action");
         msgCtxt.setMessageID("urn:test:123");
-        
-        OMAttribute extAttr = OMAbstractFactory.getOMFactory().createOMAttribute("AttrExt", OMAbstractFactory.getOMFactory().createOMNamespace("http://ws.apache.org/namespaces/axis2", "axis2"), "123456789");
+
+        OMAttribute extAttr = OMAbstractFactory.getOMFactory().createOMAttribute("AttrExt",
+                                                                                 OMAbstractFactory
+                                                                                         .getOMFactory().createOMNamespace(
+                                                                                         "http://ws.apache.org/namespaces/axis2",
+                                                                                         "axis2"),
+                                                                                 "123456789");
         ArrayList al = new ArrayList();
         al.add(extAttr);
-        
+
         msgCtxt.setProperty(AddressingConstants.ACTION_ATTRIBUTES, al);
         msgCtxt.setProperty(AddressingConstants.MESSAGEID_ATTRIBUTES, al);
-        
+
         outHandler.invoke(msgCtxt);
 
         StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder("eprTest.xml");
@@ -95,16 +99,17 @@
 
         assertTrue(
                 xmlComparator.compare(omBuilder.getDocumentElement(),
-                        defaultEnvelope));
+                                      defaultEnvelope));
 
     }
 
     public void testHeaderCreationFromMsgCtxtInformation() throws Exception {
-        msgCtxt = ContextFactory.createMessageContext(ConfigurationContextFactory.createDefaultConfigurationContext());
+        msgCtxt = ContextFactory.createMessageContext(
+                ConfigurationContextFactory.createDefaultConfigurationContext());
 
         EndpointReference epr = new EndpointReference("http://www.from.org/service/");
         epr.addReferenceParameter(new QName("Reference2"),
-                "Value 200");
+                                  "Value 200");
         msgCtxt.setFrom(epr);
 
         epr = new EndpointReference("http://www.to.org/service/");
@@ -135,18 +140,20 @@
         XMLComparator xmlComparator = new XMLComparator();
         assertTrue(
                 xmlComparator.compare(msgCtxt.getEnvelope(),
-                        testUtil.getOMBuilder("OutHandlerTest.xml")
-                .getDocumentElement()));
+                                      testUtil.getOMBuilder("OutHandlerTest.xml")
+                                              .getDocumentElement()));
     }
 
     public void testMustUnderstandSupport() throws Exception {
-        msgCtxt = ContextFactory.createMessageContext(ConfigurationContextFactory.createDefaultConfigurationContext());
+        msgCtxt = ContextFactory.createMessageContext(
+                ConfigurationContextFactory.createDefaultConfigurationContext());
+
+        msgCtxt.setProperty(AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS,
+                            Boolean.TRUE);
 
-        msgCtxt.setProperty(AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS, Boolean.TRUE);
-        
         EndpointReference epr = new EndpointReference("http://www.from.org/service/");
         epr.addReferenceParameter(new QName("Reference2"),
-                "Value 200");
+                                  "Value 200");
         msgCtxt.setFrom(epr);
 
         epr = new EndpointReference("http://www.to.org/service/");
@@ -177,8 +184,8 @@
         XMLComparator xmlComparator = new XMLComparator();
         assertTrue(
                 xmlComparator.compare(msgCtxt.getEnvelope(),
-                        testUtil.getOMBuilder("mustUnderstandTest.xml")
-                .getDocumentElement()));
+                                      testUtil.getOMBuilder("mustUnderstandTest.xml")
+                                              .getDocumentElement()));
     }
 
     public void testDuplicateHeaders() throws Exception {
@@ -187,7 +194,8 @@
         EndpointReference eprOne = new EndpointReference("http://whatever.org");
         EndpointReference duplicateEpr = new EndpointReference("http://whatever.duplicate.org");
         RelatesTo reply = new RelatesTo("urn:id");
-        msgCtxt = ContextFactory.createMessageContext(ConfigurationContextFactory.createDefaultConfigurationContext());
+        msgCtxt = ContextFactory.createMessageContext(
+                ConfigurationContextFactory.createDefaultConfigurationContext());
         SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
         SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();
         msgCtxt.setEnvelope(defaultEnvelope);
@@ -202,8 +210,10 @@
         msgCtxt.setTo(duplicateEpr);
         outHandler.invoke(msgCtxt);
 
-        assertEquals("http://whatever.org", defaultEnvelope.getHeader().getFirstChildWithName(new QName(WSA_TO)).getText());
-        Iterator iterator = defaultEnvelope.getHeader().getChildrenWithName(new QName(WSA_RELATES_TO));
+        assertEquals("http://whatever.org", defaultEnvelope.getHeader()
+                .getFirstChildWithName(new QName(WSA_TO)).getText());
+        Iterator iterator =
+                defaultEnvelope.getHeader().getChildrenWithName(new QName(WSA_RELATES_TO));
         int i = 0;
         while (iterator.hasNext()) {
             iterator.next();
@@ -217,20 +227,23 @@
         // this will check whether we can add to epr, if there is one already.
         EndpointReference eprOne = new EndpointReference("http://whatever.org");
         RelatesTo custom = new RelatesTo("urn:id", "customRelationship");
-        msgCtxt = ContextFactory.createMessageContext(ConfigurationContextFactory.createDefaultConfigurationContext());
+        msgCtxt = ContextFactory.createMessageContext(
+                ConfigurationContextFactory.createDefaultConfigurationContext());
         SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
         SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();
-        OMNamespace addressingNamespace = factory.createOMNamespace(Final.WSA_NAMESPACE, WSA_DEFAULT_PREFIX);
+        OMNamespace addressingNamespace =
+                factory.createOMNamespace(Final.WSA_NAMESPACE, WSA_DEFAULT_PREFIX);
         SOAPHeaderBlock soapHeaderBlock =
                 defaultEnvelope.getHeader().addHeaderBlock(WSA_TO, addressingNamespace);
         soapHeaderBlock.setText("http://oldEPR.org");
         soapHeaderBlock =
-            defaultEnvelope.getHeader().addHeaderBlock(WSA_RELATES_TO, addressingNamespace);
+                defaultEnvelope.getHeader().addHeaderBlock(WSA_RELATES_TO, addressingNamespace);
         soapHeaderBlock.setText("urn:id");
         soapHeaderBlock =
-            defaultEnvelope.getHeader().addHeaderBlock(WSA_RELATES_TO, addressingNamespace);
+                defaultEnvelope.getHeader().addHeaderBlock(WSA_RELATES_TO, addressingNamespace);
         soapHeaderBlock.setText("urn:id");
-        soapHeaderBlock.addAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE, custom.getRelationshipType(), null);
+        soapHeaderBlock
+                .addAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE, custom.getRelationshipType(), null);
         msgCtxt.setEnvelope(defaultEnvelope);
 
         msgCtxt.setProperty(REPLACE_ADDRESSING_HEADERS, Boolean.TRUE);
@@ -239,8 +252,10 @@
         msgCtxt.setWSAAction("http://www.actions.org/action");
         outHandler.invoke(msgCtxt);
 
-        assertEquals("http://whatever.org", defaultEnvelope.getHeader().getFirstChildWithName(new QName(WSA_TO)).getText());
-        Iterator iterator = defaultEnvelope.getHeader().getChildrenWithName(new QName(WSA_RELATES_TO));
+        assertEquals("http://whatever.org", defaultEnvelope.getHeader()
+                .getFirstChildWithName(new QName(WSA_TO)).getText());
+        Iterator iterator =
+                defaultEnvelope.getHeader().getChildrenWithName(new QName(WSA_RELATES_TO));
         int i = 0;
         while (iterator.hasNext()) {
             iterator.next();
@@ -254,15 +269,17 @@
         // this will check whether we can add to epr, if there is one already.
         EndpointReference eprOne = new EndpointReference("http://whatever.org");
         RelatesTo custom = new RelatesTo("urn:id", "customRelationship");
-        msgCtxt = ContextFactory.createMessageContext(ConfigurationContextFactory.createDefaultConfigurationContext());
+        msgCtxt = ContextFactory.createMessageContext(
+                ConfigurationContextFactory.createDefaultConfigurationContext());
         SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
         SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();
-        OMNamespace addressingNamespace = factory.createOMNamespace(Final.WSA_NAMESPACE, WSA_DEFAULT_PREFIX);
+        OMNamespace addressingNamespace =
+                factory.createOMNamespace(Final.WSA_NAMESPACE, WSA_DEFAULT_PREFIX);
         SOAPHeaderBlock soapHeaderBlock =
                 defaultEnvelope.getHeader().addHeaderBlock(WSA_TO, addressingNamespace);
         soapHeaderBlock.setText("http://oldEPR.org");
         soapHeaderBlock =
-            defaultEnvelope.getHeader().addHeaderBlock(WSA_RELATES_TO, addressingNamespace);
+                defaultEnvelope.getHeader().addHeaderBlock(WSA_RELATES_TO, addressingNamespace);
         soapHeaderBlock.setText("urn:id");
         msgCtxt.setEnvelope(defaultEnvelope);
 
@@ -272,8 +289,10 @@
         msgCtxt.setWSAAction("http://www.actions.org/action");
         outHandler.invoke(msgCtxt);
 
-        assertEquals("http://oldEPR.org", defaultEnvelope.getHeader().getFirstChildWithName(new QName(WSA_TO)).getText());
-        Iterator iterator = defaultEnvelope.getHeader().getChildrenWithName(new QName(WSA_RELATES_TO));
+        assertEquals("http://oldEPR.org", defaultEnvelope.getHeader()
+                .getFirstChildWithName(new QName(WSA_TO)).getText());
+        Iterator iterator =
+                defaultEnvelope.getHeader().getChildrenWithName(new QName(WSA_RELATES_TO));
         int i = 0;
         while (iterator.hasNext()) {
             iterator.next();

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java?view=diff&rev=516227&r1=516226&r2=516227
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandlerTest.java Thu Mar  8 15:33:43 2007
@@ -26,10 +26,8 @@
 public class AddressingSubmissionInHandlerTest extends AddressingInHandlerTestBase {
 
     private Log log = LogFactory.getLog(getClass());
-   
-    /**
-     * @param testName
-     */
+
+    /** @param testName  */
     public AddressingSubmissionInHandlerTest(String testName) {
         super(testName);
     }
@@ -53,7 +51,7 @@
             fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedAction() {
         try {
             testMessageWithOmittedHeaders("noAction");
@@ -65,15 +63,15 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedFaultTo() {
         try {
             Options options = testMessageWithOmittedHeaders("noFaultTo");
             EndpointReference epr = options.getFaultTo();
-            
+
             assertNull("The FaultTo endpoint reference is not null.", epr);
         }
         catch (AxisFault af) {
@@ -84,15 +82,15 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedFrom() {
         try {
             Options options = testMessageWithOmittedHeaders("noFrom");
             EndpointReference epr = options.getFrom();
-            
+
             assertNull("The From endpoint reference is not null.", epr);
         }
         catch (AxisFault af) {
@@ -103,10 +101,10 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedMessageID() {
         try {
             testMessageWithOmittedHeaders("noMessageID");
@@ -118,15 +116,15 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedMessageIDReplyToAndFaultTo() {
         try {
             Options options = testMessageWithOmittedHeaders("noMessageIDNoReplyToNoFaultTo");
             String messageID = options.getMessageId();
-            
+
             assertNull("The message id is not null.", messageID);
         }
         catch (AxisFault af) {
@@ -137,17 +135,18 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedReplyTo() {
         try {
             Options options = testMessageWithOmittedHeaders("noReplyTo");
             EndpointReference epr = options.getReplyTo();
             String address = epr.getAddress();
-            
-            assertEquals("The address of the ReplyTo endpoint reference is not the none URI.", AddressingConstants.Final.WSA_NONE_URI, address);
+
+            assertEquals("The address of the ReplyTo endpoint reference is not the none URI.",
+                         AddressingConstants.Final.WSA_NONE_URI, address);
         }
         catch (AxisFault af) {
             af.printStackTrace();
@@ -157,10 +156,10 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedTo() {
         try {
             testMessageWithOmittedHeaders("noTo");
@@ -172,7 +171,7 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
 }

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java?view=diff&rev=516227&r1=516226&r2=516227
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java Thu Mar  8 15:33:43 2007
@@ -16,10 +16,7 @@
 
 package org.apache.axis2.handlers.addressing;
 
-import java.util.ArrayList;
-
 import junit.framework.TestCase;
-
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
@@ -34,6 +31,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import java.util.ArrayList;
+
 public class AddressingValidationHandlerTest extends TestCase {
     private Log log = LogFactory.getLog(getClass());
     AddressingInHandler inHandler = new AddressingFinalInHandler();
@@ -41,34 +40,38 @@
     String addressingNamespace = AddressingConstants.Final.WSA_NAMESPACE;
     String versionDirectory = "final";
     TestUtil testUtil = new TestUtil();
-    
-    protected void basicExtractAddressingInformationFromHeaders(String testMessagePath, MessageContext mc) throws Exception{
+
+    protected void basicExtractAddressingInformationFromHeaders(String testMessagePath,
+                                                                MessageContext mc)
+            throws Exception {
         StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder(testMessagePath);
         SOAPHeader header = ((SOAPEnvelope) omBuilder.getDocumentElement()).getHeader();
         ArrayList addressingHeaderBlocks = header.getHeaderBlocksWithNSURI(addressingNamespace);
-        inHandler.extractAddressingInformation(header, mc, addressingHeaderBlocks, addressingNamespace);
+        inHandler.extractAddressingInformation(header, mc, addressingHeaderBlocks,
+                                               addressingNamespace);
     }
-    
+
     protected MessageContext testMessageWithOmittedHeaders(String testName) throws Exception {
-        String testfile = "omitted-header-messages/"+versionDirectory+"/"+testName+"Message.xml";
-        
+        String testfile =
+                "omitted-header-messages/" + versionDirectory + "/" + testName + "Message.xml";
+
         MessageContext mc = new MessageContext();
         basicExtractAddressingInformationFromHeaders(testfile, mc);
-        
+
         return mc;
     }
-    
+
     public void testMessageWithOmittedMessageIDInOutMEP() {
         try {
             MessageContext messageContext = testMessageWithOmittedHeaders("noMessageID");
             String messageID = messageContext.getOptions().getMessageId();
-            
+
             assertNull("The message id is not null.", messageID);
-            
+
             messageContext.setProperty(AddressingConstants.IS_ADDR_INFO_ALREADY_PROCESSED,
-                    Boolean.TRUE);
+                                       Boolean.TRUE);
             messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
-                    AddressingConstants.Final.WSA_NAMESPACE);
+                                       AddressingConstants.Final.WSA_NAMESPACE);
             AxisOperation axisOperation = new InOutAxisOperation();
             messageContext.setAxisOperation(axisOperation);
             AxisService axisService = new AxisService();
@@ -82,21 +85,21 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedMessageIDInOnlyMEP() {
         try {
             MessageContext messageContext = testMessageWithOmittedHeaders("noMessageID");
             String messageID = messageContext.getOptions().getMessageId();
-            
+
             assertNull("The message id is not null.", messageID);
-            
+
             messageContext.setProperty(AddressingConstants.IS_ADDR_INFO_ALREADY_PROCESSED,
-                    Boolean.TRUE);
+                                       Boolean.TRUE);
             messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
-                    AddressingConstants.Final.WSA_NAMESPACE);
+                                       AddressingConstants.Final.WSA_NAMESPACE);
             AxisOperation axisOperation = new InOnlyAxisOperation();
             messageContext.setAxisOperation(axisOperation);
             AxisService axisService = new AxisService();
@@ -111,21 +114,21 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithMessageIDInOutMEP() {
         try {
             MessageContext messageContext = testMessageWithOmittedHeaders("noFrom");
             String messageID = messageContext.getOptions().getMessageId();
-            
+
             assertNotNull("The message id is null.", messageID);
-            
+
             messageContext.setProperty(AddressingConstants.IS_ADDR_INFO_ALREADY_PROCESSED,
-                    Boolean.TRUE);
+                                       Boolean.TRUE);
             messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
-                    AddressingConstants.Final.WSA_NAMESPACE);
+                                       AddressingConstants.Final.WSA_NAMESPACE);
             AxisOperation axisOperation = new InOutAxisOperation();
             messageContext.setAxisOperation(axisOperation);
             AxisService axisService = new AxisService();
@@ -140,21 +143,21 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
-    
+
     public void testMessageWithOmittedMessageID200408() {
         try {
             MessageContext messageContext = testMessageWithOmittedHeaders("noMessageID");
             String messageID = messageContext.getOptions().getMessageId();
-            
+
             assertNull("The message id is not null.", messageID);
-            
+
             messageContext.setProperty(AddressingConstants.IS_ADDR_INFO_ALREADY_PROCESSED,
-                    Boolean.TRUE);
+                                       Boolean.TRUE);
             messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
-                    AddressingConstants.Submission.WSA_NAMESPACE);
+                                       AddressingConstants.Submission.WSA_NAMESPACE);
             AxisOperation axisOperation = new InOutAxisOperation();
             messageContext.setAxisOperation(axisOperation);
             AxisService axisService = new AxisService();
@@ -169,7 +172,7 @@
         catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            fail(" An Exception has occured " + e.getMessage());            
+            fail(" An Exception has occured " + e.getMessage());
         }
     }
 }

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java?view=diff&rev=516227&r1=516226&r2=516227
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java Thu Mar  8 15:33:43 2007
@@ -16,8 +16,8 @@
 
 package org.apache.axis2.handlers.util;
 
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 
 import javax.xml.stream.XMLStreamReader;
 import java.io.File;
@@ -27,7 +27,7 @@
 
     protected static final String IN_FILE_NAME = "soapmessage.xml";
     protected StAXSOAPModelBuilder builder;
-    protected String testResourceDir = System.getProperty("basedir",".")+"/"+"test-resources";
+    protected String testResourceDir = System.getProperty("basedir", ".") + "/" + "test-resources";
 
 
     public StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message