Author: ningjiang
Date: Thu Dec 21 00:58:21 2006
New Revision: 489290
URL: http://svn.apache.org/viewvc?view=rev&rev=489290
Log:
Try to get SpringservletTest work again
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java?view=diff&rev=489290&r1=489289&r2=489290
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
Thu Dec 21 00:58:21 2006
@@ -39,7 +39,7 @@
import org.apache.cxf.Bus;
import org.apache.cxf.BusException;
-import org.apache.cxf.bus.cxf.CXFBusFactory;
+import org.apache.cxf.BusFactoryHelper;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.message.Message;
@@ -57,12 +57,13 @@
private static String basedirPath;
+ protected Bus bus;
/**
* Namespaces for the XPath expressions.
*/
private Map<String, String> namespaces = new HashMap<String, String>();
- private Bus bus;
+
public void setUp() throws Exception {
bus = createBus();
@@ -79,9 +80,17 @@
public Bus getBus() {
return bus;
}
+
+ public void tearDown() {
+ if (bus != null) {
+ bus.shutdown(false);
+ }
+ BusFactoryHelper.newInstance().setDefaultBus(null);
+ }
+
protected Bus createBus() throws BusException {
- return new CXFBusFactory().createBus();
+ return BusFactoryHelper.newInstance().createBus();
}
protected byte[] invokeBytes(String address,
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java?view=diff&rev=489290&r1=489289&r2=489290
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/AbstractServletTest.java
Thu Dec 21 00:58:21 2006
@@ -30,9 +30,12 @@
import com.meterware.servletunit.ServletRunner;
import com.meterware.servletunit.ServletUnitClient;
+//import org.apache.cxf.Bus;
+//import org.apache.cxf.BusException;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactoryHelper;
import org.apache.cxf.test.AbstractCXFTest;
+//import org.apache.cxf.transport.DestinationFactoryManager;
public abstract class AbstractServletTest extends AbstractCXFTest {
@@ -47,20 +50,25 @@
// ignore, we just want to boot up the servlet
}
super.setUp();
-
+
HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);
- }
+ }
public void tearDown() {
- // clean up the BusFactory defualt bus
- BusFactoryHelper.newInstance().setDefaultBus(null);
+ bus.shutdown(false);
+ BusFactoryHelper.newInstance().setDefaultBus(null);
}
-
+
+ //CXFservlet has create the bus, so we need to use this bus for service
init
@Override
public Bus getBus() {
return BusFactoryHelper.newInstance().getDefaultBus();
}
-
+
+ @Override
+ public Bus createBus() {
+ return BusFactoryHelper.newInstance().getDefaultBus();
+ }
/**
* @return The web.xml to use for testing.
*/
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java?view=diff&rev=489290&r1=489289&r2=489290
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/servlet/SpringServletTest.java
Thu Dec 21 00:58:21 2006
@@ -18,13 +18,13 @@
*/
package org.apache.cxf.jaxws.servlet;
-/*import org.w3c.dom.Document;
+import org.w3c.dom.Document;
import com.meterware.httpunit.PostMethodWebRequest;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
-import org.apache.cxf.helpers.DOMUtils;*/
+import org.apache.cxf.helpers.DOMUtils;
public class SpringServletTest extends AbstractServletTest {
@Override
@@ -33,7 +33,7 @@
}
public void testInvokingSpringBeans() throws Exception {
-/*
+
WebRequest req = new
PostMethodWebRequest("http://localhost/services/Greeter",
getClass().getResourceAsStream("/org/apache/cxf/jaxws/GreeterMessage.xml"),
"text/xml; charset=utf-8");
@@ -49,6 +49,6 @@
addNamespace("h", "http://apache.org/hello_world_soap_http/types");
assertValid("/s:Envelope/s:Body", doc);
- assertValid("//h:sayHiResponse", doc);*/
+ assertValid("//h:sayHiResponse", doc);
}
}