You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2007/11/01 08:02:32 UTC
svn commit: r590916 - in /incubator/cxf/trunk:
integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/
rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/
rt/frontend/simple/src/main/java/org/apache/cxf/frontend/
rt/ws/addr/src/test/jav...
Author: ningjiang
Date: Thu Nov 1 00:02:31 2007
New Revision: 590916
URL: http://svn.apache.org/viewvc?rev=590916&view=rev
Log:
Added some tests on the WSAFeature, also added AbstractWSDLBasedEndpointFactory missing merges
Added:
incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/spring.xml
- copied, changed from r589945, incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/server.xml
Removed:
incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/server.xml
Modified:
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/InvocationHandlerFactoryTest.java
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureTest.java
incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureXmlTest.java
Modified: incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/InvocationHandlerFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/InvocationHandlerFactoryTest.java?rev=590916&r1=590915&r2=590916&view=diff
==============================================================================
--- incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/InvocationHandlerFactoryTest.java (original)
+++ incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/InvocationHandlerFactoryTest.java Thu Nov 1 00:02:31 2007
@@ -90,7 +90,8 @@
Class[] types = {ProxyInvocationHandler.class,
ObjectMethodInvocationHandler.class,
- InvokingInvocationHandler.class};
+ InvokingInvocationHandler.class,
+ SecurityTestHandler.class};
for (int i = 0; i < types.length; i++) {
assertTrue("handler chain must contain type: " + types[i], allHandlerTypes.contains(types[i]));
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml?rev=590916&r1=590915&r2=590916&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml Thu Nov 1 00:02:31 2007
@@ -66,6 +66,7 @@
<jaxws:client id="wsdlLocation"
serviceClass="org.apache.hello_world_soap_http.Greeter"
serviceName="s:SOAPService"
+ endpointName="s:SoapPort"
xmlns:s="http://apache.org/hello_world_soap_http"
address="http://localhost:8080/simpleWithAddress"
wsdlLocation="wsdl/hello_world.wsdl"/>
Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java?rev=590916&r1=590915&r2=590916&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java Thu Nov 1 00:02:31 2007
@@ -39,6 +39,8 @@
import org.apache.cxf.service.model.BindingInfo;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.service.model.ServiceModelUtil;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
import org.apache.cxf.transport.DestinationFactory;
import org.apache.cxf.transport.DestinationFactoryManager;
import org.apache.cxf.transport.local.LocalTransportFactory;
@@ -57,6 +59,14 @@
}
protected Endpoint createEndpoint() throws BusException, EndpointException {
+ if (serviceName != null) {
+ serviceFactory.setServiceName(serviceName);
+ }
+
+ if (endpointName != null) {
+ serviceFactory.setEndpointName(endpointName);
+ }
+
Service service = serviceFactory.getService();
if (service == null) {
@@ -147,6 +157,13 @@
if (df != null) {
transportId = df.getTransportIds().get(0);
+ } else {
+ //check conduits (the address could be supported on client only)
+ ConduitInitiatorManager cim = getBus().getExtension(ConduitInitiatorManager.class);
+ ConduitInitiator ci = cim.getConduitInitiatorForUri(getAddress());
+ if (ci != null) {
+ transportId = ci.getTransportIds().get(0);
+ }
}
}
Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java?rev=590916&r1=590915&r2=590916&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java Thu Nov 1 00:02:31 2007
@@ -220,6 +220,7 @@
public void setBus(Bus bus) {
this.bus = bus;
+ clientFactoryBean.setBus(bus);
}
public Map<String, Object> getProperties() {
Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureTest.java?rev=590916&r1=590915&r2=590916&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureTest.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureTest.java Thu Nov 1 00:02:31 2007
@@ -18,14 +18,20 @@
*/
package org.apache.cxf.ws.addressing.spring;
+import java.util.List;
+
+import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.apache.cxf.test.AbstractCXFTest;
import org.apache.cxf.ws.addressing.MAPAggregator;
import org.apache.cxf.ws.addressing.WSAddressingFeature;
import org.apache.cxf.ws.addressing.soap.MAPCodec;
+import org.apache.hello_world_soap_http.Greeter;
import org.apache.hello_world_soap_http.GreeterImpl;
import org.junit.Test;
@@ -42,10 +48,26 @@
Server server = sf.create();
Endpoint endpoint = server.getEndpoint();
+ checkAddressInterceptors(endpoint.getInInterceptors());
+
+ }
+
+ @Test
+ public void testClientProxyFactory() {
+ JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean();
+ cf.setAddress("http://localhost/test");
+ cf.getFeatures().add(new WSAddressingFeature());
+ cf.setServiceClass(Greeter.class);
+ Greeter greeter = (Greeter) cf.create();
+ Client client = ClientProxy.getClient(greeter);
+ checkAddressInterceptors(client.getInInterceptors());
+ }
+
+ private void checkAddressInterceptors(List<Interceptor> interceptors) {
boolean hasAg = false;
boolean hasCodec = false;
- for (Interceptor i : endpoint.getInInterceptors()) {
+ for (Interceptor i : interceptors) {
if (i instanceof MAPAggregator) {
hasAg = true;
} else if (i instanceof MAPCodec) {
@@ -55,4 +77,5 @@
assertTrue(hasAg);
assertTrue(hasCodec);
}
+
}
Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureXmlTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureXmlTest.java?rev=590916&r1=590915&r2=590916&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureXmlTest.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/WSAFeatureXmlTest.java Thu Nov 1 00:02:31 2007
@@ -18,17 +18,23 @@
*/
package org.apache.cxf.ws.addressing.spring;
+import java.util.List;
+
import org.apache.cxf.Bus;
import org.apache.cxf.BusException;
import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.apache.cxf.test.AbstractCXFTest;
import org.apache.cxf.ws.addressing.MAPAggregator;
import org.apache.cxf.ws.addressing.soap.MAPCodec;
+import org.apache.hello_world_soap_http.Greeter;
import org.apache.hello_world_soap_http.GreeterImpl;
import org.junit.Test;
@@ -36,27 +42,46 @@
@Override
protected Bus createBus() throws BusException {
- return new SpringBusFactory().createBus("/org/apache/cxf/ws/addressing/spring/server.xml");
+ return new SpringBusFactory().createBus("/org/apache/cxf/ws/addressing/spring/spring.xml");
}
@Test
public void testServerFactory() {
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
+
+ assert bus != null;
sf.setServiceBean(new GreeterImpl());
sf.setAddress("http://localhost/test");
sf.setStart(false);
- sf.setBus(getBus());
Configurer c = getBus().getExtension(Configurer.class);
- c.configureBean("test", sf);
+ c.configureBean("server", sf);
Server server = sf.create();
Endpoint endpoint = server.getEndpoint();
+ checkAddressInterceptors(endpoint.getInInterceptors());
+ }
+
+ @Test
+ public void testClientProxyFactory() {
+
+ JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean();
+ cf.setAddress("http://localhost/test");
+ cf.setServiceClass(Greeter.class);
+ cf.setBus(getBus());
+ Configurer c = getBus().getExtension(Configurer.class);
+ c.configureBean("client.proxyFactory", cf);
+ Greeter greeter = (Greeter) cf.create();
+ Client client = ClientProxy.getClient(greeter);
+ checkAddressInterceptors(client.getInInterceptors());
+ }
+
+ private void checkAddressInterceptors(List<Interceptor> interceptors) {
boolean hasAg = false;
boolean hasCodec = false;
- for (Interceptor i : endpoint.getInInterceptors()) {
+ for (Interceptor i : interceptors) {
if (i instanceof MAPAggregator) {
hasAg = true;
} else if (i instanceof MAPCodec) {
Copied: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/spring.xml (from r589945, incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/server.xml)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/spring.xml?p2=incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/spring.xml&p1=incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/server.xml&r1=589945&r2=590916&rev=590916&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/server.xml (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/spring/spring.xml Thu Nov 1 00:02:31 2007
@@ -28,10 +28,16 @@
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schema/transports/http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
- <jaxws:server id="test" abstract="true">
+ <jaxws:server id="server" abstract="true">
<jaxws:features>
<wsa:addressing allowDuplicates="false"/>
</jaxws:features>
</jaxws:server>
+
+ <jaxws:client id="client" abstract="true">
+ <jaxws:features>
+ <wsa:addressing allowDuplicates="false"/>
+ </jaxws:features>
+ </jaxws:client>
</beans>