ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From barre...@apache.org
Subject svn commit: r588008 - in /webservices/axis2/trunk/java/modules/metadata: pom.xml test/org/apache/axis2/jaxws/description/HandlerChainConfigFileTests.java test/org/apache/axis2/jaxws/description/HandlerConfigFile.xml
Date Wed, 24 Oct 2007 20:32:58 GMT
Author: barrettj
Date: Wed Oct 24 13:32:58 2007
New Revision: 588008

URL: http://svn.apache.org/viewvc?rev=588008&view=rev
Log:
Add test to validate correct HandlerChain annotation Configuration file processing when file
can and can not be found.

Added:
    webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerChainConfigFileTests.java
    webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerConfigFile.xml
Modified:
    webservices/axis2/trunk/java/modules/metadata/pom.xml

Modified: webservices/axis2/trunk/java/modules/metadata/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/pom.xml?rev=588008&r1=588007&r2=588008&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/metadata/pom.xml Wed Oct 24 13:32:58 2007
@@ -140,6 +140,9 @@
 									<fileset dir="test-resources/">
 										<include name="**/*.properties"/>
 									</fileset>
+									<fileset dir="test">
+										<include name="org/apache/axis2/jaxws/description/HandlerConfigFile.xml"/>
+									</fileset>
 								</copy>
 							</tasks>
 						</configuration>

Added: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerChainConfigFileTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerChainConfigFileTests.java?rev=588008&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerChainConfigFileTests.java
(added)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerChainConfigFileTests.java
Wed Oct 24 13:32:58 2007
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.description;
+
+import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceException;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ */
+public class HandlerChainConfigFileTests extends TestCase {
+    public void testValidConfigFile() {
+        ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(ValidConfigFileImpl.class);
+        EndpointDescription[] epDescs = svcDesc.getEndpointDescriptions();
+        assertEquals(1, epDescs.length);
+        EndpointDescription epDesc = epDescs[0];
+        HandlerChainsType hct = epDesc.getHandlerChain();
+        assertNotNull(hct);
+    }
+    
+    public void testMissingRelativeConfigFile() {
+        try {
+            ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(InvalidConfigFileImpl.class);
+            EndpointDescription[] epDescs = svcDesc.getEndpointDescriptions();
+            assertEquals(1, epDescs.length);
+            EndpointDescription epDesc = epDescs[0];
+            HandlerChainsType hct = epDesc.getHandlerChain();
+            fail("Should have caught exception for a missing handler config file");
+        }
+        catch (WebServiceException e) {
+            // Expected path        }
+            String message = e.toString();
+        }
+        catch (Exception e) {
+            fail("Expected a WebServiceException, but caught: " + e);
+        }
+    }
+
+    public void testMissingAbsoluteConfigFile() {
+        try {
+            ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(InvalidAbsoluteConfigFileImpl.class);
+            EndpointDescription[] epDescs = svcDesc.getEndpointDescriptions();
+            assertEquals(1, epDescs.length);
+            EndpointDescription epDesc = epDescs[0];
+            HandlerChainsType hct = epDesc.getHandlerChain();
+            fail("Should have caught exception for a missing handler config file");
+        }
+        catch (WebServiceException e) {
+            // Expected path.  We can't check for explicit details in this case because which
failure
+            // occurs depends on the enivronment.  Some get "ConnectionRefused" and some
get "FileNotFound".
+            String message = e.toString();
+        }
+        catch (Exception e) {
+            fail("Expected a WebServiceException, but caught: " + e);
+        }
+    }
+
+}
+
+@WebService()
+@HandlerChain(file = "HandlerConfigFile.xml")
+class ValidConfigFileImpl {
+    
+}
+
+@WebService()
+@HandlerChain(file = "MissingHandlerConfigFile.xml")
+class InvalidConfigFileImpl {
+    
+}
+
+@WebService()
+@HandlerChain(file = "http://localhost/will/not/find/MissingHandlerConfigFile.xml")
+class InvalidAbsoluteConfigFileImpl {
+    
+}

Added: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerConfigFile.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerConfigFile.xml?rev=588008&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerConfigFile.xml
(added)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/HandlerConfigFile.xml
Wed Oct 24 13:32:58 2007
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+
+	<jws:handler-chain name="LoggingHandlerChain">
+		<jws:protocol-bindings>##SOAP11_HTTP ##something blarg</jws:protocol-bindings>
+		<jws:port-name-pattern 
+              xmlns:ns1="http://addnumbershandler.sample.jaxws.axis2.apache.org/">ns1:AddNumbersHandlerP*</jws:port-name-pattern>
+        <jws:service-name-pattern 
+              xmlns:ns1="http://addnumbershandler.sample.jaxws.axis2.apache.org/">ns1:*</jws:service-name-pattern>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersLogicalHandler</jws:handler-class>
+		</jws:handler>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersProtocolHandler2</jws:handler-class>
+		</jws:handler>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersLogicalHandler2</jws:handler-class>
+		</jws:handler>
+		<jws:handler>
+			<jws:handler-class>org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersProtocolHandler</jws:handler-class>
+		</jws:handler>
+	</jws:handler-chain>
+	
+</jws:handler-chains>



---------------------------------------------------------------------
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