cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r826102 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/bus/spring/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/
Date Fri, 16 Oct 2009 21:47:34 GMT
Author: dkulp
Date: Fri Oct 16 21:47:33 2009
New Revision: 826102

URL: http://svn.apache.org/viewvc?rev=826102&view=rev
Log:
Merged revisions 826098 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r826098 | dkulp | 2009-10-16 17:40:08 -0400 (Fri, 16 Oct 2009) | 1 line
  
  [CXF-2283] if a Child context is closed, we shouldn't be shutting down
........

Added:
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/child.xml
      - copied unchanged from r826098, cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/child.xml
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/ClientHolderBean.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java?rev=826102&r1=826101&r2=826102&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java
Fri Oct 16 21:47:33 2009
@@ -42,18 +42,29 @@
         if (ctx == null) {
             return;
         }
-        if (event instanceof ContextRefreshedEvent) {
-            Bus bus = (Bus)ctx.getBean("cxf");
-            ((CXFBusImpl)bus).initialize();
-            BusLifeCycleManager lcm = (BusLifeCycleManager)
-                ctx.getBean("org.apache.cxf.buslifecycle.BusLifeCycleManager",
+        boolean doIt = false;
+        ApplicationContext ac = ctx;
+        while (ac != null && !doIt) {
+            if (event.getSource() == ac) {
+                doIt = true;
+            }
+            ac = ac.getParent();
+        }
+        
+        if (doIt) {
+            if (event instanceof ContextRefreshedEvent) {
+                Bus bus = (Bus)ctx.getBean("cxf");
+                ((CXFBusImpl)bus).initialize();
+                BusLifeCycleManager lcm = (BusLifeCycleManager)
+                    ctx.getBean("org.apache.cxf.buslifecycle.BusLifeCycleManager",
+                            BusLifeCycleManager.class);
+                lcm.initComplete();
+            } else if (event instanceof ContextClosedEvent) {
+                BusLifeCycleManager lcm = (BusLifeCycleManager)
+                    ctx.getBean("org.apache.cxf.buslifecycle.BusLifeCycleManager",
                         BusLifeCycleManager.class);
-            lcm.initComplete();
-        } else if (event instanceof ContextClosedEvent) {
-            BusLifeCycleManager lcm = (BusLifeCycleManager)
-                ctx.getBean("org.apache.cxf.buslifecycle.BusLifeCycleManager",
-                    BusLifeCycleManager.class);
-            lcm.postShutdown();
+                lcm.postShutdown();
+            }
         }
     }
 

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/ClientHolderBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/ClientHolderBean.java?rev=826102&r1=826101&r2=826102&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/ClientHolderBean.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/ClientHolderBean.java
Fri Oct 16 21:47:33 2009
@@ -28,7 +28,7 @@
  */
 public class ClientHolderBean {
 
-    @Autowired(required = true)
+    @Autowired
     Collection<org.apache.hello_world_soap_http.Greeter> greeters;
     
     org.apache.hello_world_soap_http.Greeter greet1;

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?rev=826102&r1=826101&r2=826102&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
Fri Oct 16 21:47:33 2009
@@ -37,6 +37,8 @@
 import org.apache.cxf.binding.soap.SoapBindingConfiguration;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
+import org.apache.cxf.buslifecycle.BusLifeCycleListener;
+import org.apache.cxf.buslifecycle.BusLifeCycleManager;
 import org.apache.cxf.configuration.spring.AbstractFactoryBeanDefinitionParser;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.databinding.source.SourceDataBinding;
@@ -209,6 +211,37 @@
     }
 
     @Test
+    public void testChildContext() throws Exception {
+        //Test for CXF-2283 - if a Child context is closed,
+        //we shouldn't be shutting down
+        ClassPathXmlApplicationContext ctx =
+            new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/servers.xml"});
+        
+        final Bus b = (Bus)ctx.getBean("cxf");
+        BusLifeCycleManager lifeCycleManager = b.getExtension(BusLifeCycleManager.class);
+        BusLifeCycleListener listener = new BusLifeCycleListener() {
+            public void initComplete() {
+            }
+
+            public void postShutdown() {
+                b.setProperty("post.was.called", Boolean.TRUE);
+            }
+
+            public void preShutdown() {
+                b.setProperty("pre.was.called", Boolean.TRUE);
+            }
+        };
+        lifeCycleManager.registerLifeCycleListener(listener);
+        ClassPathXmlApplicationContext ctx2 =
+                new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/child.xml"},
+                                                   ctx);
+        
+        ctx2.close();
+        
+        assertNull(b.getProperty("post.was.called"));
+        assertNull(b.getProperty("pre.was.called"));
+    }
+    @Test
     public void testServers() throws Exception {
         ClassPathXmlApplicationContext ctx =
             new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/servers.xml"});



Mime
View raw message