Return-Path: Delivered-To: apmail-ws-axis-cvs-archive@www.apache.org Received: (qmail 81760 invoked from network); 24 Oct 2007 20:33:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Oct 2007 20:33:51 -0000 Received: (qmail 41324 invoked by uid 500); 24 Oct 2007 20:33:38 -0000 Delivered-To: apmail-ws-axis-cvs-archive@ws.apache.org Received: (qmail 41218 invoked by uid 500); 24 Oct 2007 20:33:38 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 41207 invoked by uid 500); 24 Oct 2007 20:33:38 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 41194 invoked by uid 99); 24 Oct 2007 20:33:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Oct 2007 13:33:37 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Oct 2007 20:33:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AFE481A9838; Wed, 24 Oct 2007 13:32:59 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: axis2-cvs@ws.apache.org From: barrettj@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071024203259.AFE481A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ + + + 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 @@ + + + + + + ##SOAP11_HTTP ##something blarg + ns1:AddNumbersHandlerP* + ns1:* + + org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersLogicalHandler + + + org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersProtocolHandler2 + + + org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersLogicalHandler2 + + + org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersProtocolHandler + + + + --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org