You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/12/28 13:28:19 UTC
svn commit: r607222 - in /incubator/cxf/trunk:
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/
rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/
systests/src/test/java/org/...
Author: jliu
Date: Fri Dec 28 04:28:18 2007
New Revision: 607222
URL: http://svn.apache.org/viewvc?rev=607222&view=rev
Log:
Configure JAX-WS handlers per port per service.
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml (with props)
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=607222&r1=607221&r2=607222&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java Fri Dec 28 04:28:18 2007
@@ -171,9 +171,10 @@
*/
private void buildHandlerChain() {
AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
-
- List<Handler> chain = builder.buildHandlerChainFromClass(getServiceBeanClass(),
- getEndpointName());
+ JaxWsServiceFactoryBean sf = (JaxWsServiceFactoryBean)getServiceFactory();
+
+ List<Handler> chain = builder.buildHandlerChainFromClass(getServiceBeanClass(), sf.getEndpointInfo()
+ .getName(), sf.getServiceQName());
for (Handler h : chain) {
injectResources(h);
}
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java?rev=607222&r1=607221&r2=607222&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java Fri Dec 28 04:28:18 2007
@@ -60,7 +60,7 @@
* @return
*/
public List<Handler> buildHandlerChainFromClass(Class<?> clz, List<Handler> existingHandlers,
- QName endpointName) {
+ QName portQName, QName serviceQName) {
LOG.fine("building handler chain");
HandlerChainAnnotation hcAnn = findHandlerChainAnnotation(clz, true);
List<Handler> chain = null;
@@ -94,11 +94,19 @@
for (HandlerChainType hc : handlerChainsType.getHandlerChain()) {
//Only add handlers if <port-name-pattern> is not presented or is matched.
//TODO: match the namespace, match the wild card etc. JSR-181, Appendix B.
- if (hc.getPortNamePattern() != null && endpointName != null) {
+ if (hc.getPortNamePattern() != null && portQName != null) {
String portNamePattern = hc.getPortNamePattern();
String localPart = portNamePattern.substring(portNamePattern.indexOf(':') + 1,
portNamePattern.length());
- if (!localPart.equals(endpointName.getLocalPart())) {
+ if (!localPart.equals(portQName.getLocalPart())) {
+ continue;
+ }
+ }
+ if (hc.getServiceNamePattern() != null && serviceQName != null) {
+ String serviceNamePattern = hc.getServiceNamePattern();
+ String localPart = serviceNamePattern.substring(serviceNamePattern.indexOf(':') + 1,
+ serviceNamePattern.length());
+ if (!localPart.equals(serviceQName.getLocalPart())) {
continue;
}
}
@@ -116,14 +124,14 @@
return sortHandlers(chain);
}
+ public List<Handler> buildHandlerChainFromClass(Class<?> clz, QName portQName, QName serviceQName) {
+ return buildHandlerChainFromClass(clz, null, portQName, serviceQName);
+ }
+
protected URL resolveHandlerChainAnnotationFile(Class clazz, String name) {
return clazz.getResource(name);
}
-
- public List<Handler> buildHandlerChainFromClass(Class<?> clz, QName endpointName) {
- return buildHandlerChainFromClass(clz, null, endpointName);
- }
-
+
public List<Handler> buildHandlerChainFromClass(Class<?> clz) {
return buildHandlerChainFromClass(clz, null, null);
}
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java?rev=607222&r1=607221&r2=607222&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java Fri Dec 28 04:28:18 2007
@@ -69,7 +69,7 @@
chain = new ArrayList<Handler>();
}
if (annotationClass != null) {
- chain.addAll(getHandlersFromAnnotation(annotationClass));
+ chain.addAll(getHandlersFromAnnotation(annotationClass, portInfo));
}
for (Handler h : chain) {
@@ -85,11 +85,12 @@
* @param obj A endpoint implementation class or a SEI, or a generated
* service class.
*/
- private List<Handler> getHandlersFromAnnotation(Class<?> clazz) {
+ private List<Handler> getHandlersFromAnnotation(Class<?> clazz, PortInfo portInfo) {
AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
- List<Handler> chain = builder.buildHandlerChainFromClass(clazz);
-
+ List<Handler> chain = builder.buildHandlerChainFromClass(clazz, portInfo != null ? portInfo
+ .getPortName() : null, portInfo != null ? portInfo.getServiceName() : null);
+
return chain;
}
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java?rev=607222&r1=607221&r2=607222&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java Fri Dec 28 04:28:18 2007
@@ -46,23 +46,38 @@
AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass());
assertNotNull(handlers);
- assertEquals(5, handlers.size());
+ assertEquals(7, handlers.size());
assertEquals(TestLogicalHandler.class, handlers.get(0).getClass());
assertEquals(TestLogicalHandler.class, handlers.get(1).getClass());
assertEquals(TestLogicalHandler.class, handlers.get(2).getClass());
assertEquals(TestLogicalHandler.class, handlers.get(3).getClass());
- assertEquals(TestProtocolHandler.class, handlers.get(4).getClass());
+ assertEquals(TestLogicalHandler.class, handlers.get(4).getClass());
+ assertEquals(TestLogicalHandler.class, handlers.get(5).getClass());
+ assertEquals(TestProtocolHandler.class, handlers.get(6).getClass());
}
@Test
- public void testFindHandlerChainAnnotationPerPort() {
+ public void testFindHandlerChainAnnotationPerPortPerService() {
HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
- QName portName = new QName("namespacedoesntsupportyet", "SoapPort1");
+ QName portQName = new QName("namespacedoesntsupportyet", "SoapPort1");
+ QName serviceQName = new QName("namespacedoesntsupportyet", "SoapService1");
List<Handler> handlers = chainBuilder
- .buildHandlerChainFromClass(handlerTestImpl.getClass(), portName);
+ .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName);
assertNotNull(handlers);
- assertEquals(5, handlers.size());
+ assertEquals(7, handlers.size());
+ }
+
+ @Test
+ public void testFindHandlerChainAnnotationPerPortPerServiceNegative() {
+ HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
+ AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
+ QName portQName = new QName("namespacedoesntsupportyet", "SoapPortUnknown");
+ QName serviceQName = new QName("namespacedoesntsupportyet", "SoapServiceUnknown");
+ List<Handler> handlers = chainBuilder
+ .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName);
+ assertNotNull(handlers);
+ assertEquals(3, handlers.size());
}
public static class TestLogicalHandler implements LogicalHandler {
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml?rev=607222&r1=607221&r2=607222&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml Fri Dec 28 04:28:18 2007
@@ -70,4 +70,23 @@
</handler-class>
</handler>
</handler-chain>
+
+ <handler-chain>
+ <service-name-pattern
+ xmlns:ns1="http://apache.org/handler_test">
+ ns1:SoapService1
+ </service-name-pattern>
+ <handler>
+ <handler-name>Handler1</handler-name>
+ <handler-class>
+ org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
+ </handler-class>
+ </handler>
+ <handler>
+ <handler-name>Handler2</handler-name>
+ <handler-class>
+ org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
+ </handler-class>
+ </handler>
+ </handler-chain>
</handler-chains>
Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=607222&r1=607221&r2=607222&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java Fri Dec 28 04:28:18 2007
@@ -30,6 +30,7 @@
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
+import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Dispatch;
import javax.xml.ws.LogicalMessage;
@@ -106,6 +107,17 @@
assertEquals(1, handler2.getHandleMessageInvoked());
}
+ @Test
+ public void testAddingUnusedHandlersThroughConfigFile() {
+ HandlerTestServiceWithAnnotation service1 = new HandlerTestServiceWithAnnotation(wsdl, serviceName);
+ HandlerTest handlerTest1 = service1.getPort(portName, HandlerTest.class);
+
+ BindingProvider bp1 = (BindingProvider)handlerTest1;
+ Binding binding1 = bp1.getBinding();
+ List<Handler> port1HandlerChain = binding1.getHandlerChain();
+ assertEquals(0, port1HandlerChain.size());
+ }
+
@Test
public void testLogicalHandlerOneWay() {
TestHandler<LogicalMessageContext> handler1 = new TestHandler<LogicalMessageContext>(false);
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java?rev=607222&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java Fri Dec 28 04:28:18 2007
@@ -0,0 +1,112 @@
+/**
+ * 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.cxf.systest.handlers;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.jws.HandlerChain;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceFeature;
+
+import org.apache.handler_test.HandlerTest;
+import org.apache.handler_test.HandlerTest1;
+
+/**
+ * This class was generated by Apache CXF (incubator) 2.1-incubator-SNAPSHOT Tue
+ * Dec 25 12:27:03 CST 2007 Generated source version: 2.1-incubator-SNAPSHOT
+ */
+
+@WebServiceClient(name = "HandlerTestService",
+ targetNamespace = "http://apache.org/handler_test",
+ wsdlLocation = "file:/D:/svn/cxf/trunk/testutils/src/main/resources/wsdl/handler_test.wsdl")
+@HandlerChain(file = "./handlers_invocation_testunused.xml", name = "TestHandlerChain")
+public class HandlerTestServiceWithAnnotation extends Service {
+
+ static {
+ URL url = null;
+ try {
+ url = new URL("file:/D:/svn/cxf/trunk/testutils/src/main/resources/wsdl/handler_test.wsdl");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ WSDL_LOCATION = url;
+ }
+
+ public static final QName SERVICE = new QName("http://apache.org/handler_test", "HandlerTestService");
+ public static final QName SOAPPORT = new QName("http://apache.org/handler_test", "SoapPort");
+ public static final QName SOAPPORT1 = new QName("http://apache.org/handler_test", "SoapPort1");
+ public static final URL WSDL_LOCATION;
+
+ public HandlerTestServiceWithAnnotation(URL wsdlLocation) {
+ super(wsdlLocation, SERVICE);
+ }
+
+ public HandlerTestServiceWithAnnotation(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public HandlerTestServiceWithAnnotation() {
+ super(WSDL_LOCATION, SERVICE);
+ }
+
+ /**
+ * @return returns HandlerTest
+ */
+ @WebEndpoint(name = "SoapPort")
+ public HandlerTest getSoapPort() {
+ return (HandlerTest)super.getPort(SOAPPORT, HandlerTest.class);
+ }
+
+ /**
+ * @param features A list of {@link javax.xml.ws.WebServiceFeature} to
+ * configure on the proxy. Supported features not in the
+ * <code>features</code> parameter will have their default
+ * values.
+ * @return returns HandlerTest
+ */
+ @WebEndpoint(name = "SoapPort")
+ public HandlerTest getSoapPort(WebServiceFeature... features) {
+ return (HandlerTest)super.getPort(SOAPPORT, HandlerTest.class, features);
+ }
+
+ /**
+ * @return returns HandlerTest1
+ */
+ @WebEndpoint(name = "SoapPort1")
+ public HandlerTest1 getSoapPort1() {
+ return (HandlerTest1)super.getPort(SOAPPORT1, HandlerTest1.class);
+ }
+
+ /**
+ * @param features A list of {@link javax.xml.ws.WebServiceFeature} to
+ * configure on the proxy. Supported features not in the
+ * <code>features</code> parameter will have their default
+ * values.
+ * @return returns HandlerTest1
+ */
+ @WebEndpoint(name = "SoapPort1")
+ public HandlerTest1 getSoapPort1(WebServiceFeature... features) {
+ return (HandlerTest1)super.getPort(SOAPPORT1, HandlerTest1.class, features);
+ }
+
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java?rev=607222&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java Fri Dec 28 04:28:18 2007
@@ -0,0 +1,66 @@
+/**
+ * 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.cxf.systest.handlers;
+
+import java.util.Map;
+
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+
+
+public class TestUnusedHandler<T extends LogicalMessageContext>
+ extends TestHandlerBase implements LogicalHandler<T> {
+
+ public TestUnusedHandler() {
+ this(true);
+ }
+
+ public TestUnusedHandler(boolean serverSide) {
+ super(serverSide);
+ }
+
+ public String getHandlerId() {
+ return "handler" + getId();
+ }
+
+ public boolean handleMessage(T ctx) {
+ throw new RuntimeException("should not be called");
+ }
+
+ public boolean handleFault(LogicalMessageContext ctx) {
+ return true;
+ }
+
+ public void close(MessageContext arg0) {
+ methodCalled("close");
+ }
+
+ public void init(Map arg0) {
+ methodCalled("init");
+ }
+
+ public void destroy() {
+ methodCalled("destroy");
+ }
+
+ public String toString() {
+ return getHandlerId();
+ }
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml?rev=607222&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml Fri Dec 28 04:28:18 2007
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:cfg="http://cxf.apache.org/configuration/cfg"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
+
+ <handler-chain>
+ <service-name-pattern xmlns:ns1="http://apache.org/handler_test">ns1:unknownservice</service-name-pattern>
+ <handler>
+ <handler-name>TestUnusedHandler</handler-name>
+ <handler-class>org.apache.cxf.systest.handlers.TestUnusedHandler</handler-class>
+ </handler>
+ </handler-chain>
+ <handler-chain>
+ <port-name-pattern xmlns:ns1="http://apache.org/handler_test">ns1:unknownport</port-name-pattern>
+ <handler>
+ <handler-name>TestUnusedHandler</handler-name>
+ <handler-class>org.apache.cxf.systest.handlers.TestUnusedHandler</handler-class>
+ </handler>
+ </handler-chain>
+</handler-chains>
+
+
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Re: svn commit: r607222 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/
systests/src/test/java/org/...
Posted by James Mao <ja...@iona.com>.
Jervis,
I believe your commit broken the TCK, can you kindly look through your
commits.
Thanks,
James
> Author: jliu
> Date: Fri Dec 28 04:28:18 2007
> New Revision: 607222
>
> URL: http://svn.apache.org/viewvc?rev=607222&view=rev
> Log:
> Configure JAX-WS handlers per port per service.
>
> Added:
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java (with props)
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java (with props)
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml (with props)
> Modified:
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java Fri Dec 28 04:28:18 2007
> @@ -171,9 +171,10 @@
> */
> private void buildHandlerChain() {
> AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
> -
> - List<Handler> chain = builder.buildHandlerChainFromClass(getServiceBeanClass(),
> - getEndpointName());
> + JaxWsServiceFactoryBean sf = (JaxWsServiceFactoryBean)getServiceFactory();
> +
> + List<Handler> chain = builder.buildHandlerChainFromClass(getServiceBeanClass(), sf.getEndpointInfo()
> + .getName(), sf.getServiceQName());
> for (Handler h : chain) {
> injectResources(h);
> }
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java Fri Dec 28 04:28:18 2007
> @@ -60,7 +60,7 @@
> * @return
> */
> public List<Handler> buildHandlerChainFromClass(Class<?> clz, List<Handler> existingHandlers,
> - QName endpointName) {
> + QName portQName, QName serviceQName) {
> LOG.fine("building handler chain");
> HandlerChainAnnotation hcAnn = findHandlerChainAnnotation(clz, true);
> List<Handler> chain = null;
> @@ -94,11 +94,19 @@
> for (HandlerChainType hc : handlerChainsType.getHandlerChain()) {
> //Only add handlers if <port-name-pattern> is not presented or is matched.
> //TODO: match the namespace, match the wild card etc. JSR-181, Appendix B.
> - if (hc.getPortNamePattern() != null && endpointName != null) {
> + if (hc.getPortNamePattern() != null && portQName != null) {
> String portNamePattern = hc.getPortNamePattern();
> String localPart = portNamePattern.substring(portNamePattern.indexOf(':') + 1,
> portNamePattern.length());
> - if (!localPart.equals(endpointName.getLocalPart())) {
> + if (!localPart.equals(portQName.getLocalPart())) {
> + continue;
> + }
> + }
> + if (hc.getServiceNamePattern() != null && serviceQName != null) {
> + String serviceNamePattern = hc.getServiceNamePattern();
> + String localPart = serviceNamePattern.substring(serviceNamePattern.indexOf(':') + 1,
> + serviceNamePattern.length());
> + if (!localPart.equals(serviceQName.getLocalPart())) {
> continue;
> }
> }
> @@ -116,14 +124,14 @@
> return sortHandlers(chain);
> }
>
> + public List<Handler> buildHandlerChainFromClass(Class<?> clz, QName portQName, QName serviceQName) {
> + return buildHandlerChainFromClass(clz, null, portQName, serviceQName);
> + }
> +
> protected URL resolveHandlerChainAnnotationFile(Class clazz, String name) {
> return clazz.getResource(name);
> }
> -
> - public List<Handler> buildHandlerChainFromClass(Class<?> clz, QName endpointName) {
> - return buildHandlerChainFromClass(clz, null, endpointName);
> - }
> -
> +
> public List<Handler> buildHandlerChainFromClass(Class<?> clz) {
> return buildHandlerChainFromClass(clz, null, null);
> }
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java Fri Dec 28 04:28:18 2007
> @@ -69,7 +69,7 @@
> chain = new ArrayList<Handler>();
> }
> if (annotationClass != null) {
> - chain.addAll(getHandlersFromAnnotation(annotationClass));
> + chain.addAll(getHandlersFromAnnotation(annotationClass, portInfo));
> }
>
> for (Handler h : chain) {
> @@ -85,11 +85,12 @@
> * @param obj A endpoint implementation class or a SEI, or a generated
> * service class.
> */
> - private List<Handler> getHandlersFromAnnotation(Class<?> clazz) {
> + private List<Handler> getHandlersFromAnnotation(Class<?> clazz, PortInfo portInfo) {
> AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
>
> - List<Handler> chain = builder.buildHandlerChainFromClass(clazz);
> -
> + List<Handler> chain = builder.buildHandlerChainFromClass(clazz, portInfo != null ? portInfo
> + .getPortName() : null, portInfo != null ? portInfo.getServiceName() : null);
> +
> return chain;
> }
>
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java Fri Dec 28 04:28:18 2007
> @@ -46,23 +46,38 @@
> AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
> List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass());
> assertNotNull(handlers);
> - assertEquals(5, handlers.size());
> + assertEquals(7, handlers.size());
> assertEquals(TestLogicalHandler.class, handlers.get(0).getClass());
> assertEquals(TestLogicalHandler.class, handlers.get(1).getClass());
> assertEquals(TestLogicalHandler.class, handlers.get(2).getClass());
> assertEquals(TestLogicalHandler.class, handlers.get(3).getClass());
> - assertEquals(TestProtocolHandler.class, handlers.get(4).getClass());
> + assertEquals(TestLogicalHandler.class, handlers.get(4).getClass());
> + assertEquals(TestLogicalHandler.class, handlers.get(5).getClass());
> + assertEquals(TestProtocolHandler.class, handlers.get(6).getClass());
> }
>
> @Test
> - public void testFindHandlerChainAnnotationPerPort() {
> + public void testFindHandlerChainAnnotationPerPortPerService() {
> HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
> AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
> - QName portName = new QName("namespacedoesntsupportyet", "SoapPort1");
> + QName portQName = new QName("namespacedoesntsupportyet", "SoapPort1");
> + QName serviceQName = new QName("namespacedoesntsupportyet", "SoapService1");
> List<Handler> handlers = chainBuilder
> - .buildHandlerChainFromClass(handlerTestImpl.getClass(), portName);
> + .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName);
> assertNotNull(handlers);
> - assertEquals(5, handlers.size());
> + assertEquals(7, handlers.size());
> + }
> +
> + @Test
> + public void testFindHandlerChainAnnotationPerPortPerServiceNegative() {
> + HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
> + AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
> + QName portQName = new QName("namespacedoesntsupportyet", "SoapPortUnknown");
> + QName serviceQName = new QName("namespacedoesntsupportyet", "SoapServiceUnknown");
> + List<Handler> handlers = chainBuilder
> + .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName);
> + assertNotNull(handlers);
> + assertEquals(3, handlers.size());
> }
>
> public static class TestLogicalHandler implements LogicalHandler {
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml Fri Dec 28 04:28:18 2007
> @@ -70,4 +70,23 @@
> </handler-class>
> </handler>
> </handler-chain>
> +
> + <handler-chain>
> + <service-name-pattern
> + xmlns:ns1="http://apache.org/handler_test">
> + ns1:SoapService1
> + </service-name-pattern>
> + <handler>
> + <handler-name>Handler1</handler-name>
> + <handler-class>
> + org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
> + </handler-class>
> + </handler>
> + <handler>
> + <handler-name>Handler2</handler-name>
> + <handler-class>
> + org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
> + </handler-class>
> + </handler>
> + </handler-chain>
> </handler-chains>
>
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java Fri Dec 28 04:28:18 2007
> @@ -30,6 +30,7 @@
> import javax.xml.soap.MessageFactory;
> import javax.xml.soap.SOAPMessage;
> import javax.xml.transform.Source;
> +import javax.xml.ws.Binding;
> import javax.xml.ws.BindingProvider;
> import javax.xml.ws.Dispatch;
> import javax.xml.ws.LogicalMessage;
> @@ -106,6 +107,17 @@
> assertEquals(1, handler2.getHandleMessageInvoked());
> }
>
> + @Test
> + public void testAddingUnusedHandlersThroughConfigFile() {
> + HandlerTestServiceWithAnnotation service1 = new HandlerTestServiceWithAnnotation(wsdl, serviceName);
> + HandlerTest handlerTest1 = service1.getPort(portName, HandlerTest.class);
> +
> + BindingProvider bp1 = (BindingProvider)handlerTest1;
> + Binding binding1 = bp1.getBinding();
> + List<Handler> port1HandlerChain = binding1.getHandlerChain();
> + assertEquals(0, port1HandlerChain.size());
> + }
> +
> @Test
> public void testLogicalHandlerOneWay() {
> TestHandler<LogicalMessageContext> handler1 = new TestHandler<LogicalMessageContext>(false);
>
> Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java?rev=607222&view=auto
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java (added)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java Fri Dec 28 04:28:18 2007
> @@ -0,0 +1,112 @@
> +/**
> + * 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.cxf.systest.handlers;
> +
> +import java.net.MalformedURLException;
> +import java.net.URL;
> +
> +import javax.jws.HandlerChain;
> +import javax.xml.namespace.QName;
> +import javax.xml.ws.Service;
> +import javax.xml.ws.WebEndpoint;
> +import javax.xml.ws.WebServiceClient;
> +import javax.xml.ws.WebServiceFeature;
> +
> +import org.apache.handler_test.HandlerTest;
> +import org.apache.handler_test.HandlerTest1;
> +
> +/**
> + * This class was generated by Apache CXF (incubator) 2.1-incubator-SNAPSHOT Tue
> + * Dec 25 12:27:03 CST 2007 Generated source version: 2.1-incubator-SNAPSHOT
> + */
> +
> +@WebServiceClient(name = "HandlerTestService",
> + targetNamespace = "http://apache.org/handler_test",
> + wsdlLocation = "file:/D:/svn/cxf/trunk/testutils/src/main/resources/wsdl/handler_test.wsdl")
> +@HandlerChain(file = "./handlers_invocation_testunused.xml", name = "TestHandlerChain")
> +public class HandlerTestServiceWithAnnotation extends Service {
> +
> + static {
> + URL url = null;
> + try {
> + url = new URL("file:/D:/svn/cxf/trunk/testutils/src/main/resources/wsdl/handler_test.wsdl");
> + } catch (MalformedURLException e) {
> + e.printStackTrace();
> + }
> + WSDL_LOCATION = url;
> + }
> +
> + public static final QName SERVICE = new QName("http://apache.org/handler_test", "HandlerTestService");
> + public static final QName SOAPPORT = new QName("http://apache.org/handler_test", "SoapPort");
> + public static final QName SOAPPORT1 = new QName("http://apache.org/handler_test", "SoapPort1");
> + public static final URL WSDL_LOCATION;
> +
> + public HandlerTestServiceWithAnnotation(URL wsdlLocation) {
> + super(wsdlLocation, SERVICE);
> + }
> +
> + public HandlerTestServiceWithAnnotation(URL wsdlLocation, QName serviceName) {
> + super(wsdlLocation, serviceName);
> + }
> +
> + public HandlerTestServiceWithAnnotation() {
> + super(WSDL_LOCATION, SERVICE);
> + }
> +
> + /**
> + * @return returns HandlerTest
> + */
> + @WebEndpoint(name = "SoapPort")
> + public HandlerTest getSoapPort() {
> + return (HandlerTest)super.getPort(SOAPPORT, HandlerTest.class);
> + }
> +
> + /**
> + * @param features A list of {@link javax.xml.ws.WebServiceFeature} to
> + * configure on the proxy. Supported features not in the
> + * <code>features</code> parameter will have their default
> + * values.
> + * @return returns HandlerTest
> + */
> + @WebEndpoint(name = "SoapPort")
> + public HandlerTest getSoapPort(WebServiceFeature... features) {
> + return (HandlerTest)super.getPort(SOAPPORT, HandlerTest.class, features);
> + }
> +
> + /**
> + * @return returns HandlerTest1
> + */
> + @WebEndpoint(name = "SoapPort1")
> + public HandlerTest1 getSoapPort1() {
> + return (HandlerTest1)super.getPort(SOAPPORT1, HandlerTest1.class);
> + }
> +
> + /**
> + * @param features A list of {@link javax.xml.ws.WebServiceFeature} to
> + * configure on the proxy. Supported features not in the
> + * <code>features</code> parameter will have their default
> + * values.
> + * @return returns HandlerTest1
> + */
> + @WebEndpoint(name = "SoapPort1")
> + public HandlerTest1 getSoapPort1(WebServiceFeature... features) {
> + return (HandlerTest1)super.getPort(SOAPPORT1, HandlerTest1.class, features);
> + }
> +
> +}
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java
> ------------------------------------------------------------------------------
> svn:keywords = Rev Date
>
> Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java?rev=607222&view=auto
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java (added)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java Fri Dec 28 04:28:18 2007
> @@ -0,0 +1,66 @@
> +/**
> + * 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.cxf.systest.handlers;
> +
> +import java.util.Map;
> +
> +import javax.xml.ws.handler.LogicalHandler;
> +import javax.xml.ws.handler.LogicalMessageContext;
> +import javax.xml.ws.handler.MessageContext;
> +
> +
> +public class TestUnusedHandler<T extends LogicalMessageContext>
> + extends TestHandlerBase implements LogicalHandler<T> {
> +
> + public TestUnusedHandler() {
> + this(true);
> + }
> +
> + public TestUnusedHandler(boolean serverSide) {
> + super(serverSide);
> + }
> +
> + public String getHandlerId() {
> + return "handler" + getId();
> + }
> +
> + public boolean handleMessage(T ctx) {
> + throw new RuntimeException("should not be called");
> + }
> +
> + public boolean handleFault(LogicalMessageContext ctx) {
> + return true;
> + }
> +
> + public void close(MessageContext arg0) {
> + methodCalled("close");
> + }
> +
> + public void init(Map arg0) {
> + methodCalled("init");
> + }
> +
> + public void destroy() {
> + methodCalled("destroy");
> + }
> +
> + public String toString() {
> + return getHandlerId();
> + }
> +}
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java
> ------------------------------------------------------------------------------
> svn:keywords = Rev Date
>
> Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml?rev=607222&view=auto
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml (added)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml Fri Dec 28 04:28:18 2007
> @@ -0,0 +1,42 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> + 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.
> +-->
> +<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
> + xmlns:cfg="http://cxf.apache.org/configuration/cfg"
> + xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
> +
> + <handler-chain>
> + <service-name-pattern xmlns:ns1="http://apache.org/handler_test">ns1:unknownservice</service-name-pattern>
> + <handler>
> + <handler-name>TestUnusedHandler</handler-name>
> + <handler-class>org.apache.cxf.systest.handlers.TestUnusedHandler</handler-class>
> + </handler>
> + </handler-chain>
> + <handler-chain>
> + <port-name-pattern xmlns:ns1="http://apache.org/handler_test">ns1:unknownport</port-name-pattern>
> + <handler>
> + <handler-name>TestUnusedHandler</handler-name>
> + <handler-class>org.apache.cxf.systest.handlers.TestUnusedHandler</handler-class>
> + </handler>
> + </handler-chain>
> +</handler-chains>
> +
> +
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
> ------------------------------------------------------------------------------
> svn:keywords = Rev Date
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
> ------------------------------------------------------------------------------
> svn:mime-type = text/xml
>
>
>
Re: svn commit: r607222 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/
systests/src/test/java/org/...
Posted by James Mao <ja...@iona.com>.
Jervis,
I believe your commit broken the TCK, can you kindly look through your
commits.
Thanks,
James
> Author: jliu
> Date: Fri Dec 28 04:28:18 2007
> New Revision: 607222
>
> URL: http://svn.apache.org/viewvc?rev=607222&view=rev
> Log:
> Configure JAX-WS handlers per port per service.
>
> Added:
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java (with props)
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java (with props)
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml (with props)
> Modified:
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
> incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java Fri Dec 28 04:28:18 2007
> @@ -171,9 +171,10 @@
> */
> private void buildHandlerChain() {
> AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
> -
> - List<Handler> chain = builder.buildHandlerChainFromClass(getServiceBeanClass(),
> - getEndpointName());
> + JaxWsServiceFactoryBean sf = (JaxWsServiceFactoryBean)getServiceFactory();
> +
> + List<Handler> chain = builder.buildHandlerChainFromClass(getServiceBeanClass(), sf.getEndpointInfo()
> + .getName(), sf.getServiceQName());
> for (Handler h : chain) {
> injectResources(h);
> }
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java Fri Dec 28 04:28:18 2007
> @@ -60,7 +60,7 @@
> * @return
> */
> public List<Handler> buildHandlerChainFromClass(Class<?> clz, List<Handler> existingHandlers,
> - QName endpointName) {
> + QName portQName, QName serviceQName) {
> LOG.fine("building handler chain");
> HandlerChainAnnotation hcAnn = findHandlerChainAnnotation(clz, true);
> List<Handler> chain = null;
> @@ -94,11 +94,19 @@
> for (HandlerChainType hc : handlerChainsType.getHandlerChain()) {
> //Only add handlers if <port-name-pattern> is not presented or is matched.
> //TODO: match the namespace, match the wild card etc. JSR-181, Appendix B.
> - if (hc.getPortNamePattern() != null && endpointName != null) {
> + if (hc.getPortNamePattern() != null && portQName != null) {
> String portNamePattern = hc.getPortNamePattern();
> String localPart = portNamePattern.substring(portNamePattern.indexOf(':') + 1,
> portNamePattern.length());
> - if (!localPart.equals(endpointName.getLocalPart())) {
> + if (!localPart.equals(portQName.getLocalPart())) {
> + continue;
> + }
> + }
> + if (hc.getServiceNamePattern() != null && serviceQName != null) {
> + String serviceNamePattern = hc.getServiceNamePattern();
> + String localPart = serviceNamePattern.substring(serviceNamePattern.indexOf(':') + 1,
> + serviceNamePattern.length());
> + if (!localPart.equals(serviceQName.getLocalPart())) {
> continue;
> }
> }
> @@ -116,14 +124,14 @@
> return sortHandlers(chain);
> }
>
> + public List<Handler> buildHandlerChainFromClass(Class<?> clz, QName portQName, QName serviceQName) {
> + return buildHandlerChainFromClass(clz, null, portQName, serviceQName);
> + }
> +
> protected URL resolveHandlerChainAnnotationFile(Class clazz, String name) {
> return clazz.getResource(name);
> }
> -
> - public List<Handler> buildHandlerChainFromClass(Class<?> clz, QName endpointName) {
> - return buildHandlerChainFromClass(clz, null, endpointName);
> - }
> -
> +
> public List<Handler> buildHandlerChainFromClass(Class<?> clz) {
> return buildHandlerChainFromClass(clz, null, null);
> }
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java Fri Dec 28 04:28:18 2007
> @@ -69,7 +69,7 @@
> chain = new ArrayList<Handler>();
> }
> if (annotationClass != null) {
> - chain.addAll(getHandlersFromAnnotation(annotationClass));
> + chain.addAll(getHandlersFromAnnotation(annotationClass, portInfo));
> }
>
> for (Handler h : chain) {
> @@ -85,11 +85,12 @@
> * @param obj A endpoint implementation class or a SEI, or a generated
> * service class.
> */
> - private List<Handler> getHandlersFromAnnotation(Class<?> clazz) {
> + private List<Handler> getHandlersFromAnnotation(Class<?> clazz, PortInfo portInfo) {
> AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
>
> - List<Handler> chain = builder.buildHandlerChainFromClass(clazz);
> -
> + List<Handler> chain = builder.buildHandlerChainFromClass(clazz, portInfo != null ? portInfo
> + .getPortName() : null, portInfo != null ? portInfo.getServiceName() : null);
> +
> return chain;
> }
>
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java Fri Dec 28 04:28:18 2007
> @@ -46,23 +46,38 @@
> AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
> List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass());
> assertNotNull(handlers);
> - assertEquals(5, handlers.size());
> + assertEquals(7, handlers.size());
> assertEquals(TestLogicalHandler.class, handlers.get(0).getClass());
> assertEquals(TestLogicalHandler.class, handlers.get(1).getClass());
> assertEquals(TestLogicalHandler.class, handlers.get(2).getClass());
> assertEquals(TestLogicalHandler.class, handlers.get(3).getClass());
> - assertEquals(TestProtocolHandler.class, handlers.get(4).getClass());
> + assertEquals(TestLogicalHandler.class, handlers.get(4).getClass());
> + assertEquals(TestLogicalHandler.class, handlers.get(5).getClass());
> + assertEquals(TestProtocolHandler.class, handlers.get(6).getClass());
> }
>
> @Test
> - public void testFindHandlerChainAnnotationPerPort() {
> + public void testFindHandlerChainAnnotationPerPortPerService() {
> HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
> AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
> - QName portName = new QName("namespacedoesntsupportyet", "SoapPort1");
> + QName portQName = new QName("namespacedoesntsupportyet", "SoapPort1");
> + QName serviceQName = new QName("namespacedoesntsupportyet", "SoapService1");
> List<Handler> handlers = chainBuilder
> - .buildHandlerChainFromClass(handlerTestImpl.getClass(), portName);
> + .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName);
> assertNotNull(handlers);
> - assertEquals(5, handlers.size());
> + assertEquals(7, handlers.size());
> + }
> +
> + @Test
> + public void testFindHandlerChainAnnotationPerPortPerServiceNegative() {
> + HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
> + AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
> + QName portQName = new QName("namespacedoesntsupportyet", "SoapPortUnknown");
> + QName serviceQName = new QName("namespacedoesntsupportyet", "SoapServiceUnknown");
> + List<Handler> handlers = chainBuilder
> + .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName);
> + assertNotNull(handlers);
> + assertEquals(3, handlers.size());
> }
>
> public static class TestLogicalHandler implements LogicalHandler {
>
> Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml (original)
> +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml Fri Dec 28 04:28:18 2007
> @@ -70,4 +70,23 @@
> </handler-class>
> </handler>
> </handler-chain>
> +
> + <handler-chain>
> + <service-name-pattern
> + xmlns:ns1="http://apache.org/handler_test">
> + ns1:SoapService1
> + </service-name-pattern>
> + <handler>
> + <handler-name>Handler1</handler-name>
> + <handler-class>
> + org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
> + </handler-class>
> + </handler>
> + <handler>
> + <handler-name>Handler2</handler-name>
> + <handler-class>
> + org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
> + </handler-class>
> + </handler>
> + </handler-chain>
> </handler-chains>
>
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=607222&r1=607221&r2=607222&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java Fri Dec 28 04:28:18 2007
> @@ -30,6 +30,7 @@
> import javax.xml.soap.MessageFactory;
> import javax.xml.soap.SOAPMessage;
> import javax.xml.transform.Source;
> +import javax.xml.ws.Binding;
> import javax.xml.ws.BindingProvider;
> import javax.xml.ws.Dispatch;
> import javax.xml.ws.LogicalMessage;
> @@ -106,6 +107,17 @@
> assertEquals(1, handler2.getHandleMessageInvoked());
> }
>
> + @Test
> + public void testAddingUnusedHandlersThroughConfigFile() {
> + HandlerTestServiceWithAnnotation service1 = new HandlerTestServiceWithAnnotation(wsdl, serviceName);
> + HandlerTest handlerTest1 = service1.getPort(portName, HandlerTest.class);
> +
> + BindingProvider bp1 = (BindingProvider)handlerTest1;
> + Binding binding1 = bp1.getBinding();
> + List<Handler> port1HandlerChain = binding1.getHandlerChain();
> + assertEquals(0, port1HandlerChain.size());
> + }
> +
> @Test
> public void testLogicalHandlerOneWay() {
> TestHandler<LogicalMessageContext> handler1 = new TestHandler<LogicalMessageContext>(false);
>
> Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java?rev=607222&view=auto
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java (added)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java Fri Dec 28 04:28:18 2007
> @@ -0,0 +1,112 @@
> +/**
> + * 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.cxf.systest.handlers;
> +
> +import java.net.MalformedURLException;
> +import java.net.URL;
> +
> +import javax.jws.HandlerChain;
> +import javax.xml.namespace.QName;
> +import javax.xml.ws.Service;
> +import javax.xml.ws.WebEndpoint;
> +import javax.xml.ws.WebServiceClient;
> +import javax.xml.ws.WebServiceFeature;
> +
> +import org.apache.handler_test.HandlerTest;
> +import org.apache.handler_test.HandlerTest1;
> +
> +/**
> + * This class was generated by Apache CXF (incubator) 2.1-incubator-SNAPSHOT Tue
> + * Dec 25 12:27:03 CST 2007 Generated source version: 2.1-incubator-SNAPSHOT
> + */
> +
> +@WebServiceClient(name = "HandlerTestService",
> + targetNamespace = "http://apache.org/handler_test",
> + wsdlLocation = "file:/D:/svn/cxf/trunk/testutils/src/main/resources/wsdl/handler_test.wsdl")
> +@HandlerChain(file = "./handlers_invocation_testunused.xml", name = "TestHandlerChain")
> +public class HandlerTestServiceWithAnnotation extends Service {
> +
> + static {
> + URL url = null;
> + try {
> + url = new URL("file:/D:/svn/cxf/trunk/testutils/src/main/resources/wsdl/handler_test.wsdl");
> + } catch (MalformedURLException e) {
> + e.printStackTrace();
> + }
> + WSDL_LOCATION = url;
> + }
> +
> + public static final QName SERVICE = new QName("http://apache.org/handler_test", "HandlerTestService");
> + public static final QName SOAPPORT = new QName("http://apache.org/handler_test", "SoapPort");
> + public static final QName SOAPPORT1 = new QName("http://apache.org/handler_test", "SoapPort1");
> + public static final URL WSDL_LOCATION;
> +
> + public HandlerTestServiceWithAnnotation(URL wsdlLocation) {
> + super(wsdlLocation, SERVICE);
> + }
> +
> + public HandlerTestServiceWithAnnotation(URL wsdlLocation, QName serviceName) {
> + super(wsdlLocation, serviceName);
> + }
> +
> + public HandlerTestServiceWithAnnotation() {
> + super(WSDL_LOCATION, SERVICE);
> + }
> +
> + /**
> + * @return returns HandlerTest
> + */
> + @WebEndpoint(name = "SoapPort")
> + public HandlerTest getSoapPort() {
> + return (HandlerTest)super.getPort(SOAPPORT, HandlerTest.class);
> + }
> +
> + /**
> + * @param features A list of {@link javax.xml.ws.WebServiceFeature} to
> + * configure on the proxy. Supported features not in the
> + * <code>features</code> parameter will have their default
> + * values.
> + * @return returns HandlerTest
> + */
> + @WebEndpoint(name = "SoapPort")
> + public HandlerTest getSoapPort(WebServiceFeature... features) {
> + return (HandlerTest)super.getPort(SOAPPORT, HandlerTest.class, features);
> + }
> +
> + /**
> + * @return returns HandlerTest1
> + */
> + @WebEndpoint(name = "SoapPort1")
> + public HandlerTest1 getSoapPort1() {
> + return (HandlerTest1)super.getPort(SOAPPORT1, HandlerTest1.class);
> + }
> +
> + /**
> + * @param features A list of {@link javax.xml.ws.WebServiceFeature} to
> + * configure on the proxy. Supported features not in the
> + * <code>features</code> parameter will have their default
> + * values.
> + * @return returns HandlerTest1
> + */
> + @WebEndpoint(name = "SoapPort1")
> + public HandlerTest1 getSoapPort1(WebServiceFeature... features) {
> + return (HandlerTest1)super.getPort(SOAPPORT1, HandlerTest1.class, features);
> + }
> +
> +}
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerTestServiceWithAnnotation.java
> ------------------------------------------------------------------------------
> svn:keywords = Rev Date
>
> Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java?rev=607222&view=auto
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java (added)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java Fri Dec 28 04:28:18 2007
> @@ -0,0 +1,66 @@
> +/**
> + * 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.cxf.systest.handlers;
> +
> +import java.util.Map;
> +
> +import javax.xml.ws.handler.LogicalHandler;
> +import javax.xml.ws.handler.LogicalMessageContext;
> +import javax.xml.ws.handler.MessageContext;
> +
> +
> +public class TestUnusedHandler<T extends LogicalMessageContext>
> + extends TestHandlerBase implements LogicalHandler<T> {
> +
> + public TestUnusedHandler() {
> + this(true);
> + }
> +
> + public TestUnusedHandler(boolean serverSide) {
> + super(serverSide);
> + }
> +
> + public String getHandlerId() {
> + return "handler" + getId();
> + }
> +
> + public boolean handleMessage(T ctx) {
> + throw new RuntimeException("should not be called");
> + }
> +
> + public boolean handleFault(LogicalMessageContext ctx) {
> + return true;
> + }
> +
> + public void close(MessageContext arg0) {
> + methodCalled("close");
> + }
> +
> + public void init(Map arg0) {
> + methodCalled("init");
> + }
> +
> + public void destroy() {
> + methodCalled("destroy");
> + }
> +
> + public String toString() {
> + return getHandlerId();
> + }
> +}
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestUnusedHandler.java
> ------------------------------------------------------------------------------
> svn:keywords = Rev Date
>
> Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml?rev=607222&view=auto
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml (added)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml Fri Dec 28 04:28:18 2007
> @@ -0,0 +1,42 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> + 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.
> +-->
> +<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
> + xmlns:cfg="http://cxf.apache.org/configuration/cfg"
> + xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
> +
> + <handler-chain>
> + <service-name-pattern xmlns:ns1="http://apache.org/handler_test">ns1:unknownservice</service-name-pattern>
> + <handler>
> + <handler-name>TestUnusedHandler</handler-name>
> + <handler-class>org.apache.cxf.systest.handlers.TestUnusedHandler</handler-class>
> + </handler>
> + </handler-chain>
> + <handler-chain>
> + <port-name-pattern xmlns:ns1="http://apache.org/handler_test">ns1:unknownport</port-name-pattern>
> + <handler>
> + <handler-name>TestUnusedHandler</handler-name>
> + <handler-class>org.apache.cxf.systest.handlers.TestUnusedHandler</handler-class>
> + </handler>
> + </handler-chain>
> +</handler-chains>
> +
> +
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
> ------------------------------------------------------------------------------
> svn:keywords = Rev Date
>
> Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
> ------------------------------------------------------------------------------
> svn:mime-type = text/xml
>
>
>