You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/09/02 04:21:50 UTC
svn commit: r810336 [4/4] - in /cxf/branches/2.1.x-fixes: ./
common/common/src/main/java/org/apache/cxf/staxutils/ systests/
systests/aegis/ systests/aegis/src/test/java/org/apache/cxf/systest/aegis/
systests/jaxrs/ systests/jaxrs/src/test/java/org/apa...
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java Wed Sep 2 02:21:37 2009
@@ -18,23 +18,21 @@
*/
package org.apache.cxf.systest.jms;
-import java.lang.Thread.State;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
import javax.activation.DataHandler;
-import javax.jms.DeliveryMode;
import javax.xml.namespace.QName;
import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Endpoint;
import javax.xml.ws.Holder;
import javax.xml.ws.soap.SOAPBinding;
-import javax.xml.ws.soap.SOAPFaultException;
import org.apache.cxf.endpoint.Client;
@@ -48,21 +46,15 @@
import org.apache.cxf.hello_world_jms.HelloWorldPubSubService;
import org.apache.cxf.hello_world_jms.HelloWorldQueueDecoupledOneWaysService;
import org.apache.cxf.hello_world_jms.HelloWorldService;
-import org.apache.cxf.hello_world_jms.HelloWorldServiceAppCorrelationID;
import org.apache.cxf.hello_world_jms.HelloWorldServiceAppCorrelationIDNoPrefix;
import org.apache.cxf.hello_world_jms.HelloWorldServiceAppCorrelationIDStaticPrefix;
import org.apache.cxf.hello_world_jms.HelloWorldServiceRuntimeCorrelationIDDynamicPrefix;
import org.apache.cxf.hello_world_jms.HelloWorldServiceRuntimeCorrelationIDStaticPrefix;
import org.apache.cxf.hello_world_jms.NoSuchCodeLitFault;
import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
-import org.apache.cxf.jms_greeter.JMSGreeterPortType;
-import org.apache.cxf.jms_greeter.JMSGreeterService;
-import org.apache.cxf.jms_greeter.JMSGreeterService2;
import org.apache.cxf.jms_mtom.JMSMTOMPortType;
import org.apache.cxf.jms_mtom.JMSMTOMService;
import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.systest.jaxws.Hello;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.transport.jms.AddressType;
import org.apache.cxf.transport.jms.JMSConduit;
@@ -70,7 +62,6 @@
import org.apache.cxf.transport.jms.JMSMessageHeadersType;
import org.apache.cxf.transport.jms.JMSNamingPropertyType;
import org.apache.cxf.transport.jms.JMSPropertyType;
-import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
import org.apache.hello_world_doc_lit.Greeter;
import org.apache.hello_world_doc_lit.PingMeFault;
import org.apache.hello_world_doc_lit.SOAPService2;
@@ -587,21 +578,20 @@
}
}
}
-
@Test
- public void testTwoWayQueueAppCorrelationID() throws Exception {
+ public void testTwoWayQueueAppCorrelationIDStaticPrefix() throws Exception {
QName serviceName = getServiceName(new QName("http://cxf.apache.org/hello_world_jms",
- "HelloWorldServiceAppCorrelationID"));
+ "HelloWorldServiceAppCorrelationIDStaticPrefix"));
QName portNameEng = getPortName(new QName("http://cxf.apache.org/hello_world_jms",
- "HelloWorldPortAppCorrelationIDEng"));
+ "HelloWorldPortAppCorrelationIDStaticPrefixEng"));
QName portNameSales = getPortName(new QName("http://cxf.apache.org/hello_world_jms",
- "HelloWorldPortAppCorrelationIDSales"));
+ "HelloWorldPortAppCorrelationIDStaticPrefixSales"));
URL wsdl = getClass().getResource("/wsdl/jms_test.wsdl");
assertNotNull(wsdl);
- HelloWorldServiceAppCorrelationID service =
- new HelloWorldServiceAppCorrelationID(wsdl, serviceName);
+ HelloWorldServiceAppCorrelationIDStaticPrefix service =
+ new HelloWorldServiceAppCorrelationIDStaticPrefix(wsdl, serviceName);
assertNotNull(service);
ClientRunnable engClient =
@@ -629,53 +619,7 @@
}
for (Thread t : threads) {
- t.join(5000);
- }
-
- Throwable e = (engClient.getException() != null)
- ? engClient.getException()
- : (salesClient.getException() != null)
- ? salesClient.getException() : null;
-
- if (e != null) {
- StringBuffer message = new StringBuffer();
- for (StackTraceElement ste : e.getStackTrace()) {
- message.append(ste.toString() + System.getProperty("line.separator"));
- }
- fail(message.toString());
- }
- }
-
- @Test
- public void testTwoWayQueueAppCorrelationIDStaticPrefix() throws Exception {
- QName serviceName = getServiceName(new QName("http://cxf.apache.org/hello_world_jms",
- "HelloWorldServiceAppCorrelationIDStaticPrefix"));
- QName portNameEng = getPortName(new QName("http://cxf.apache.org/hello_world_jms",
- "HelloWorldPortAppCorrelationIDStaticPrefixEng"));
- QName portNameSales = getPortName(new QName("http://cxf.apache.org/hello_world_jms",
- "HelloWorldPortAppCorrelationIDStaticPrefixSales"));
-
- URL wsdl = getClass().getResource("/wsdl/jms_test.wsdl");
- assertNotNull(wsdl);
-
- HelloWorldServiceAppCorrelationIDStaticPrefix service =
- new HelloWorldServiceAppCorrelationIDStaticPrefix(wsdl, serviceName);
- assertNotNull(service);
-
- ClientRunnable engClient =
- new ClientRunnable(service.getPort(portNameEng, HelloWorldPortType.class));
-
- ClientRunnable salesClient =
- new ClientRunnable(service.getPort(portNameSales, HelloWorldPortType.class));
-
- Thread[] threads = new Thread[] {new Thread(engClient), new Thread(salesClient)};
-
- for (Thread t : threads) {
- t.start();
- }
-
- for (Thread t : threads) {
- t.join(1000);
+ t.join(10000);
}
Throwable e = (engClient.getException() != null)
@@ -718,26 +662,39 @@
HelloWorldPortType port = service.getPort(portName, HelloWorldPortType.class);
- for (int i = 0; i < 1; ++i) {
- ClientRunnable client = new ClientRunnable(port);
+ for (int i = 0; i < 10; ++i) {
+ ClientRunnable client =
+ new ClientRunnable(port,
+ new CorrelationIDFactory() {
+ public String createCorrealtionID() {
+ return UUID.randomUUID().toString();
+ }
+ });
+
Thread thread = new Thread(client);
threads.add(thread);
clients.add(client);
thread.start();
}
- for (Thread t : threads) {
- t.join(5000);
- assertTrue("Not terminated state: " + t.getState(), t.getState() == State.TERMINATED);
- }
-
- for (ClientRunnable client : clients) {
- if (client.getException() != null
- && client.getException().getMessage().contains("Timeout")) {
- fail(client.getException().getMessage());
+ //Sleep for up to 10 seconds. The timeout should be at 5 seconds so this
+ //should bail earlier
+ for (int x = 0; x < 10; x++) {
+ Thread.sleep(1000);
+
+ for (ClientRunnable client : clients) {
+ if (client.getException() != null
+ && client.getException().getMessage().contains("Timeout")) {
+ // exceptions expected
+ return;
+ }
}
}
+ fail("This is a negative pass. If this test passed this means that the missing QoS"
+ + " has been added to the runtime or an unexpected exception received. "
+ + " If latter is true, then read method comments for details on missing QoS"
+ + " and change this test to fail on exception");
}
/*
@@ -789,7 +746,7 @@
HelloWorldPortType portEng = service.getPort(portNameEng, HelloWorldPortType.class);
HelloWorldPortType portSales = service.getPort(portNameSales, HelloWorldPortType.class);
- for (int i = 0; i < 10; ++i) {
+ for (int i = 0; i < 5; ++i) {
ClientRunnable client = new ClientRunnable(portEng, "com.mycompany.eng:");
Thread thread = new Thread(client);
threads.add(thread);
@@ -801,11 +758,12 @@
clients.add(client);
thread.start();
}
-
+
for (Thread t : threads) {
- t.join(1000);
+ t.join(10000);
}
+
for (ClientRunnable client : clients) {
if (client.getException() != null
&& client.getException().getMessage().contains("Timeout")) {
@@ -835,7 +793,8 @@
HelloWorldPortType port = service.getPort(portName, HelloWorldPortType.class);
for (int i = 0; i < 10; ++i) {
- ClientRunnable client = new ClientRunnable(port);
+ ClientRunnable client =
+ new ClientRunnable(port);
Thread thread = new Thread(client);
threads.add(thread);
@@ -844,7 +803,7 @@
}
for (Thread t : threads) {
- t.join(1000);
+ t.join(10000);
}
for (ClientRunnable client : clients) {
@@ -937,146 +896,4 @@
byte bytes[] = IOUtils.readBytesFromStream(handler1.value.getInputStream());
assertEquals("The response file is not same with the sent file.", size, bytes.length);
}
-
- @Test
- public void testSpecJMS() throws Exception {
- QName serviceName = getServiceName(new QName("http://cxf.apache.org/jms_greeter",
- "JMSGreeterService"));
- QName portName = getPortName(new QName("http://cxf.apache.org/jms_greeter", "GreeterPort"));
- URL wsdl = getWSDLURL("/wsdl/jms_spec_test.wsdl");
- assertNotNull(wsdl);
-
- JMSGreeterService service = new JMSGreeterService(wsdl, serviceName);
- assertNotNull(service);
-
- String response1 = new String("Hello Milestone-");
- String response2 = new String("Bonjour");
- JMSGreeterPortType greeter = service.getPort(portName, JMSGreeterPortType.class);
- for (int idx = 0; idx < 5; idx++) {
-
- greeter.greetMeOneWay("test String");
-
- String greeting = greeter.greetMe("Milestone-" + idx);
- assertNotNull("no response received from service", greeting);
- String exResponse = response1 + idx;
- assertEquals(exResponse, greeting);
-
- String reply = greeter.sayHi();
- assertNotNull("no response received from service", reply);
- assertEquals(response2, reply);
- }
- }
-
- @Test
- public void testWsdlExtensionSpecJMS() throws Exception {
- QName serviceName = getServiceName(new QName("http://cxf.apache.org/jms_greeter",
- "JMSGreeterService"));
- QName portName = getPortName(new QName("http://cxf.apache.org/jms_greeter", "GreeterPort"));
- URL wsdl = getWSDLURL("/wsdl/jms_spec_test.wsdl");
- assertNotNull(wsdl);
-
- JMSGreeterService service = new JMSGreeterService(wsdl, serviceName);
- assertNotNull(service);
-
- String response = new String("Bonjour");
- try {
- JMSGreeterPortType greeter = service.getPort(portName, JMSGreeterPortType.class);
- Map<String, Object> requestContext = ((BindingProvider)greeter).getRequestContext();
- JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
- requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
-
- String reply = greeter.sayHi();
- assertNotNull("no response received from service", reply);
- assertEquals(response, reply);
-
- requestContext = ((BindingProvider)greeter).getRequestContext();
- requestHeader = (JMSMessageHeadersType)requestContext
- .get(JMSConstants.JMS_CLIENT_REQUEST_HEADERS);
- assertEquals(requestHeader.getSOAPJMSBindingVersion(), "1.0");
- assertEquals(requestHeader.getSOAPJMSSOAPAction(), "\"test\"");
- assertEquals(requestHeader.getTimeToLive(), 3000);
- assertEquals(requestHeader.getJMSDeliveryMode(), DeliveryMode.PERSISTENT);
- assertEquals(requestHeader.getJMSPriority(), 7);
-
- Map<String, Object> responseContext = ((BindingProvider)greeter).getResponseContext();
- JMSMessageHeadersType responseHeader = (JMSMessageHeadersType)responseContext
- .get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
- assertEquals(responseHeader.getSOAPJMSBindingVersion(), "1.0");
- assertEquals(responseHeader.getSOAPJMSSOAPAction(), null);
- assertEquals(responseHeader.getJMSDeliveryMode(), DeliveryMode.PERSISTENT);
- assertEquals(responseHeader.getJMSPriority(), 7);
-
- } catch (UndeclaredThrowableException ex) {
- throw (Exception)ex.getCause();
- }
- }
-
- @Test
- public void testWsdlExtensionSpecJMSPortError() throws Exception {
- QName serviceName = getServiceName(new QName("http://cxf.apache.org/jms_greeter",
- "JMSGreeterService2"));
- QName portName = getPortName(new QName("http://cxf.apache.org/jms_greeter", "GreeterPort2"));
- URL wsdl = getWSDLURL("/wsdl/jms_spec_test.wsdl");
- assertNotNull(wsdl);
-
- JMSGreeterService2 service = new JMSGreeterService2(wsdl, serviceName);
- assertNotNull(service);
-
- String response = new String("Bonjour");
- JMSGreeterPortType greeter = service.getPort(portName, JMSGreeterPortType.class);
- String reply = greeter.sayHi();
- assertNotNull("no response received from service", reply);
- assertEquals(response, reply);
- }
-
- @Test
- public void testSpecNoWsdlService() throws Exception {
- String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue3"
- + "?jndiInitialContextFactory"
- + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
- + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61500";
-
- JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
- factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
- factory.setServiceClass(Hello.class);
- factory.setAddress(address);
- Hello client = (Hello)factory.create();
- String reply = client.sayHi(" HI");
- assertEquals(reply, "get HI");
- }
-
- @Test
- public void testBindingVersionError() throws Exception {
- QName serviceName = getServiceName(new QName("http://cxf.apache.org/jms_greeter",
- "JMSGreeterService"));
- QName portName = getPortName(new QName("http://cxf.apache.org/jms_greeter", "GreeterPort"));
- URL wsdl = getWSDLURL("/wsdl/jms_spec_test.wsdl");
- assertNotNull(wsdl);
-
- JMSGreeterService service = new JMSGreeterService(wsdl, serviceName);
- assertNotNull(service);
-
- JMSGreeterPortType greeter = service.getPort(portName, JMSGreeterPortType.class);
- BindingProvider bp = (BindingProvider)greeter;
-
- Map<String, Object> requestContext = bp.getRequestContext();
- JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
- requestHeader.setSOAPJMSBindingVersion("0.3");
- requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
-
- try {
- greeter.greetMe("Milestone-");
- fail("Should have thrown a fault");
- } catch (SOAPFaultException ex) {
- assertTrue(ex.getMessage().contains("0.3"));
- Map<String, Object> responseContext = bp.getResponseContext();
- JMSMessageHeadersType responseHdr =
- (JMSMessageHeadersType)responseContext.get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
- if (responseHdr == null) {
- fail("response Header should not be null");
- }
- assertTrue(responseHdr.isSOAPJMSIsFault());
- }
-
- }
}
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/jms/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/jms/Server.java?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/jms/Server.java (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/jms/Server.java Wed Sep 2 02:21:37 2009
@@ -23,11 +23,7 @@
import javax.xml.ws.soap.SOAPBinding;
import org.apache.cxf.jaxws.EndpointImpl;
-import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
-import org.apache.cxf.systest.jaxws.Hello;
-import org.apache.cxf.systest.jaxws.HelloImpl;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
public class Server extends AbstractBusTestServerBase {
@@ -46,8 +42,6 @@
Object i4 = new GreeterImplTwoWayJMSRuntimeCorrelationIDDynamicPrefix();
Object i5 = new GreeterImplTwoWayJMSRuntimeCorrelationIDStaticPrefixEng();
Object i6 = new GreeterImplTwoWayJMSRuntimeCorrelationIDStaticPrefixSales();
- Object i7 = new GreeterImplTwoWayJMSAppCorrelationIDEng();
- Object i8 = new GreeterImplTwoWayJMSAppCorrelationIDSales();
Object mtom = new JMSMTOMImpl();
Endpoint.publish(null, impleDoc);
@@ -64,45 +58,9 @@
Endpoint.publish("", i4);
Endpoint.publish("", i5);
Endpoint.publish("", i6);
- Endpoint.publish("", i7);
- Endpoint.publish("", i8);
EndpointImpl ep = (EndpointImpl)Endpoint.publish("http://cxf.apache.org/transports/jms", mtom);
Binding binding = ep.getBinding();
((SOAPBinding)binding).setMTOMEnabled(true);
-
- Object spec1 = new GreeterSpecImpl();
- String address1 = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue2"
- + "?jndiInitialContextFactory"
- + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
- + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61500";
- Endpoint.publish(address1, spec1);
-
- Object spec2 = new GreeterSpecWithPortError();
- String address2 = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue5"
- + "?jndiInitialContextFactory"
- + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
- + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61500";
- Endpoint.publish(address2, spec2);
-
- initNoWsdlServer();
- }
-
-
- /**
- *
- */
- private void initNoWsdlServer() {
- String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue3"
- + "?jndiInitialContextFactory"
- + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
- + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61500";
- Hello implementor = new HelloImpl();
- JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
- svrFactory.setServiceClass(Hello.class);
- svrFactory.setAddress(address);
- svrFactory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
- svrFactory.setServiceBean(implementor);
- svrFactory.create();
}
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/lifecycle/LifeCycleTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/lifecycle/LifeCycleTest.java?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/lifecycle/LifeCycleTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/lifecycle/LifeCycleTest.java Wed Sep 2 02:21:37 2009
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
+import javax.jws.WebService;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
@@ -33,7 +34,6 @@
import org.apache.cxf.endpoint.ServerLifeCycleManager;
import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.greeter_control.ControlImpl;
-import org.apache.cxf.systest.ws.addressing.GreeterImpl;
import org.apache.cxf.ws.addressing.WSAddressingFeature;
import org.junit.After;
@@ -181,5 +181,14 @@
}
}
}
+
+
+ @WebService(serviceName = "SOAPServiceAddressing",
+ portName = "SoapPort",
+ endpointInterface = "org.apache.hello_world_soap_http.Greeter",
+ targetNamespace = "http://apache.org/hello_world_soap_http",
+ wsdlLocation = "testutils/hello_world.wsdl")
+ public class GreeterImpl extends org.apache.hello_world_soap_http.BaseGreeterImpl {
+ }
}
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java Wed Sep 2 02:21:37 2009
@@ -183,7 +183,7 @@
priceData.setTickerPrice(1.0f);
priceData.setTickerSymbol("CELTIX");
- assertFalse(check(0, putLastTradedPrice, false, true, priceData));
+ assertTrue(check(0, putLastTradedPrice, false, true, priceData));
assertFalse(check(1, putLastTradedPrice, false, true, priceData));
assertTrue(check(2, putLastTradedPrice, false, true, priceData));
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/resolver/JarResolverTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/resolver/JarResolverTest.java?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/resolver/JarResolverTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/resolver/JarResolverTest.java Wed Sep 2 02:21:37 2009
@@ -52,6 +52,7 @@
ServiceContractResolverRegistryImpl registry =
new ServiceContractResolverRegistryImpl();
registry.setBus(bus);
+ registry.init();
assertNotNull(bus.getExtension(ServiceContractResolverRegistry.class));
JarServiceContractResolver resolver = new JarServiceContractResolver();
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/SchemaValidationImpl.java Wed Sep 2 02:21:37 2009
@@ -32,7 +32,6 @@
portName = "SoapPort",
endpointInterface = "org.apache.schema_validation.SchemaValidation",
targetNamespace = "http://apache.org/schema_validation")
-@org.apache.cxf.annotations.SchemaValidation
public class SchemaValidationImpl implements SchemaValidation {
public boolean setComplexStruct(ComplexStruct in) {
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java Wed Sep 2 02:21:37 2009
@@ -24,10 +24,8 @@
import java.util.List;
import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceException;
-import org.apache.cxf.message.Message;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.schema_validation.SchemaValidation;
import org.apache.schema_validation.SchemaValidationService;
@@ -45,7 +43,12 @@
@BeforeClass
public static void startservers() throws Exception {
- assertTrue("server did not launch correctly", launchServer(ValidationServer.class, true));
+ // set up configuration to enable schema validation
+ URL url = ValidationClientServerTest.class.getResource("cxf-config.xml");
+ assertNotNull("cannot find test resource", url);
+ defaultConfigFileName = url.toString();
+
+ assertTrue("server did not launch correctly", launchServer(ValidationServer.class));
}
// TODO : Change this test so that we test the combinations of
@@ -53,6 +56,7 @@
// Only tests client side validation enabled/server side disabled.
@Test
public void testSchemaValidation() throws Exception {
+ System.setProperty("cxf.config.file.url", getClass().getResource("cxf-config.xml").toString());
URL wsdl = getClass().getResource("/wsdl/schema_validation.wsdl");
assertNotNull(wsdl);
@@ -60,8 +64,6 @@
assertNotNull(service);
SchemaValidation validation = service.getPort(portName, SchemaValidation.class);
- ((BindingProvider)validation).getRequestContext()
- .put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
ComplexStruct complexStruct = new ComplexStruct();
complexStruct.setElem1("one");
@@ -72,7 +74,7 @@
try {
/*boolean result =*/
validation.setComplexStruct(complexStruct);
- fail("Set ComplexStruct should have thrown ProtocolException");
+ fail("Set ComplexStruct hould have thrown ProtocolException");
} catch (WebServiceException e) {
String expected = "'{\"http://apache.org/schema_validation/types\":elem2}' is expected.";
assertTrue(e.getMessage(), e.getMessage().indexOf(expected) != -1);
@@ -88,13 +90,11 @@
try {
/*boolean result =*/
validation.setOccuringStruct(occuringStruct);
- fail("Set OccuringStruct should have thrown ProtocolException");
+ fail("Set OccuringStruct hould have thrown ProtocolException");
} catch (WebServiceException e) {
String expected = "'{\"http://apache.org/schema_validation/types\":varFloat}' is expected.";
assertTrue(e.getMessage().indexOf(expected) != -1);
}
- ((BindingProvider)validation).getRequestContext()
- .put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
try {
// The server will attempt to return an invalid ComplexStruct
@@ -109,8 +109,6 @@
e.getMessage().indexOf(expected) != -1);
}
- ((BindingProvider)validation).getRequestContext()
- .put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
try {
// The server will attempt to return an invalid OccuringStruct
// When validation is disabled on the server side, we'll get the
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/schema_validation/ValidationServer.java Wed Sep 2 02:21:37 2009
@@ -19,6 +19,7 @@
package org.apache.cxf.systest.schema_validation;
+import java.net.URL;
import javax.xml.ws.Endpoint;
@@ -26,7 +27,14 @@
public class ValidationServer extends AbstractBusTestServerBase {
+ private String oldConfig;
+
public ValidationServer() {
+ oldConfig = System.getProperty("cxf.config.file.url");
+ URL url = getClass().getResource("cxf-config.xml");
+ if (url != null) {
+ System.setProperty("cxf.config.file.url", url.toString());
+ }
}
protected void run() {
@@ -35,7 +43,12 @@
Endpoint.publish(address, implementor);
}
-
+ public boolean stopInProcess() throws Exception {
+ if (oldConfig != null) {
+ System.setProperty("cxf.config.file.url", oldConfig);
+ }
+ return super.stopInProcess();
+ }
public static void main(String[] args) {
try {
Propchange: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Sep 2 02:21:37 2009
@@ -0,0 +1,2 @@
+/cxf/branches/2.2.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java:810203-810224,810236
+/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java:809663,809706
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/xmlbeans/cxf.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/xmlbeans/cxf.xml?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/xmlbeans/cxf.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/xmlbeans/cxf.xml Wed Sep 2 02:21:37 2009
@@ -33,9 +33,9 @@
<!-- jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties-->
- <!-- jaxws:dataBinding>
+ <jaxws:dataBinding>
<bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"/>
- </jaxws:dataBinding-->
+ </jaxws:dataBinding>
</jaxws:client>
<jaxws:endpoint name="{http://apache.org/hello_world_soap_http/xmlbeans}SoapPort"
@@ -44,9 +44,9 @@
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
- <!-- jaxws:dataBinding>
+ <jaxws:dataBinding>
<bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"/>
- </jaxws:dataBinding-->
+ </jaxws:dataBinding>
</jaxws:endpoint>
</beans>
Modified: cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/xmlbeans/cxf_no_wsdl.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/xmlbeans/cxf_no_wsdl.xml?rev=810336&r1=810335&r2=810336&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/xmlbeans/cxf_no_wsdl.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/xmlbeans/cxf_no_wsdl.xml Wed Sep 2 02:21:37 2009
@@ -33,9 +33,9 @@
<!-- jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties-->
- <!-- jaxws:dataBinding>
+ <jaxws:dataBinding>
<bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"/>
- </jaxws:dataBinding-->
+ </jaxws:dataBinding>
</jaxws:client>
<jaxws:endpoint name="{http://apache.org/hello_world_soap_http/xmlbeans}SoapPort"
@@ -43,9 +43,9 @@
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
- <!-- jaxws:dataBinding>
+ <jaxws:dataBinding>
<bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"/>
- </jaxws:dataBinding-->
+ </jaxws:dataBinding>
</jaxws:endpoint>
</beans>
Copied: cxf/branches/2.1.x-fixes/systests/ws-specs/pom.xml (from r809800, cxf/branches/2.2.x-fixes/systests/ws-specs/pom.xml)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/ws-specs/pom.xml?p2=cxf/branches/2.1.x-fixes/systests/ws-specs/pom.xml&p1=cxf/branches/2.2.x-fixes/systests/ws-specs/pom.xml&r1=809800&r2=810336&rev=810336&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/ws-specs/pom.xml Wed Sep 2 02:21:37 2009
@@ -21,19 +21,15 @@
<parent>
<artifactId>cxf-parent</artifactId>
<groupId>org.apache.cxf</groupId>
- <version>2.3.0-SNAPSHOT</version>
+ <version>2.1.7-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-systests-ws-specs</artifactId>
<name>Apache CXF WS-* Specifications System Tests</name>
- <version>2.3.0-SNAPSHOT</version>
+ <version>2.1.7-SNAPSHOT</version>
<url>http://cxf.apache.org</url>
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/cxf/trunk/systests/ws-specs</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/cxf/trunk/systests/ws-specs</developerConnection>
- </scm>
<build>
<plugins>
<plugin>
@@ -73,58 +69,6 @@
</executions>
</plugin>
<plugin>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-codegen-plugin</artifactId>
- <version>${project.version}</version>
- <executions>
- <execution>
- <id>generate-wssec10-test-sources</id>
- <phase>generate-test-sources</phase>
- <configuration>
- <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
- <wsdlOptions>
- <wsdlOption>
- <wsdl>${basedir}/src/test/resources/wsdl_systest_wsspec/wssec10/WsSecurity10.wsdl</wsdl>
- </wsdlOption>
- </wsdlOptions>
- </configuration>
- <goals>
- <goal>wsdl2java</goal>
- </goals>
- </execution>
- <execution>
- <id>generate-wssec11-test-sources</id>
- <phase>generate-test-sources</phase>
- <configuration>
- <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
- <wsdlOptions>
- <wsdlOption>
- <wsdl>${basedir}/src/test/resources/wsdl_systest_wsspec/wssec11/WsSecurity11.wsdl</wsdl>
- </wsdlOption>
- </wsdlOptions>
- </configuration>
- <goals>
- <goal>wsdl2java</goal>
- </goals>
- </execution>
- <execution>
- <id>generate-wssc-test-sources</id>
- <phase>generate-test-sources</phase>
- <configuration>
- <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
- <wsdlOptions>
- <wsdlOption>
- <wsdl>${basedir}/src/test/resources/wsdl_systest_wsspec/wssc/WSSecureConversation.wsdl</wsdl>
- </wsdlOption>
- </wsdlOptions>
- </configuration>
- <goals>
- <goal>wsdl2java</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
Copied: cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java (from r809800, cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java?p2=cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java&p1=cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java&r1=809800&r2=810336&rev=810336&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java (original)
+++ cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/Server.java Wed Sep 2 02:21:37 2009
@@ -19,29 +19,7 @@
package org.apache.cxf.systest.ws.addr_wsdl;
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Endpoint;
-import javax.xml.ws.Provider;
-import javax.xml.ws.Service.Mode;
-import javax.xml.ws.ServiceMode;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.WebServiceProvider;
-import javax.xml.ws.soap.Addressing;
-import javax.xml.xpath.XPathConstants;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
import org.apache.cxf.BusFactory;
-import org.apache.cxf.helpers.XPathUtils;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -56,10 +34,8 @@
null,
getWsdl());
+ //EndpointImpl ep = (EndpointImpl) Endpoint.create(implementor);
ep.publish(address);
-
- Endpoint.publish(address + "-provider", new AddNumberProvider());
- Endpoint.publish(address + "-providernows", new AddNumberProviderNoWsdl());
}
private String getWsdl() {
@@ -83,62 +59,4 @@
System.out.println("done!");
}
}
-
-
- @WebServiceProvider(serviceName = "AddNumbersService",
- targetNamespace = "http://apache.org/cxf/systest/ws/addr_feature/",
- wsdlLocation = "/wsdl_systest_wsspec/add_numbers.wsdl")
- @ServiceMode(Mode.PAYLOAD)
- public static class AddNumberProvider implements Provider<Source> {
-
- public Source invoke(Source obj) {
- //CHECK the incoming
- DOMSource ds = (DOMSource)obj;
-
- Element el = ((Document)ds.getNode()).getDocumentElement();
- Map<String, String> ns = new HashMap<String, String>();
- ns.put("ns", "http://apache.org/cxf/systest/ws/addr_feature/");
- XPathUtils xp = new XPathUtils(ns);
- String o = (String)xp.getValue("/ns:addNumbers/ns:number1", el, XPathConstants.STRING);
- String o2 = (String)xp.getValue("/ns:addNumbers/ns:number2", el, XPathConstants.STRING);
- int i = Integer.parseInt(o);
- int i2 = Integer.parseInt(o2);
-
- String resp = "<addNumbersResponse xmlns=\"http://apache.org/cxf/systest/ws/addr_feature/\">"
- + "<return>" + (i + i2) + "</return></addNumbersResponse>";
- return new StreamSource(new StringReader(resp));
- }
- }
-
- @WebServiceProvider(serviceName = "AddNumbersService",
- targetNamespace = "http://apache.org/cxf/systest/ws/addr_feature/")
- @ServiceMode(Mode.PAYLOAD)
- @Addressing(enabled = true, required = true)
- public static class AddNumberProviderNoWsdl implements Provider<Source> {
- @Resource
- WebServiceContext ctx;
-
- public Source invoke(Source obj) {
- //CHECK the incoming
- DOMSource ds = (DOMSource)obj;
-
- Element el = ((Document)ds.getNode()).getDocumentElement();
- Map<String, String> ns = new HashMap<String, String>();
- ns.put("ns", "http://apache.org/cxf/systest/ws/addr_feature/");
- XPathUtils xp = new XPathUtils(ns);
- String o = (String)xp.getValue("/ns:addNumbers/ns:number1", el, XPathConstants.STRING);
- String o2 = (String)xp.getValue("/ns:addNumbers/ns:number2", el, XPathConstants.STRING);
- int i = Integer.parseInt(o);
- int i2 = Integer.parseInt(o2);
-
-
- ctx.getMessageContext()
- .put(BindingProvider.SOAPACTION_URI_PROPERTY,
- "http://apache.org/cxf/systest/ws/addr_feature/AddNumbersPortType/addNumbersResponse");
-
- String resp = "<addNumbersResponse xmlns=\"http://apache.org/cxf/systest/ws/addr_feature/\">"
- + "<return>" + (i + i2) + "</return></addNumbersResponse>";
- return new StreamSource(new StringReader(resp));
- }
- }
}
Copied: cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java (from r809800, cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java?p2=cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java&p1=cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java&r1=809800&r2=810336&rev=810336&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java Wed Sep 2 02:21:37 2009
@@ -20,15 +20,9 @@
package org.apache.cxf.systest.ws.addr_wsdl;
import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
import java.net.URL;
import javax.xml.namespace.QName;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service.Mode;
-import javax.xml.ws.handler.MessageContext;
import org.apache.cxf.systest.ws.AbstractWSATestBase;
import org.apache.cxf.systest.ws.addr_feature.AddNumbersPortType;
@@ -49,7 +43,7 @@
@BeforeClass
public static void startServers() throws Exception {
- assertTrue("server did not launch correctly", launchServer(Server.class, true));
+ assertTrue("server did not launch correctly", launchServer(Server.class));
}
@Test
@@ -71,88 +65,6 @@
assertTrue(output.toString().indexOf(expectedOut) != -1);
assertTrue(input.toString().indexOf(expectedIn) != -1);
}
- @Test
- public void testProviderEndpoint() throws Exception {
- String base = "http://apache.org/cxf/systest/ws/addr_feature/AddNumbersPortType/";
- String expectedOut = base + "addNumbersRequest</Action>";
- String expectedIn = base + "addNumbersResponse</Action>";
-
- ByteArrayOutputStream input = setupInLogging();
- ByteArrayOutputStream output = setupOutLogging();
-
- AddNumbersPortType port = getPort();
- ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- "http://localhost:9094/jaxws/add-provider");
- assertEquals(3, port.addNumbers(1, 2));
-
-
- assertTrue(output.toString().indexOf(expectedOut) != -1);
- assertTrue(input.toString().indexOf(expectedIn) != -1);
-
- output.reset();
- input.reset();
-
- ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- "http://localhost:9094/jaxws/add-providernows");
- assertEquals(3, port.addNumbers(1, 2));
-
- assertTrue(output.toString().indexOf(expectedOut) != -1);
- assertTrue(input.toString().indexOf(expectedIn) != -1);
- }
-
- @Test
- public void testBasicDispatchInvocation() throws Exception {
- String req = "<addNumbers xmlns=\"http://apache.org/cxf/systest/ws/addr_feature/\">"
- + "<number1>1</number1><number2>2</number2></addNumbers>";
- String base = "http://apache.org/cxf/systest/ws/addr_feature/AddNumbersPortType/";
- String expectedOut = base + "addNumbersRequest";
- String expectedIn = base + "addNumbersResponse</Action>";
-
-
- ByteArrayOutputStream input = setupInLogging();
- ByteArrayOutputStream output = setupOutLogging();
-
- URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");
- assertNotNull("WSDL is null", wsdl);
- AddNumbersService service = new AddNumbersService(wsdl, serviceName);
-
-
- Dispatch<Source> disp = service.createDispatch(AddNumbersService.AddNumbersPort,
- Source.class, Mode.PAYLOAD);
-
- disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- "http://localhost:9094/jaxws/add");
-
- //manually set the action
- disp.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY,
- expectedOut);
- disp.invoke(new StreamSource(new StringReader(req)));
-
- assertTrue(output.toString().indexOf(expectedOut) != -1);
- assertTrue(input.toString().indexOf(expectedIn) != -1);
-
-
- output.reset();
- input.reset();
-
- disp = service.createDispatch(AddNumbersService.AddNumbersPort,
- Source.class, Mode.PAYLOAD);
-
- disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- "http://localhost:9094/jaxws/add");
-
- //set the operation name so action can be pulled from the wsdl
- disp.getRequestContext().put(MessageContext.WSDL_OPERATION,
- new QName("http://apache.org/cxf/systest/ws/addr_feature/",
- "addNumbers"));
-
- disp.invoke(new StreamSource(new StringReader(req)));
-
- assertTrue(output.toString().indexOf(expectedOut) != -1);
- assertTrue(input.toString().indexOf(expectedIn) != -1);
-
-
- }
private AddNumbersPortType getPort() {
URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");
Copied: cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java (from r809800, cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java?p2=cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java&p1=cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java&r1=809800&r2=810336&rev=810336&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/AddressingInlinePolicyTest.java Wed Sep 2 02:21:37 2009
@@ -35,8 +35,9 @@
import org.apache.cxf.systest.ws.util.ConnectionHelper;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.apache.cxf.ws.policy.PolicyInInterceptor;
-import org.apache.cxf.ws.policy.PolicyOutInterceptor;
+import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.cxf.ws.policy.ServerPolicyInInterceptor;
+import org.apache.cxf.ws.policy.ServerPolicyOutInterceptor;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -87,6 +88,8 @@
SpringBusFactory bf = new SpringBusFactory();
bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-inline-policy-old.xml");
+ PolicyTestUtils.setPolicyConstants(bus,
+ PolicyConstants.NAMESPACE_W3_200607);
BusFactory.setDefaultBus(bus);
@@ -128,14 +131,14 @@
boolean hasServerOut = false;
List<Interceptor> inInterceptors = b.getInInterceptors();
for (Interceptor i : inInterceptors) {
- if (i instanceof PolicyInInterceptor) {
+ if (i instanceof ServerPolicyInInterceptor) {
hasServerIn = true;
}
}
assertTrue(hasServerIn);
for (Interceptor i : b.getOutInterceptors()) {
- if (i instanceof PolicyOutInterceptor) {
+ if (i instanceof ServerPolicyOutInterceptor) {
hasServerOut = true;
}
}
Copied: cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java (from r809800, cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java?p2=cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java&p1=cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java&r1=809800&r2=810336&rev=810336&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java Wed Sep 2 02:21:37 2009
@@ -19,34 +19,14 @@
package org.apache.cxf.systest.ws.rm;
-import java.io.InputStream;
-import java.io.StringWriter;
import java.math.BigInteger;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.logging.Logger;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.xpath.XPathConstants;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
@@ -60,9 +40,7 @@
import org.apache.cxf.greeter_control.ControlService;
import org.apache.cxf.greeter_control.Greeter;
import org.apache.cxf.greeter_control.GreeterService;
-import org.apache.cxf.helpers.XPathUtils;
import org.apache.cxf.interceptor.Interceptor;
-import org.apache.cxf.jaxws.DispatchImpl;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
@@ -82,7 +60,6 @@
import org.apache.cxf.ws.rm.RMOutInterceptor;
import org.apache.cxf.ws.rm.RMProperties;
import org.apache.cxf.ws.rm.soap.RMSoapInterceptor;
-
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -97,12 +74,8 @@
public class SequenceTest extends AbstractBusClientServerTestBase {
private static final Logger LOG = LogUtils.getLogger(SequenceTest.class);
- private static final QName GREETMEONEWAY_NAME
- = new QName("http://cxf.apache.org/greeter_control", "greetMeOneWay");
private static final String GREETMEONEWAY_ACTION
= "http://cxf.apache.org/greeter_control/Greeter/greetMeOneWayRequest";
- private static final QName GREETME_NAME
- = new QName("http://cxf.apache.org/greeter_control", "greetMe");
private static final String GREETME_ACTION
= "http://cxf.apache.org/greeter_control/Greeter/greetMeRequest";
private static final String GREETME_RESPONSE_ACTION
@@ -117,7 +90,6 @@
private Greeter greeter;
private OutMessageRecorder outRecorder;
private InMessageRecorder inRecorder;
- private Dispatch<DOMSource> dispatch;
@BeforeClass
@@ -135,7 +107,7 @@
@After
public void tearDown() throws Exception {
try {
- stopClient();
+ stopGreeter();
stopControl();
} catch (Throwable t) {
//ignore
@@ -197,51 +169,6 @@
greeter.greetMeOneWay("twice");
greeter.greetMeOneWay("thrice");
- verifyOnewayAnonymousAcks();
- }
-
- @Test
- public void testOnewayAnonymousAcksProvider() throws Exception {
- init("org/apache/cxf/systest/ws/rm/rminterceptors_provider.xml");
-
- greeter.greetMeOneWay("once");
- greeter.greetMeOneWay("twice");
- greeter.greetMeOneWay("thrice");
-
- verifyOnewayAnonymousAcks();
- }
-
- @Test
- public void testOnewayAnonymousAcksDispatch() throws Exception {
- init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false, true);
-
- dispatch.getRequestContext().put(MessageContext.WSDL_OPERATION,
- GREETMEONEWAY_NAME);
-
- dispatch.invokeOneWay(getDOMRequest("One", true));
- dispatch.invokeOneWay(getDOMRequest("Two", true));
- dispatch.invokeOneWay(getDOMRequest("Three", true));
-
- verifyOnewayAnonymousAcks();
- }
-
- @Test
- public void testOnewayAnonymousAcksDispatchProvider() throws Exception {
- init("org/apache/cxf/systest/ws/rm/rminterceptors_provider.xml",
- false,
- true);
-
- dispatch.getRequestContext().put(MessageContext.WSDL_OPERATION,
- GREETMEONEWAY_NAME);
-
- dispatch.invokeOneWay(getDOMRequest("One", true));
- dispatch.invokeOneWay(getDOMRequest("Two", true));
- dispatch.invokeOneWay(getDOMRequest("Three", true));
-
- verifyOnewayAnonymousAcks();
- }
-
- private void verifyOnewayAnonymousAcks() throws Exception {
// three application messages plus createSequence
awaitMessages(4, 4);
@@ -249,10 +176,8 @@
MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages());
mf.verifyMessages(4, true);
- String[] expectedActions = new String[] {RMConstants.getCreateSequenceAction(),
- GREETMEONEWAY_ACTION,
- GREETMEONEWAY_ACTION,
- GREETMEONEWAY_ACTION};
+ String[] expectedActions = new String[] {RMConstants.getCreateSequenceAction(), GREETMEONEWAY_ACTION,
+ GREETMEONEWAY_ACTION, GREETMEONEWAY_ACTION};
mf.verifyActions(expectedActions, true);
mf.verifyMessageNumbers(new String[] {null, "1", "2", "3"}, true);
@@ -421,8 +346,7 @@
MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages());
mf.verifyMessages(4, true);
-
- String[] expectedActions = new String[] {RMConstants.getCreateSequenceAction(),
+ String[] expectedActions = new String[] {RMConstants.getCreateSequenceAction(),
GREETMEONEWAY_ACTION,
GREETMEONEWAY_ACTION,
GREETMEONEWAY_ACTION};
@@ -459,52 +383,6 @@
assertEquals("TWO", greeter.greetMe("two"));
assertEquals("THREE", greeter.greetMe("three"));
- verifyTwowayNonAnonymous();
- }
-
- @Test
- public void testTwowayNonAnonymousProvider() throws Exception {
- init("org/apache/cxf/systest/ws/rm/rminterceptors_provider.xml", true);
-
- assertEquals("ONE", greeter.greetMe("one"));
- assertEquals("TWO", greeter.greetMe("two"));
- assertEquals("THREE", greeter.greetMe("three"));
-
- verifyTwowayNonAnonymous();
- }
-
- @Test
- public void testTwowayNonAnonymousDispatch() throws Exception {
- init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true, true);
-
- dispatch.getRequestContext().put(MessageContext.WSDL_OPERATION,
- GREETME_NAME);
-
- verifyDOMResponse(dispatch.invoke(getDOMRequest("One")), "ONE");
- verifyDOMResponse(dispatch.invoke(getDOMRequest("Two")), "TWO");
- verifyDOMResponse(dispatch.invoke(getDOMRequest("Three")), "THREE");
-
- verifyTwowayNonAnonymous();
- }
-
- @Test
- public void testTwowayNonAnonymousDispatchProvider() throws Exception {
- init("org/apache/cxf/systest/ws/rm/rminterceptors_provider.xml",
- true,
- true);
-
- dispatch.getRequestContext().put(MessageContext.WSDL_OPERATION,
- GREETME_NAME);
-
- verifyDOMResponse(dispatch.invoke(getDOMRequest("One")), "ONE");
- verifyDOMResponse(dispatch.invoke(getDOMRequest("Two")), "TWO");
- verifyDOMResponse(dispatch.invoke(getDOMRequest("Three")), "THREE");
-
- verifyTwowayNonAnonymous();
- }
-
- private void verifyTwowayNonAnonymous() throws Exception {
-
// CreateSequence and three greetMe messages
// TODO there should be partial responses to the decoupled responses!
@@ -1136,7 +1014,7 @@
for (int i = 0; i < clients.length; i++) {
greeter = clients[i].greeter;
greeterBus = clients[i].greeterBus;
- stopClient();
+ stopGreeter();
}
greeter = null;
}
@@ -1225,7 +1103,7 @@
for (int i = 0; i < clients.length; i++) {
greeter = clients[i].greeter;
greeterBus = clients[i].greeterBus;
- stopClient();
+ stopGreeter();
}
greeter = null;
}
@@ -1330,30 +1208,14 @@
}
private void init(String cfgResource, boolean useDecoupledEndpoint) {
- init(cfgResource, useDecoupledEndpoint, false, null);
- }
-
- private void init(String cfgResource, boolean useDecoupledEndpoint, Executor executor) {
- init(cfgResource, useDecoupledEndpoint, false, executor);
- }
-
- private void init(String cfgResource, boolean useDecoupledEndpoint, boolean useDispatchClient) {
- init(cfgResource, useDecoupledEndpoint, useDispatchClient, null);
+ init(cfgResource, useDecoupledEndpoint, null);
}
- private void init(String cfgResource,
- boolean useDecoupledEndpoint,
- boolean useDispatchClient,
- Executor executor) {
+ private void init(String cfgResource, boolean useDecoupledEndpoint, Executor executor) {
SpringBusFactory bf = new SpringBusFactory();
initControl(bf, cfgResource);
- initGreeterBus(bf, cfgResource);
- if (useDispatchClient) {
- initDispatch(useDecoupledEndpoint);
- } else {
- initProxy(useDecoupledEndpoint, executor);
- }
+ initGreeter(bf, cfgResource, useDecoupledEndpoint, executor);
}
private void initControl(SpringBusFactory bf, String cfgResource) {
@@ -1365,17 +1227,9 @@
assertTrue("Failed to start greeter", control.startGreeter(cfgResource));
}
-
- private void initGreeter(SpringBusFactory bf,
- String cfgResource,
- boolean useDecoupledEndpoint,
- Executor executor) {
- initGreeterBus(bf, cfgResource);
- initProxy(useDecoupledEndpoint, executor);
- }
- private void initGreeterBus(SpringBusFactory bf,
- String cfgResource) {
+ private void initGreeter(SpringBusFactory bf, String cfgResource,
+ boolean useDecoupledEndpoint, Executor executor) {
greeterBus = bf.createBus(cfgResource);
BusFactory.setDefaultBus(greeterBus);
LOG.fine("Initialised greeter bus with configuration: " + cfgResource);
@@ -1384,46 +1238,29 @@
greeterBus.getOutInterceptors().add(outRecorder);
inRecorder = new InMessageRecorder();
greeterBus.getInInterceptors().add(inRecorder);
- }
-
- private void initDispatch(boolean useDecoupledEndpoint) {
- GreeterService gs = new GreeterService();
- dispatch = gs.createDispatch(GreeterService.GreeterPort,
- DOMSource.class,
- Service.Mode.MESSAGE);
- dispatch.getRequestContext().put(
- BindingProvider.SOAPACTION_USE_PROPERTY,
- false);
-
- if (useDecoupledEndpoint) {
- initDecoupledEndpoint(((DispatchImpl)dispatch).getClient());
- }
- }
-
- private void initProxy(boolean useDecoupledEndpoint, Executor executor) {
+
GreeterService gs = new GreeterService();
if (null != executor) {
gs.setExecutor(executor);
}
-
+
greeter = gs.getGreeterPort();
LOG.fine("Created greeter client.");
ConnectionHelper.setKeepAliveConnection(greeter, true);
- if (useDecoupledEndpoint) {
- initDecoupledEndpoint(ClientProxy.getClient(greeter));
+ if (!useDecoupledEndpoint) {
+ return;
}
- }
- private void initDecoupledEndpoint(Client c) {
// programatically configure decoupled endpoint that is guaranteed to
// be unique across all test cases
decoupledEndpointPort--;
decoupledEndpoint = "http://localhost:" + decoupledEndpointPort + "/decoupled_endpoint";
+ Client c = ClientProxy.getClient(greeter);
HTTPConduit hc = (HTTPConduit)(c.getConduit());
HTTPClientPolicy cp = hc.getClient();
cp.setDecoupledEndpoint(decoupledEndpoint);
@@ -1431,24 +1268,18 @@
LOG.fine("Using decoupled endpoint: " + cp.getDecoupledEndpoint());
}
- private void stopClient() {
+ private void stopGreeter() {
if (null != greeterBus) {
//ensure we close the decoupled destination of the conduit,
//so that release the port if the destination reference count hit zero
- if (greeter != null) {
- ClientProxy.getClient(greeter).getConduit().close();
- }
- if (dispatch != null) {
- ((DispatchImpl)dispatch).getClient().getConduit().close();
- }
+ ClientProxy.getClient(greeter).getConduit().close();
greeterBus.shutdown(true);
greeter = null;
- dispatch = null;
greeterBus = null;
}
}
-
+
private void stopControl() {
if (null != control) {
assertTrue("Failed to stop greeter", control.stopGreeter(null));
@@ -1484,51 +1315,4 @@
}
}
}
-
- private DOMSource getDOMRequest(String n) throws Exception {
- return getDOMRequest(n, false);
- }
-
- private DOMSource getDOMRequest(String n, boolean oneway)
- throws Exception {
- InputStream is =
- getClass().getResourceAsStream((oneway ? "oneway" : "twoway")
- + "Req" + n + ".xml");
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document newDoc = builder.parse(is);
- return new DOMSource(newDoc);
- }
-
- private static String convertToString(DOMSource domSource)
- throws TransformerException {
- Transformer xformer =
- TransformerFactory.newInstance().newTransformer();
- StringWriter output = new StringWriter();
- xformer.transform(domSource, new StreamResult(output));
- return output.toString();
- }
-
- private static String parseResponse(DOMSource domResponse) {
- Element el = ((Document)domResponse.getNode()).getDocumentElement();
- Map<String, String> ns = new HashMap<String, String>();
- ns.put("soap", "http://schemas.xmlsoap.org/soap/envelope/");
- ns.put("ns", "http://cxf.apache.org/greeter_control/types");
- XPathUtils xp = new XPathUtils(ns);
- return (String)xp.getValue("/soap:Envelope/soap:Body"
- + "/ns:greetMeResponse/ns:responseType",
- el,
- XPathConstants.STRING);
- }
-
- private void verifyDOMResponse(DOMSource domResponse, String expected)
- throws TransformerException {
- String s = convertToString(domResponse);
- assertTrue("expected: " + s + " to contain: " + expected,
- s.indexOf(expected) != -1);
- assertEquals("unexpected response: " + s,
- expected,
- parseResponse(domResponse));
- }
}