JBossWS SVN: r14246 - in framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850: src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-05-05 03:33:26 -0400 (Thu, 05 May 2011)
New Revision: 14246
Modified:
framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/
framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpoint.java
framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpointBean.java
Log:
[JBPAPP-5850] updated test case
Property changes on: framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850
___________________________________________________________________
Added: svn:mergeinfo
+ /framework/branches/jbossws-framework-2.0.1.GA_CP:14234
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpoint.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpoint.java 2011-05-05 07:28:18 UTC (rev 14245)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpoint.java 2011-05-05 07:33:26 UTC (rev 14246)
@@ -23,11 +23,9 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
-import javax.xml.ws.BindingType;
@WebService(targetNamespace = "http://org.jboss.ws/xop/doclit")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle = SOAPBinding.ParameterStyle.BARE)
-@BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true")
public interface MTOMEndpoint
{
public DHResponse echoDataHandler(DHRequest request);
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpointBean.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpointBean.java 2011-05-05 07:28:18 UTC (rev 14245)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpointBean.java 2011-05-05 07:33:26 UTC (rev 14246)
@@ -25,11 +25,13 @@
import javax.activation.DataHandler;
import javax.jws.WebService;
+import javax.xml.ws.BindingType;
import javax.xml.ws.WebServiceException;
import org.jboss.logging.Logger;
@WebService(name = "MTOMEndpoint", serviceName = "MTOMService", endpointInterface = "org.jboss.test.ws.jaxws.samples.xop.doclit.MTOMEndpoint")
+@BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true")
public class MTOMEndpointBean implements MTOMEndpoint
{
private Logger log = Logger.getLogger(MTOMEndpointBean.class);
14 years, 11 months
JBossWS SVN: r14245 - framework/branches.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-05-05 03:28:18 -0400 (Thu, 05 May 2011)
New Revision: 14245
Added:
framework/branches/jbossws-framework-2.0.1.GA_CP05_JBPAPP-5850/
Log:
[JBPAPP-5850] branch for one off of framework
14 years, 11 months
JBossWS SVN: r14244 - stack/native/trunk/modules/dist/src/main/distro.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-05-05 03:03:48 -0400 (Thu, 05 May 2011)
New Revision: 14244
Modified:
stack/native/trunk/modules/dist/src/main/distro/build.xml
Log:
Fix to bin distro
Modified: stack/native/trunk/modules/dist/src/main/distro/build.xml
===================================================================
--- stack/native/trunk/modules/dist/src/main/distro/build.xml 2011-05-04 21:53:53 UTC (rev 14243)
+++ stack/native/trunk/modules/dist/src/main/distro/build.xml 2011-05-05 07:03:48 UTC (rev 14244)
@@ -53,6 +53,11 @@
<equals arg1="${jbossws.integration.target}" arg2="jboss601"/>
</or>
</condition>
+ <condition property="jbossws.integration.jboss70" value="true">
+ <or>
+ <equals arg1="${jbossws.integration.target}" arg2="jboss700"/>
+ </or>
+ </condition>
<property name="deploy.structure" value="${output.dir}/deploy-${jbossws.integration.target}"/>
<property name="excludesfile" value="${tests.dir}/resources/test-excludes-${jbossws.integration.target}.txt"/>
14 years, 11 months
JBossWS SVN: r14243 - in shared-testsuite/trunk/src/test: java/org/jboss/test/ws/jaxws and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-05-04 17:53:53 -0400 (Wed, 04 May 2011)
New Revision: 14243
Added:
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/AuthorizationHandler.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/Endpoint.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/EndpointHandler.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/EndpointImpl.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/HandlerChainTestCase.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/LogHandler.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/RoutingHandler.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/jaxws-handlers-server.xml
shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/
shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/WEB-INF/
shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/WEB-INF/jaxws-endpoint-config.xml
shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/WEB-INF/web.xml
Modified:
shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-3282] Adding testcase for handlers in jaxws configuration
Modified: shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml 2011-05-04 21:53:28 UTC (rev 14242)
+++ shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml 2011-05-04 21:53:53 UTC (rev 14243)
@@ -1053,6 +1053,19 @@
<include name="wsdl/**" />
</webinf>
</war>
+
+ <!-- jaxws-jbws3282 -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-jbws3282.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws3282/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/jbws3282/EndpointImpl.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws3282/Endpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws3282/*Handler.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws3282/jaxws-handlers-server.xml"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/test-resources/jaxws/jbws3282/WEB-INF">
+ <include name="**/*" />
+ </webinf>
+ </war>
<!-- jaxws-endpoint-servlet -->
<war warfile="${tests.output.dir}/test-libs/jaxws-endpoint-servlet.war" manifest="${tests.output.dir}/test-resources/jaxws/endpoint/META-INF/MANIFEST.MF"
Added: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/AuthorizationHandler.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/AuthorizationHandler.java (rev 0)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/AuthorizationHandler.java 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3282;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+
+public class AuthorizationHandler extends GenericSOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(AuthorizationHandler.class);
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+// SOAPFactory soapFactory = SOAPFactory.newInstance();
+// Name headerName = soapFactory.createName("AuthorizationHandlerInbound", "ns1", "http://somens");
+// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+// she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|AuthIn");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+// SOAPFactory soapFactory = SOAPFactory.newInstance();
+// Name headerName = soapFactory.createName("AuthorizationHandlerOutbound", "ns1", "http://somens");
+// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+// she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|AuthOut");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+}
Added: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/Endpoint.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/Endpoint.java (rev 0)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/Endpoint.java 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3282;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(name="Endpoint")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Endpoint
+{
+ public String echo(String input);
+}
Added: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/EndpointHandler.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/EndpointHandler.java (rev 0)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/EndpointHandler.java 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3282;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+
+public class EndpointHandler extends GenericSOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(EndpointHandler.class);
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+// SOAPFactory soapFactory = SOAPFactory.newInstance();
+// Name headerName = soapFactory.createName("EndpointHandlerInbound", "ns1", "http://somens");
+// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+// she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|EpIn");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+// SOAPFactory soapFactory = SOAPFactory.newInstance();
+// Name headerName = soapFactory.createName("EndpointHandlerOutbound", "ns1", "http://somens");
+// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+// she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|EpOut");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+}
Added: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/EndpointImpl.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/EndpointImpl.java (rev 0)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/EndpointImpl.java 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3282;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.annotation.EndpointConfig;
+
+@WebService(name="Endpoint")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+@EndpointConfig(configFile = "WEB-INF/jaxws-endpoint-config.xml", configName = "Custom Endpoint")
+@HandlerChain(file = "jaxws-handlers-server.xml") // relative path from the class file
+public class EndpointImpl
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(EndpointImpl.class);
+
+ @WebMethod
+ public String echo(String input)
+ {
+ log.info("echo: " + input);
+ return input + "|endpoint";
+ }
+}
Added: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/HandlerChainTestCase.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/HandlerChainTestCase.java (rev 0)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/HandlerChainTestCase.java 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3282;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Test the handlers (pre/post) declaration in jaxws endpoint configuration
+ *
+ * https://issues.jboss.org/browse/JBWS-3282
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 03-May-2011
+ */
+public class HandlerChainTestCase extends JBossWSTest
+{
+ private static final String targetNS = "http://jbws3282.jaxws.ws.test.jboss.org/";
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(HandlerChainTestCase.class, "jaxws-jbws3282.war");
+ }
+
+ public void testHandlerChain() throws Exception
+ {
+ QName serviceName = new QName(targetNS, "EndpointImplService");
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws3282/TestService?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+
+ String resStr = port.echo("Kermit");
+ assertEquals("Kermit|RoutIn|AuthIn|EpIn|LogIn|endpoint|LogOut|EpOut|AuthOut|RoutOut", resStr);
+ }
+}
Added: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/LogHandler.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/LogHandler.java (rev 0)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/LogHandler.java 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3282;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+
+public class LogHandler extends GenericSOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(LogHandler.class);
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = getFailsafeSOAPHeader(soapMessage);
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+// SOAPFactory soapFactory = SOAPFactory.newInstance();
+// Name headerName = soapFactory.createName("LogHandlerInbound", "ns1", "http://somens");
+// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+// she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|LogIn");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = getFailsafeSOAPHeader(soapMessage);
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+// SOAPFactory soapFactory = SOAPFactory.newInstance();
+// Name headerName = soapFactory.createName("LogHandlerOutbound", "ns1", "http://somens");
+// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+// she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|LogOut");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+ private SOAPHeader getFailsafeSOAPHeader(SOAPMessage soapMessage) throws SOAPException
+ {
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ if (soapHeader == null)
+ {
+ soapHeader = soapMessage.getSOAPPart().getEnvelope().addHeader();
+ }
+ return soapHeader;
+ }
+}
Added: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/RoutingHandler.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/RoutingHandler.java (rev 0)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/RoutingHandler.java 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3282;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+
+public class RoutingHandler extends GenericSOAPHandler
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(RoutingHandler.class);
+
+ protected boolean handleInbound(MessageContext msgContext)
+ {
+ log.info("handleInbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+// SOAPFactory soapFactory = SOAPFactory.newInstance();
+// Name headerName = soapFactory.createName("RoutingHandlerInbound", "ns1", "http://somens");
+// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+// she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|RoutIn");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+
+ protected boolean handleOutbound(MessageContext msgContext)
+ {
+ log.info("handleOutbound");
+
+ try
+ {
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+
+// SOAPFactory soapFactory = SOAPFactory.newInstance();
+// Name headerName = soapFactory.createName("RoutingHandlerOutbound", "ns1", "http://somens");
+// SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
+// she.setValue("true");
+
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + "|RoutOut");
+ }
+ catch (SOAPException e)
+ {
+ throw new WebServiceException(e);
+ }
+
+ return true;
+ }
+}
Added: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/jaxws-handlers-server.xml
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/jaxws-handlers-server.xml (rev 0)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3282/jaxws-handlers-server.xml 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <handler>
+ <handler-name> EndpointHandler </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.jbws3282.EndpointHandler </handler-class>
+ </handler>
+ </handler-chain>
+</handler-chains>
\ No newline at end of file
Added: shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/WEB-INF/jaxws-endpoint-config.xml
===================================================================
--- shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/WEB-INF/jaxws-endpoint-config.xml (rev 0)
+++ shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/WEB-INF/jaxws-endpoint-config.xml 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jaxws-config xmlns="urn:jboss:jbossws-jaxws-config:4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xsi:schemaLocation="urn:jboss:jbossws-jaxws-config:4.0 schema/jbossws-jaxws-config_4_0.xsd">
+
+ <endpoint-config>
+ <config-name>Custom Endpoint</config-name>
+ <pre-handler-chains>
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name>Log Handler</javaee:handler-name>
+ <javaee:handler-class>org.jboss.test.ws.jaxws.jbws3282.LogHandler</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </pre-handler-chains>
+ <post-handler-chains>
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name>Authorization Handler</javaee:handler-name>
+ <javaee:handler-class>org.jboss.test.ws.jaxws.jbws3282.AuthorizationHandler</javaee:handler-class>
+ </javaee:handler>
+ <javaee:handler>
+ <javaee:handler-name>Routing Handler</javaee:handler-name>
+ <javaee:handler-class>org.jboss.test.ws.jaxws.jbws3282.RoutingHandler</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </post-handler-chains>
+ </endpoint-config>
+
+</jaxws-config>
\ No newline at end of file
Added: shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/WEB-INF/web.xml
===================================================================
--- shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/WEB-INF/web.xml (rev 0)
+++ shared-testsuite/trunk/src/test/resources/jaxws/jbws3282/WEB-INF/web.xml 2011-05-04 21:53:53 UTC (rev 14243)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>TestService</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.jbws3282.EndpointImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
14 years, 11 months
JBossWS SVN: r14242 - in stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf: deployment and 3 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-05-04 17:53:28 -0400 (Wed, 04 May 2011)
New Revision: 14242
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java
Log:
[JBWS-3282] Moving configuration processing in EndpointImpl to properly support both spring and non-spring cases
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2011-05-04 12:03:07 UTC (rev 14241)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2011-05-04 21:53:28 UTC (rev 14242)
@@ -37,6 +37,7 @@
import org.jboss.ws.Constants;
import org.jboss.wsf.spi.binding.BindingCustomization;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
import org.jboss.wsf.stack.cxf.interceptor.EnableOneWayDecoupledFaultInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.EndpointAssociationInterceptor;
@@ -117,7 +118,7 @@
* @return The new jbossws cxf configurer
*/
public abstract Configurer createServerConfigurer(BindingCustomization customization,
- WSDLFilePublisher wsdlPublisher, List<Endpoint> depEndpoints);
+ WSDLFilePublisher wsdlPublisher, List<Endpoint> depEndpoints, UnifiedVirtualFile root);
protected static void setInterceptors(Bus bus)
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2011-05-04 12:03:07 UTC (rev 14241)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2011-05-04 21:53:28 UTC (rev 14242)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -39,6 +39,7 @@
import org.apache.cxf.ws.rm.RMManager;
import org.jboss.wsf.spi.binding.BindingCustomization;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSNonSpringBusFactory;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSNonSpringConfigurer;
import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
@@ -123,21 +124,9 @@
@SuppressWarnings("rawtypes")
private static void setHandlers(EndpointImpl endpoint, DDEndpoint dde)
{
- List<String> handlers = new LinkedList<String>();
- if (dde.getPreHandlers() != null)
+ List<String> handlers = dde.getHandlers();
+ if (handlers != null && !handlers.isEmpty())
{
- handlers.addAll(dde.getPreHandlers());
- }
- if (dde.getHandlers() != null)
- {
- handlers.addAll(dde.getHandlers());
- }
- if (dde.getPostHandlers() != null)
- {
- handlers.addAll(dde.getPostHandlers());
- }
- if (!handlers.isEmpty())
- {
List<Handler> handlerInstances = new LinkedList<Handler>();
for (String handler : handlers)
{
@@ -173,7 +162,7 @@
{
try
{
- Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
+ Class<?> clazz = SecurityActions.getContextClassLoader().loadClass(className);
return clazz.newInstance();
}
catch (Exception e)
@@ -184,12 +173,13 @@
@Override
public Configurer createServerConfigurer(BindingCustomization customization, WSDLFilePublisher wsdlPublisher,
- List<Endpoint> depEndpoints)
+ List<Endpoint> depEndpoints, UnifiedVirtualFile root)
{
ServerBeanCustomizer customizer = new ServerBeanCustomizer();
customizer.setBindingCustomization(customization);
customizer.setWsdlPublisher(wsdlPublisher);
customizer.setDeploymentEndpoints(depEndpoints);
+ customizer.setDeploymentRoot(root);
return new JBossWSNonSpringConfigurer(customizer);
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-05-04 12:03:07 UTC (rev 14241)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2011-05-04 21:53:28 UTC (rev 14242)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -21,10 +21,15 @@
*/
package org.jboss.wsf.stack.cxf.configuration;
+import java.io.IOException;
import java.util.List;
import org.apache.cxf.frontend.ServerFactoryBean;
+import org.jboss.wsf.spi.annotation.EndpointConfig;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.metadata.config.ConfigMetaDataParser;
+import org.jboss.wsf.spi.metadata.config.ConfigRoot;
import org.jboss.wsf.stack.cxf.AbstractInvoker;
import org.jboss.wsf.stack.cxf.client.configuration.BeanCustomizer;
import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
@@ -40,7 +45,9 @@
private WSDLFilePublisher wsdlPublisher;
private List<Endpoint> depEndpoints;
-
+
+ private UnifiedVirtualFile deploymentRoot;
+
@SuppressWarnings("unchecked")
@Override
public void customize(Object beanInstance)
@@ -78,7 +85,33 @@
{
endpoint.setWsdlPublisher(wsdlPublisher);
}
+ //Configure according to the specified jaxws endpoint configuration
+ if (!endpoint.isPublished()) //before publishing, we set the jaxws conf
+ {
+ Object implementor = endpoint.getImplementor();
+ EndpointConfig epConfig = implementor.getClass().getAnnotation(EndpointConfig.class);
+ if (epConfig != null)
+ {
+ String configFile = epConfig.configFile();
+ try
+ {
+ UnifiedVirtualFile vf = deploymentRoot.findChild(configFile);
+ ConfigRoot config = ConfigMetaDataParser.parse(vf.toURL());
+ endpoint.setEndpointConfig(config.getEndpointConfigByName(epConfig.configName()));
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Could not find " + configFile);
+ }
+ //TODO [JBWS-3286] use default endpoint configuration as a fallback
+ }
+ }
}
+
+ public void setDeploymentRoot(UnifiedVirtualFile deploymentRoot)
+ {
+ this.deploymentRoot = deploymentRoot;
+ }
public void setWsdlPublisher(WSDLFilePublisher wsdlPublisher)
{
@@ -89,5 +122,4 @@
{
this.depEndpoints = endpoints;
}
-
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2011-05-04 12:03:07 UTC (rev 14241)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2011-05-04 21:53:28 UTC (rev 14242)
@@ -38,6 +38,7 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.spi.binding.BindingCustomization;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSSpringBusFactory;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSSpringConfigurer;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
@@ -59,7 +60,7 @@
private static final Logger log = Logger.getLogger(BusHolder.class);
private boolean configured = false;
-
+
protected BusApplicationContext ctx;
protected List<GenericApplicationContext> additionalCtx = new LinkedList<GenericApplicationContext>();
@@ -150,13 +151,14 @@
@Override
public Configurer createServerConfigurer(BindingCustomization customization, WSDLFilePublisher wsdlPublisher,
- List<Endpoint> depEndpoints)
+ List<Endpoint> depEndpoints, UnifiedVirtualFile root)
{
ApplicationContext ctx = bus.getExtension(BusApplicationContext.class);
ServerBeanCustomizer customizer = new ServerBeanCustomizer();
customizer.setBindingCustomization(customization);
customizer.setWsdlPublisher(wsdlPublisher);
customizer.setDeploymentEndpoints(depEndpoints);
+ customizer.setDeploymentRoot(root);
Configurer orig = bus.getExtension(Configurer.class);
JBossWSSpringConfigurer serverConfigurer = (orig instanceof JBossWSSpringConfigurer) ? (JBossWSSpringConfigurer)orig : new JBossWSSpringConfigurer(orig);
serverConfigurer.setApplicationContext(ctx);
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2011-05-04 12:03:07 UTC (rev 14241)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2011-05-04 21:53:28 UTC (rev 14242)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -22,8 +22,13 @@
package org.jboss.wsf.stack.cxf.deployment;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import javax.xml.namespace.QName;
+import javax.xml.ws.handler.Handler;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
@@ -32,6 +37,9 @@
import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
import org.apache.cxf.service.Service;
import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.metadata.config.CommonConfig;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
/**
* An extension of @see org.apache.cxf.jaxws.EndpointImpl for dealing with
@@ -44,6 +52,7 @@
public class EndpointImpl extends org.apache.cxf.jaxws22.EndpointImpl
{
private WSDLFilePublisher wsdlPublisher;
+ private CommonConfig config;
public EndpointImpl(Object implementor)
{
@@ -62,11 +71,143 @@
super.doPublish(addr);
//allow for configuration so that the wsdlPublisher can be set be the JBossWSCXFConfigurer
configureObject(this);
+ sortConfigHandlers();
//publish the wsdl to data/wsdl
publishContractToFilesystem();
}
/**
+ * Sets the JAXWS endpoint config for the current endpoint. This is called by configurer when
+ * org.apache.cxf.jaxws.EndpointImpl#getServer(..) executes 'configureObject(this)'
+ *
+ */
+ public void setEndpointConfig(CommonConfig config)
+ {
+ if (this.config == null)
+ {
+ this.config = config;
+ //setup using provided configuration
+ Map<String, String> epConfProps = config.getProperties();
+ if (!epConfProps.isEmpty())
+ {
+ if (getProperties() == null)
+ {
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.putAll(epConfProps);
+ setProperties(props);
+ }
+ else
+ {
+ getProperties().putAll(epConfProps);
+ }
+ }
+ @SuppressWarnings("rawtypes")
+ List<Handler> handlers = convertToHandlers(config.getPreHandlerChains());
+ handlers.addAll(convertToHandlers(config.getPostHandlerChains()));
+ if (!handlers.isEmpty())
+ {
+ if (getHandlers() != null)
+ {
+ handlers.addAll(getHandlers());
+ }
+ setHandlers(handlers);
+ }
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected List<Handler> convertToHandlers(List<UnifiedHandlerChainMetaData> handlerChains)
+ {
+ List<Handler> handlers = new LinkedList<Handler>();
+ if (handlerChains != null && !handlerChains.isEmpty())
+ {
+ for (UnifiedHandlerChainMetaData handlerChain : handlerChains)
+ {
+ if (handlerChain.getPortNamePattern() != null || handlerChain.getProtocolBindings() != null
+ || handlerChain.getServiceNamePattern() != null)
+ {
+ Logger.getLogger(this.getClass()).warn("PortNamePattern, ServiceNamePattern and ProtocolBindings filters not supported; adding handlers anyway.");
+ }
+ for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers())
+ {
+ if (uhmd.getInitParams() != null && !uhmd.getInitParams().isEmpty())
+ {
+ Logger.getLogger(this.getClass()).warn("Init params not supported.");
+ }
+ Object h = newInstance(uhmd.getHandlerClass());
+ if (h instanceof Handler)
+ {
+ handlers.add((Handler)h);
+ }
+ else
+ {
+ throw new RuntimeException(h + " is not a JAX-WS Handler instance!");
+ }
+ }
+ }
+ }
+ return handlers;
+ }
+
+ private static Object newInstance(String className)
+ {
+ try
+ {
+ Class<?> clazz = SecurityActions.getContextClassLoader().loadClass(className);
+ return clazz.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * JBWS-3282: sort handlers -> [PRE][ENDPOINT][POST]
+ * This is required after endpoint.doPublish() as that processes @HandlerChain
+ * and adds endpoint handlers after those specified before publishing
+ * (including post ones, if any).
+ */
+ @SuppressWarnings("rawtypes")
+ protected void sortConfigHandlers()
+ {
+ if (config != null)
+ {
+ //we need to move POST handlers to the end of the list
+ if (config.getPostHandlerChains() != null)
+ {
+ List<String> postHandlerNames = new LinkedList<String>();
+ for (UnifiedHandlerChainMetaData uhcm : config.getPostHandlerChains())
+ {
+ for (UnifiedHandlerMetaData uhm : uhcm.getHandlers())
+ {
+ postHandlerNames.add(uhm.getHandlerClass());
+ }
+ }
+ if (!postHandlerNames.isEmpty())
+ {
+ List<Handler> newHandlers = new LinkedList<Handler>();
+ List<Handler> postHandlers = new LinkedList<Handler>();
+ List<Handler> handlers = getBinding().getHandlerChain();
+ for (Handler h : handlers)
+ {
+ if (postHandlerNames.contains(h.getClass().getName()))
+ {
+ postHandlers.add(h);
+ }
+ else
+ {
+ newHandlers.add(h);
+ }
+ }
+ newHandlers.addAll(postHandlers);
+ getBinding().setHandlerChain(newHandlers);
+ }
+ }
+ }
+ }
+
+ /**
* Publish the contract to a file using the configured wsdl publisher
*
* @param endpoint
@@ -102,7 +243,7 @@
configurer.configureBean(instance);
}
}
-
+
@Override
public String getBeanName()
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2011-05-04 12:03:07 UTC (rev 14241)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2011-05-04 21:53:28 UTC (rev 14242)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -91,7 +91,7 @@
{
holder = new SpringBusHolder(cxfServletURL, deploymentResolver.resolve(jbosswsCxfXml));
Configurer configurer = holder.createServerConfigurer(dep.getAttachment(BindingCustomization.class),
- new WSDLFilePublisher(aDep), dep.getService().getEndpoints());
+ new WSDLFilePublisher(aDep), dep.getService().getEndpoints(), aDep.getRootFile());
holder.configure(new SoapTransportFactoryExt(), resolver, configurer);
}
catch (Exception e)
@@ -105,7 +105,7 @@
DDBeans metadata = dep.getAttachment(DDBeans.class);
holder = new NonSpringBusHolder(metadata);
Configurer configurer = holder.createServerConfigurer(dep.getAttachment(BindingCustomization.class),
- new WSDLFilePublisher(aDep), dep.getService().getEndpoints());
+ new WSDLFilePublisher(aDep), dep.getService().getEndpoints(), aDep.getRootFile());
holder.configure(new SoapTransportFactoryExt(), resolver, configurer);
}
dep.addAttachment(BusHolder.class, holder);
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2011-05-04 12:03:07 UTC (rev 14241)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2011-05-04 21:53:28 UTC (rev 14242)
@@ -21,7 +21,6 @@
*/
package org.jboss.wsf.stack.cxf.metadata;
-import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
@@ -36,14 +35,10 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.common.JavaUtils;
-import org.jboss.wsf.spi.annotation.EndpointConfig;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.metadata.config.ConfigMetaDataParser;
-import org.jboss.wsf.spi.metadata.config.ConfigRoot;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
@@ -240,8 +235,6 @@
if (portName.length() == 0)
portName = name + "Port";
- EndpointConfig epConfig = sepClass.getAnnotation(EndpointConfig.class);
-
if (anWebService != null && anWebService.endpointInterface().length() > 0)
{
seiName = anWebService.endpointInterface();
@@ -265,10 +258,6 @@
if (seiAnnotation.portName().length() > 0 || seiAnnotation.serviceName().length() > 0 || seiAnnotation.endpointInterface().length() > 0)
throw new RuntimeException("@WebService cannot have attribute 'portName', 'serviceName', 'endpointInterface' on: " + seiName);
- if (epConfig == null)
- {
- epConfig = seiClass.getAnnotation(EndpointConfig.class);
- }
}
DDEndpoint result = new DDEndpoint();
@@ -280,44 +269,11 @@
result.setEpClass(seiClass != null ? seiClass : sepClass);
result.setPortName(new QName(serviceNS, portName));
result.setServiceName(new QName(serviceNS, serviceName));
- if (epConfig != null)
- {
- configureEndpoint(dep, result, epConfig.configFile(), epConfig.configName());
- }
return result;
}
/**
- * Configures the endpoint definition according to the specified jaxws configuration
- * (provided through @EndpointConfig annotation). The specified config file is looked
- * for in the deployment. If it's not found, the specified config is searched in the
- * global server endpoint configurations.
- *
- * @param ep
- * @param configFile
- * @param configName
- */
- private void configureEndpoint(ArchiveDeployment dep, DDEndpoint ep, String configFile, String configName)
- {
- UnifiedVirtualFile vf = null;
- try
- {
- vf = dep.getRootFile().findChild(configFile);
- ConfigRoot config = ConfigMetaDataParser.parse(vf.toURL());
- org.jboss.wsf.spi.metadata.config.EndpointConfig epConfig = config.getEndpointConfigByName(configName);
- ep.setPreHandlers(convertEndpointHandlers(epConfig.getPreHandlerChains()));
- ep.setPostHandlers(convertEndpointHandlers(epConfig.getPostHandlerChains()));
- ep.setProperties(epConfig.getProperties());
- }
- catch (IOException e)
- {
- throw new RuntimeException("Could not find " + configFile);
- }
- //TODO [JBWS-3286] use default endpoint configuration as a fallback
- }
-
- /**
* Extracts the typeNS given the package name
* Algorithm is based on the one specified in JAXWS v2.0 spec
*/
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2011-05-04 12:03:07 UTC (rev 14241)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2011-05-04 21:53:28 UTC (rev 14242)
@@ -66,10 +66,6 @@
private List<String> handlers;
- private List<String> preHandlers;
-
- private List<String> postHandlers;
-
private Map<String, String> properties;
//additional fields
@@ -157,16 +153,6 @@
return handlers;
}
- public List<String> getPreHandlers()
- {
- return preHandlers;
- }
-
- public List<String> getPostHandlers()
- {
- return postHandlers;
- }
-
public boolean isMtomEnabled()
{
return mtomEnabled;
@@ -182,16 +168,6 @@
this.handlers = handlers;
}
- public void setPreHandlers(List<String> preHandlers)
- {
- this.preHandlers = preHandlers;
- }
-
- public void setPostHandlers(List<String> postHandlers)
- {
- this.postHandlers = postHandlers;
- }
-
public void setMtomEnabled(boolean mtomEnabled)
{
this.mtomEnabled = mtomEnabled;
@@ -308,27 +284,10 @@
if (this.handlers != null && !this.handlers.isEmpty())
{
writer.write("<jaxws:handlers>");
- if (this.preHandlers != null)
+ for (String handler : this.handlers)
{
- for (String handler : this.preHandlers)
- {
- writer.write("<bean class='" + handler + "'/>");
- }
+ writer.write("<bean class='" + handler + "'/>");
}
- if (this.handlers != null)
- {
- for (String handler : this.handlers)
- {
- writer.write("<bean class='" + handler + "'/>");
- }
- }
- if (this.postHandlers != null)
- {
- for (String handler : this.postHandlers)
- {
- writer.write("<bean class='" + handler + "'/>");
- }
- }
writer.write("</jaxws:handlers>");
}
14 years, 11 months
JBossWS SVN: r14241 - stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-05-04 08:03:07 -0400 (Wed, 04 May 2011)
New Revision: 14241
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250/JBWS3250TestCase.java
Log:
Fixing testsuite compile issue
Modified: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250/JBWS3250TestCase.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250/JBWS3250TestCase.java 2011-05-04 08:48:22 UTC (rev 14240)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3250/JBWS3250TestCase.java 2011-05-04 12:03:07 UTC (rev 14241)
@@ -35,7 +35,6 @@
import org.jboss.wsf.common.IOUtils;
import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestHelper;
import org.jboss.wsf.test.JBossWSTestSetup;
public class JBWS3250TestCase extends JBossWSTest
@@ -54,7 +53,7 @@
Endpoint port = Service.create(wsdlURL, serviceName).getPort(Endpoint.class);
SOAPBinding binding =(SOAPBinding)((BindingProvider)port).getBinding();
binding.setMTOMEnabled(true);
- URL url = JBossWSTestHelper.getResourceURL("jaxws/jbws3250/wsf.png");
+ URL url = getResourceURL("jaxws/jbws3250/wsf.png");
URLDataSource urlDatasource = new URLDataSource(url);
javax.activation.DataHandler dh = new DataHandler(urlDatasource);
MTOMRequest request = new MTOMRequest();
14 years, 11 months
JBossWS SVN: r14240 - spi/trunk/src/main/java/org/jboss/wsf/spi/util.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-05-04 04:48:22 -0400 (Wed, 04 May 2011)
New Revision: 14240
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java
Log:
always trim ints, booleans & qnames
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java 2011-05-04 07:52:51 UTC (rev 14239)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/StAXUtils.java 2011-05-04 08:48:22 UTC (rev 14240)
@@ -134,7 +134,7 @@
public static QName elementAsQName(XMLStreamReader reader) throws XMLStreamException
{
- String text = reader.getElementText();
+ String text = elementAsString(reader);
String localPart = text.substring(text.indexOf(':') + 1, text.length());
int i = text.indexOf(':');
String prefix = i < 0 ? null : text.substring(0, i);
@@ -144,13 +144,13 @@
public static boolean elementAsBoolean(XMLStreamReader reader) throws XMLStreamException
{
- String text = reader.getElementText();
+ String text = elementAsString(reader);
return Boolean.parseBoolean(text);
}
public static int elementAsInt(XMLStreamReader reader) throws XMLStreamException
{
- String text = reader.getElementText();
+ String text = elementAsString(reader);
return Integer.parseInt(text);
}
}
14 years, 11 months
JBossWS SVN: r14239 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850: src/test/java/org/jboss/test/ws/jaxws/binding and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-05-04 03:52:51 -0400 (Wed, 04 May 2011)
New Revision: 14239
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850/
stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpointBean.java
Log:
[JBPAPP-5850] fixed testcases
Property changes on: stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850
___________________________________________________________________
Added: svn:mergeinfo
+ /stack/native/branches/jbossws-native-2.0.1.SP2_CP:14235
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java 2011-05-04 07:35:11 UTC (rev 14238)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java 2011-05-04 07:52:51 UTC (rev 14239)
@@ -26,14 +26,9 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
-import javax.xml.ws.BindingType;
-import static javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
-
@WebService(name = "SOAPEndpoint", targetNamespace = "http://org.jboss.ws/jaxws/binding")
@SOAPBinding(style = Style.RPC)
-
-@BindingType(SOAP12HTTP_BINDING)
public interface SOAPEndpoint
{
public String namespace();
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpointBean.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpointBean.java 2011-05-04 07:35:11 UTC (rev 14238)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP07_JBPAPP-5850/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpointBean.java 2011-05-04 07:52:51 UTC (rev 14239)
@@ -23,11 +23,14 @@
// $Id: $
+import static javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
+
import javax.annotation.Resource;
import javax.jws.WebService;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingType;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.soap.SOAPMessageContext;
@@ -36,6 +39,7 @@
@WebService(name="SOAPEndpoint", targetNamespace="http://org.jboss.ws/jaxws/binding",
endpointInterface = "org.jboss.test.ws.jaxws.binding.SOAPEndpoint")
+@BindingType(SOAP12HTTP_BINDING)
public class SOAPEndpointBean implements SOAPEndpoint
{
private static Logger log = Logger.getLogger(SOAPEndpointBean.class);
14 years, 11 months
JBossWS SVN: r14238 - framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-05-04 03:35:11 -0400 (Wed, 04 May 2011)
New Revision: 14238
Added:
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/PluginBase.java
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/StackConfigurable.java
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPluginDelegate.java
Modified:
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java
framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderTestCase.java
Log:
[JBPAPP-6253] backporting additional classes to make testcase compile
Added: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/PluginBase.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/PluginBase.java (rev 0)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/PluginBase.java 2011-05-04 07:35:11 UTC (rev 14238)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.smoke.tools;
+
+import org.jboss.wsf.test.JBossWSTest;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.StringTokenizer;
+import java.util.ArrayList;
+import java.io.File;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class PluginBase extends JBossWSTest
+{
+ protected Object delegate = null;
+ protected ClassLoader origClassLoader;
+ protected String oldCPProp;
+ protected boolean integrationNative = false;
+ protected boolean integrationMetro = false;
+ protected boolean integrationCXF = false;
+
+ protected void dispatch(String methodName) throws Exception
+ {
+ try
+ {
+ delegate.getClass().getMethod(methodName).invoke(delegate);
+ }
+ catch (InvocationTargetException e)
+ {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ protected void setDelegate(Class<?> clazz) throws Exception
+ {
+ delegate = clazz.newInstance();
+ List<String> list = new LinkedList<String>();
+ for (Class<?> c : clazz.getInterfaces())
+ {
+ list.add(c.getName());
+ }
+ if (list.contains(StackConfigurable.class.getName()))
+ {
+ clazz.getMethod("setIntegrationNative", boolean.class).invoke(delegate, integrationNative);
+ clazz.getMethod("setIntegrationMetro", boolean.class).invoke(delegate, integrationMetro);
+ clazz.getMethod("setIntegrationCXF", boolean.class).invoke(delegate, integrationCXF);
+ }
+ }
+
+ protected void setupClasspath() throws Exception
+ {
+ if (!(integrationCXF || integrationMetro || integrationNative))
+ {
+ //the integration stack is not set yet, doing it before mangling with the classpath
+ readIntegrationStack();
+ }
+ String classpath = System.getProperty("surefire.test.class.path");
+ if (classpath == null) //no maven surefire classpath hacks required
+ return;
+ List<URL> jarURLs = new LinkedList<URL>();
+ StringBuffer jarURLString = new StringBuffer();
+ List<URL> classDirUrls = new LinkedList<URL>();
+
+ if (classpath != null && !classpath.equals(""))
+ {
+ StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator, false);
+ while (st.hasMoreTokens())
+ {
+ String s = st.nextToken();
+ if(s.endsWith(".jar")) // JBWS-2175: skip target/classes and target/test-classes
+ {
+ if( filtered(s) )
+ continue;
+ jarURLs.add( new File(s).toURL() );
+ jarURLString.append( s ).append(File.pathSeparator);
+ }
+ else
+ {
+ classDirUrls.add( new File(s).toURL() );
+ }
+ }
+
+ }
+
+ List<URL> jarFirstClasspath = new ArrayList<URL>();
+
+ // Replace the ThreadContextLoader to prevent loading from target/classes and target/test-classes
+ jarFirstClasspath.addAll(jarURLs);
+ jarFirstClasspath.addAll(classDirUrls);
+ URLClassLoader jarFirstClassLoader = new URLClassLoader(jarFirstClasspath.toArray( new URL[] {}), this.origClassLoader);
+
+ this.origClassLoader = Thread.currentThread().getContextClassLoader();
+
+ Thread.currentThread().setContextClassLoader(jarFirstClassLoader);
+ this.oldCPProp = System.getProperty("java.class.path");
+ System.setProperty("java.class.path", jarURLString.toString());
+ }
+
+ protected abstract boolean filtered(String jarName);
+
+ protected void restoreClasspath()
+ {
+ if(this.origClassLoader !=null)
+ {
+ Thread.currentThread().setContextClassLoader(this.origClassLoader);
+ this.origClassLoader = null;
+ System.setProperty("java.class.path", oldCPProp);
+ }
+ }
+
+ protected void readIntegrationStack()
+ {
+ this.integrationNative = isIntegrationNative();
+ this.integrationMetro = isIntegrationMetro();
+ this.integrationCXF = isIntegrationCXF();
+ }
+
+ // JBPAPP-6253 - Implement support for SOAP12 protocol in wsprovide - in JBossWS 2.x - CXF / Metro stacks don't exist
+ private boolean isIntegrationMetro()
+ {
+ return false;
+ }
+ private boolean isIntegrationCXF()
+ {
+ return false;
+ }
+}
Added: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/StackConfigurable.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/StackConfigurable.java (rev 0)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/StackConfigurable.java 2011-05-04 07:35:11 UTC (rev 14238)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.smoke.tools;
+
+public interface StackConfigurable
+{
+ public void setIntegrationNative(boolean integrationNative);
+
+ public void setIntegrationMetro(boolean integrationMetro);
+
+ public void setIntegrationCXF(boolean integrationCXF);
+}
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java 2011-05-04 07:03:29 UTC (rev 14237)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPlugin.java 2011-05-04 07:35:11 UTC (rev 14238)
@@ -126,6 +126,7 @@
+ "jaxws" + FS + "GetKeysResponse.java");
assertTrue("Source not generated", javaSource.exists());
String contents;
+
if (isIntegrationCXF())
{
System.out.println("FIXME: [JBWS-2507] Support generics in wrapper classes");
@@ -295,6 +296,7 @@
public void testMessageStream() throws Exception
{
+
if(isIntegrationMetro())
{
System.out.println("FIXME: [JBWS-1777] WSProvide output is not correctly redirected");
@@ -306,6 +308,7 @@
return;
}
+
ByteArrayOutputStream bout = new ByteArrayOutputStream();
PrintStream pout = new PrintStream(bout);
@@ -332,6 +335,36 @@
provider.setOutputDirectory(outputDirectory);
//JBWS-2479: using different beans because the whole smoke tools test is supposed to be run for every stack
//and we can't afford excluding it for Metro just because of JBWS-2479
- provider.provide(!isIntegrationMetro() ? CalculatorBean.class : CalculatorBeanNoAdapter.class);
+
+ // JBPAPP-6253 - Metro doesn't exist in JBossWS 2.x
+ //provider.provide(!isIntegrationMetro() ? CalculatorBean.class : CalculatorBeanNoAdapter.class);
+ provider.provide(CalculatorBean.class);
}
+
+ // JBPAPP-6253 - Implement support for SOAP12 protocol in wsprovide - in JBossWS 2.x - CXF / Metro stacks don't exist
+ private boolean isIntegrationCXF()
+ {
+ return false;
+ }
+
+ private boolean isIntegrationMetro()
+ {
+ return false;
+ }
+
+ private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
+ private static String testResourcesDir;
+ public File createResourceFile(String filename)
+ {
+ File resDir = new File(getTestResourcesDir());
+ File file = new File(resDir.getAbsolutePath() + File.separator + filename);
+ return file;
+ }
+ public static String getTestResourcesDir()
+ {
+ if (testResourcesDir == null)
+ testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY);
+
+ return testResourcesDir;
+ }
}
Added: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPluginDelegate.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPluginDelegate.java (rev 0)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderPluginDelegate.java 2011-05-04 07:35:11 UTC (rev 14238)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.smoke.tools;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface WSProviderPluginDelegate
+{
+ void testGenerateWsdl() throws Exception;
+
+ void testGenerateSource() throws Exception;
+
+ void testOutputDirectory() throws Exception;
+
+ void testResourceDirectory() throws Exception;
+
+ void testSourceDirectory() throws Exception;
+
+ void testClassLoader() throws Exception;
+
+ void testMessageStream() throws Exception;
+}
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderTestCase.java
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderTestCase.java 2011-05-04 07:03:29 UTC (rev 14237)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSProviderTestCase.java 2011-05-04 07:35:11 UTC (rev 14238)
@@ -38,7 +38,7 @@
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
*/
-public class WSProviderTestCase extends JBossWSTest
+public class WSProviderTestCase extends PluginBase
{
// tools delegate
WSContractProvider provider;
@@ -214,4 +214,17 @@
provider.provide(CalculatorBean.class);
}
+ /**
+ * Filter sun jaxws implementation because it clashes
+ * with the native one (ServiceLoader...)
+ * @param jarName
+ * @return
+ */
+ protected boolean filtered(String jarName)
+ {
+ return (isIntegrationNative() &&
+ (jarName.indexOf("jaxws-rt")!=-1 || jarName.indexOf("jaxws-tools")!=-1)
+ );
+ }
+
}
14 years, 11 months
JBossWS SVN: r14237 - common/trunk/src/main/java/org/jboss/wsf/common/injection.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-05-04 03:03:29 -0400 (Wed, 04 May 2011)
New Revision: 14237
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java
Log:
refactoring - removing code duplicities
Modified: common/trunk/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java 2011-05-04 06:55:01 UTC (rev 14236)
+++ common/trunk/src/main/java/org/jboss/wsf/common/injection/ThreadLocalAwareWebServiceContext.java 2011-05-04 07:03:29 UTC (rev 14237)
@@ -56,63 +56,39 @@
public EndpointReference getEndpointReference(final Element... referenceParameters)
{
- final WebServiceContext delegee = this.contexts.get();
-
- if (delegee == null)
- {
- throw new IllegalStateException();
- }
-
- return delegee.getEndpointReference(referenceParameters);
+ return getWebServiceContext().getEndpointReference(referenceParameters);
}
- public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz,
- final Element... referenceParameters)
+ public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz, final Element... referenceParameters)
{
- final WebServiceContext delegee = this.contexts.get();
-
- if (delegee == null)
- {
- throw new IllegalStateException();
- }
-
- return delegee.getEndpointReference(clazz, referenceParameters);
+ return getWebServiceContext().getEndpointReference(clazz, referenceParameters);
}
public MessageContext getMessageContext()
{
- final WebServiceContext delegee = this.contexts.get();
-
- if (delegee == null)
- {
- throw new IllegalStateException();
- }
-
- return delegee.getMessageContext();
+ return getWebServiceContext().getMessageContext();
}
public Principal getUserPrincipal()
{
- final WebServiceContext delegee = this.contexts.get();
-
- if (delegee == null)
- {
- throw new IllegalStateException();
- }
-
- return delegee.getUserPrincipal();
+ return getWebServiceContext().getUserPrincipal();
}
public boolean isUserInRole(String role)
{
- final WebServiceContext delegee = this.contexts.get();
+ return getWebServiceContext().isUserInRole(role);
+ }
+
+ private WebServiceContext getWebServiceContext()
+ {
+ final WebServiceContext delegate = contexts.get();
- if (delegee == null)
- {
- throw new IllegalStateException();
- }
-
- return delegee.isUserInRole(role);
+ if (delegate == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ return delegate;
}
}
14 years, 11 months