Author: dkulp
Date: Sat Oct 20 12:20:43 2007
New Revision: 586782
URL: http://svn.apache.org/viewvc?rev=586782&view=rev
Log:
Merged revisions 586183 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r586183 | bimargulies | 2007-10-18 19:47:01 -0400 (Thu, 18 Oct 2007) | 2 lines
Add test case that shows more problems with server lifecycle to the
EngineLifecycleTest.
........
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
incubator/cxf/branches/2.0.x-fixes/testutils/src/main/java/org/apache/cxf/jaxb_element_test/JaxbElementTestImpl.java
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java?rev=586782&r1=586781&r2=586782&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
Sat Oct 20 12:20:43 2007
@@ -18,8 +18,6 @@
*/
package org.apache.cxf.systest.http_jetty;
-
-
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -29,19 +27,25 @@
import java.util.Properties;
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.ServerImpl;
+import org.apache.cxf.endpoint.ServerRegistry;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
+import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.webapp.WebAppContext;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
-
-
/**
* This class tests starting up and shutting down the embedded server when
there
* is extra jetty configuration.
@@ -54,14 +58,16 @@
reader.loadBeanDefinitions(beanResource);
}
- public void setUpBus() throws Exception {
+ public void setUpBus(boolean includeService) throws Exception {
applicationContext = new GenericApplicationContext();
readBeans(new ClassPathResource("META-INF/cxf/cxf.xml"));
readBeans(new
ClassPathResource("META-INF/cxf/cxf-extension-soap.xml"));
readBeans(new
ClassPathResource("META-INF/cxf/cxf-extension-http.xml"));
readBeans(new
ClassPathResource("META-INF/cxf/cxf-extension-http-jetty.xml"));
readBeans(new ClassPathResource("jetty-engine.xml", getClass()));
-
+ if (includeService) {
+ readBeans(new ClassPathResource("server-lifecycle-beans.xml",
getClass()));
+ }
// bring in some property values from a Properties file
PropertyPlaceholderConfigurer cfg = new
PropertyPlaceholderConfigurer();
@@ -112,9 +118,6 @@
html.close();
assertEquals("Can't get the right test html", html.toString(),
response.toString());
-
-
-
}
public String getStaticResourceURL() throws Exception {
@@ -130,9 +133,36 @@
applicationContext.close();
}
+ @Ignore
+ @Test
+ public void testUpDownWithServlets() throws Exception {
+ setUpBus(true);
+
+ Bus bus = (Bus)applicationContext.getBean("cxf");
+ ServerRegistry sr = bus.getExtension(ServerRegistry.class);
+ ServerImpl si = (ServerImpl) sr.getServers().get(0);
+ JettyHTTPDestination jhd = (JettyHTTPDestination) si.getDestination();
+ JettyHTTPServerEngine e = (JettyHTTPServerEngine) jhd.getEngine();
+ org.mortbay.jetty.Server jettyServer = e.getServer();
+
+ Handler[] contexts =
jettyServer.getChildHandlersByClass(WebAppContext.class);
+ WebAppContext servletContext = null;
+ for (Handler h : contexts) {
+ WebAppContext wac = (WebAppContext) h;
+ if (wac.getContextPath().equals("/jsunit")) {
+ servletContext = wac;
+ break;
+ }
+ }
+ servletContext.addServlet("org.mortbay.jetty.servlet.DefaultServlet",
"/bloop");
+ getTestHtml();
+ invokeService();
+ shutdownService();
+ }
+
@Test
public void testServerUpDownUp() throws Exception {
- setUpBus();
+ setUpBus(false);
launchService();
getTestHtml();
invokeService();
Modified:
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml?rev=586782&r1=586781&r2=586782&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
(original)
+++
incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
Sat Oct 20 12:20:43 2007
@@ -35,14 +35,30 @@
<httpj:engine-factory bus="cxf">
<httpj:engine port="8808">
<httpj:handlers>
- <bean class="org.mortbay.jetty.handler.ResourceHandler">
- <property name="baseResource">
- <bean class="org.mortbay.resource.FileResource">
- <constructor-arg value="${staticResourceURL}" />
+ <bean class="org.mortbay.jetty.handler.RequestLogHandler">
+ <property name="requestLog">
+ <bean class="org.mortbay.jetty.NCSARequestLog">
+ <property name="filename" value="jetty.log"/>
+ </bean>
+ </property>
+ </bean>
+ <bean class="org.mortbay.jetty.webapp.WebAppContext">
+ <constructor-arg value="."/>
+ <constructor-arg value="/jsunit"/>
+ </bean>
+ <bean class="org.mortbay.jetty.handler.ContextHandler">
+ <property name="contextPath" value="/" />
+ <property name="handler">
+ <bean class="org.mortbay.jetty.handler.ResourceHandler">
+ <property name="baseResource">
+ <bean class="org.mortbay.resource.FileResource">
+ <constructor-arg value="${staticResourceURL}" />
+ </bean>
+ </property>
</bean>
</property>
</bean>
- <bean class="org.mortbay.jetty.handler.DefaultHandler"/>
+ <bean class="org.mortbay.jetty.handler.DefaultHandler"/>
</httpj:handlers>
</httpj:engine>
</httpj:engine-factory>
Modified:
incubator/cxf/branches/2.0.x-fixes/testutils/src/main/java/org/apache/cxf/jaxb_element_test/JaxbElementTestImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/testutils/src/main/java/org/apache/cxf/jaxb_element_test/JaxbElementTestImpl.java?rev=586782&r1=586781&r2=586782&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/testutils/src/main/java/org/apache/cxf/jaxb_element_test/JaxbElementTestImpl.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/testutils/src/main/java/org/apache/cxf/jaxb_element_test/JaxbElementTestImpl.java
Sat Oct 20 12:20:43 2007
@@ -29,8 +29,6 @@
public class JaxbElementTestImpl implements JaxbElementTest {
public String newOperation(String in) {
- // TODO Auto-generated method stub
-
if (in == null) {
return "in=null";
} else {