Author: jim.ma
Date: 2010-05-26 10:02:55 -0400 (Wed, 26 May 2010)
New Revision: 12345
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/ChangeRequestnterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/Endpoint.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/EndpointImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/JBossWSCXFConfigurerTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/WEB-INF/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/WEB-INF/jbossws-cxf.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/WEB-INF/web.xml
Removed:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/DelegatingConfigurer.java
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/JBossWSServerCXFConfigurer.java
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
Log:
[JBWS-3033]:JBossWSServerCXFConfigurer inherits from ConfigurerImpl to enable the
configuration by bean name; Provided test
Deleted:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/DelegatingConfigurer.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/DelegatingConfigurer.java 2010-05-26
13:27:20 UTC (rev 12344)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/DelegatingConfigurer.java 2010-05-26
14:02:55 UTC (rev 12345)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.wsf.stack.cxf.client.configuration;
-
-import org.apache.cxf.configuration.Configurer;
-
-/**
- * A CXF configurer that allows for custom configuration before delegating to another
configurer;
- * this is installed by JBossWS' {@see
org.jboss.wsf.stack.cxf.client.configuration.ConfigurerInstaller}
- * (see cxf-extension-jbossws.xml) to allow for custom client side configuration while
leaving
- * Apache CXF the freedom of setting the initial configurer.
- *
- * @author alessio.soldano(a)jboss.com
- * @since 04-May-2010
- */
-public abstract class DelegatingConfigurer implements Configurer
-{
- protected Configurer delegate;
-
- public DelegatingConfigurer(Configurer delegate)
- {
- this.delegate = delegate;
- }
-
- @Override
- public void configureBean(Object beanInstance)
- {
- internalConfigure(beanInstance);
- if (delegate != null)
- {
- delegate.configureBean(beanInstance);
- }
- }
-
- @Override
- public void configureBean(String name, Object beanInstance)
- {
- internalConfigure(beanInstance);
- if (delegate != null)
- {
- delegate.configureBean(name, beanInstance);
- }
- }
-
- /**
- * Performs custom configurations on the provided bean instance
- * before delegating to the other configurer.
- *
- * @param beanInstance
- */
- protected abstract void internalConfigure(Object beanInstance);
-
-}
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 2010-05-26
13:27:20 UTC (rev 12344)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2010-05-26
14:02:55 UTC (rev 12345)
@@ -140,9 +140,11 @@
public Configurer createServerConfigurer(BindingCustomization customization,
WSDLFilePublisher wsdlPublisher)
{
//the JBossWSCXFConfigurer should already be set through
cxf-extensions-jbossws.xml
- JBossWSCXFConfigurer delegate =
(JBossWSCXFConfigurer)bus.getExtension(Configurer.class);
- delegate.setBindingCustomization(customization);
- return new JBossWSServerCXFConfigurer(delegate, wsdlPublisher);
+ ApplicationContext ctx = bus.getExtension(BusApplicationContext.class);
+ JBossWSServerCXFConfigurer serverConfigurer = new JBossWSServerCXFConfigurer(ctx);
+ serverConfigurer.setBindingCustomization(customization);
+ serverConfigurer.setWsdlPublisher(wsdlPublisher);
+ return serverConfigurer;
}
/**
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java 2010-05-26
13:27:20 UTC (rev 12344)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java 2010-05-26
14:02:55 UTC (rev 12345)
@@ -22,9 +22,14 @@
package org.jboss.wsf.stack.cxf.configuration;
import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.transport.http.HTTPConduit;
import org.jboss.wsf.stack.cxf.client.configuration.DelegatingConfigurer;
+import org.jboss.wsf.stack.cxf.client.configuration.JBossWSCXFConfigurer;
import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
+import org.springframework.context.ApplicationContext;
/**
* A JBossWS CXF Configurer to be used on server side
@@ -32,30 +37,25 @@
* @author alessio.soldano(a)jboss.com
* @since 31-Mar-2010
*/
-public class JBossWSServerCXFConfigurer extends DelegatingConfigurer
+public class JBossWSServerCXFConfigurer extends JBossWSCXFConfigurer
{
private WSDLFilePublisher wsdlPublisher;
- public JBossWSServerCXFConfigurer(Configurer delegate)
+ public JBossWSServerCXFConfigurer(ApplicationContext ctx)
{
- super(delegate);
+ setApplicationContext(ctx);
+
}
-
- public JBossWSServerCXFConfigurer(Configurer delegate, WSDLFilePublisher
wsdlPublisher)
- {
- super(delegate);
- this.wsdlPublisher = wsdlPublisher;
- }
-
+
@Override
- protected void internalConfigure(Object beanInstance)
+ protected void customConfigure(Object beanInstance)
{
if (beanInstance instanceof EndpointImpl)
{
configureEndpoint((EndpointImpl)beanInstance);
}
}
-
+
protected synchronized void configureEndpoint(EndpointImpl endpoint)
{
//Configure wsdl file publisher
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2010-05-26
13:27:20 UTC (rev 12344)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2010-05-26
14:02:55 UTC (rev 12345)
@@ -45,6 +45,20 @@
<include
name="org/jboss/test/ws/jaxws/cxf/aegis/Member.class"/>
</classes>
</war>
+
+ <!-- jaxws-cxf-configuration -->
+ <war
+ warfile="${tests.output.dir}/test-libs/jaxws-cxf-configuration.war"
+
webxml="${tests.output.dir}/test-resources/jaxws/cxf/configuration/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/cxf/configuration/ChangeRequestnterceptor.class"/>
+ <include
name="org/jboss/test/ws/jaxws/cxf/configuration/Endpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/cxf/configuration/EndpointImpl.class"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/cxf/configuration/WEB-INF">
+ <include name="jbossws-cxf.xml"/>
+ </webinf>
+ </war>
<!-- jaxws-cxf-descriptor -->
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-descriptor.war"
webxml="${tests.output.dir}/test-resources/jaxws/cxf/descriptor/WEB-INF/web.xml">
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/ChangeRequestnterceptor.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/ChangeRequestnterceptor.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/ChangeRequestnterceptor.java 2010-05-26
14:02:55 UTC (rev 12345)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.cxf.configuration;
+
+import java.util.List;
+
+import org.apache.cxf.binding.soap.interceptor.RPCInInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+/**
+ * The cxf interceptor to change the request "Hello" to
"ChangedRequest"
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class ChangeRequestnterceptor extends AbstractPhaseInterceptor<Message>
+{
+ public ChangeRequestnterceptor()
+ {
+ super(Phase.UNMARSHAL);
+ addAfter(RPCInInterceptor.class.getName());
+ }
+
+ public void handleMessage(final Message message) {
+ MessageContentsList parameters =
(MessageContentsList)message.getContent(List.class);
+ parameters.set(0, "ChangedRequest");
+ }
+
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/Endpoint.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/Endpoint.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/Endpoint.java 2010-05-26
14:02:55 UTC (rev 12345)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.cxf.configuration;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * Endpoint.
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+@WebService(name = "Endpoint", targetNamespace =
"http://ws.jboss.org/jbws3033")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Endpoint
+{
+ public String echo(final String message);
+
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/EndpointImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/EndpointImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/EndpointImpl.java 2010-05-26
14:02:55 UTC (rev 12345)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.cxf.configuration;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+/**
+ * EndpointImpl.
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+@WebService(name = "Endpoint", serviceName = "EndpointService",
targetNamespace = "http://org.jboss.ws/jbws3033", endpointInterface =
"org.jboss.test.ws.jaxws.cxf.configuration.Endpoint")
+
+public class EndpointImpl implements Endpoint
+{
+ @WebMethod
+ public String echo(String input)
+ {
+ return input;
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/JBossWSCXFConfigurerTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/JBossWSCXFConfigurerTestCase.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/configuration/JBossWSCXFConfigurerTestCase.java 2010-05-26
14:02:55 UTC (rev 12345)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.cxf.configuration;
+
+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;
+
+/**
+ * To test configure bean by name auto wire
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class JBossWSCXFConfigurerTestCase extends JBossWSTest
+{
+ private String endpointURL = "http://" + getServerHost() +
":8080/jaxws-cxf-configuration";
+ private String targetNS = "http://org.jboss.ws/jbws3033";
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBossWSCXFConfigurerTestCase.class,
"jaxws-cxf-configuration.war");
+ }
+
+ //JBWS-3033
+ public void testConfiguration() throws Exception
+ {
+ URL wsdlURL = new URL(endpointURL + "?wsdl");
+ QName serviceName = new QName(targetNS, "EndpointService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+
+ Object retObj = port.echo("Hello");
+ assertEquals("ChangedRequest", retObj);
+ }
+}
\ No newline at end of file
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/WEB-INF/jbossws-cxf.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/WEB-INF/jbossws-cxf.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/WEB-INF/jbossws-cxf.xml 2010-05-26
14:02:55 UTC (rev 12345)
@@ -0,0 +1,30 @@
+<beans
xmlns='http://www.springframework.org/schema/beans'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:beans='http://www.springframework.org/schema/beans'
+
xmlns:jaxws='http://cxf.apache.org/jaxws'
+
xsi:schemaLocation='http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+
http://www.w3.org/2006/07/ws-policy http://www.w3.org/2006/07/ws-policy.xsd
+
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd'>
+
+<bean name="{http://org.jboss.ws/jbws3033}EndpointPort.jaxws-endpoint"
abstract="true">
+ <property name="inInterceptors">
+ <list>
+ <bean
class="org.jboss.test.ws.jaxws.cxf.configuration.ChangeRequestnterceptor"/>
+ <bean
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </list>
+ </property>
+
+ <property name="outInterceptors">
+ <list>
+ <bean
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+ </list>
+ </property>
+
+</bean>
+
+<bean id ="logIn"
class="org.apache.cxf.interceptor.LoggingInInterceptor">
+</bean>
+
+
+<jaxws:endpoint
implementor="org.jboss.test.ws.jaxws.cxf.configuration.EndpointImpl"
address="http://@jboss.bind.address@:8080/jaxws-cxf-configuration">
+</jaxws:endpoint>
+
+</beans>
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/WEB-INF/web.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/WEB-INF/web.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/configuration/WEB-INF/web.xml 2010-05-26
14:02:55 UTC (rev 12345)
@@ -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>EndpointService</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.cxf.configuration.EndpointImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>EndpointService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+