cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r986319 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java
Date Tue, 17 Aug 2010 14:17:08 GMT
Author: ningjiang
Date: Tue Aug 17 14:17:07 2010
New Revision: 986319

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

........
  r986308 | ningjiang | 2010-08-17 21:52:27 +0800 (Tue, 17 Aug 2010) | 1 line
  
  CXF-2948 Let the configure context can be used for extended instance
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java
    cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:986308

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/configuration/spring/ConfigurerImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java?rev=986319&r1=986318&r2=986319&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java
Tue Aug 17 14:17:07 2010
@@ -162,18 +162,22 @@ public class ConfigurerImpl extends Bean
     
     private void configureWithWildCard(String bn, Object beanInstance) {
         if (!wildCardBeanDefinitions.isEmpty()) {
-            String className = beanInstance.getClass().getName();
-            List<MatcherHolder> matchers = wildCardBeanDefinitions.get(className);
-            if (matchers != null) {
-                for (MatcherHolder m : matchers) {
-                    synchronized (m.matcher) {
-                        m.matcher.reset(bn);
-                        if (m.matcher.matches()) {
-                            configureBean(m.wildCardId, beanInstance, false);
-                            return;
+            Class<?> clazz = beanInstance.getClass();            
+            while (!Object.class.equals(clazz)) {
+                String className = clazz.getName();
+                List<MatcherHolder> matchers = wildCardBeanDefinitions.get(className);
+                if (matchers != null) {
+                    for (MatcherHolder m : matchers) {
+                        synchronized (m.matcher) {
+                            m.matcher.reset(bn);
+                            if (m.matcher.matches()) {
+                                configureBean(m.wildCardId, beanInstance, false);
+                                return;
+                            }
                         }
                     }
                 }
+                clazz = clazz.getSuperclass();
             }
         }
     }

Modified: cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java?rev=986319&r1=986318&r2=986319&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/configuration/spring/ConfigurerImplTest.java
Tue Aug 17 14:17:07 2010
@@ -198,6 +198,24 @@ public class ConfigurerImplTest extends 
     }
     
     @Test
+    public void testConfigureSimpleMatchingStarBeanIdWithChildInstance() {
+        SimpleBean sb = new ChildBean("simple2");
+        BusApplicationContext ac = 
+            new BusApplicationContext("/org/apache/cxf/configuration/spring/test-beans.xml",
+                                      false);
+
+        ConfigurerImpl configurer = new ConfigurerImpl();
+        configurer.setApplicationContext(ac);
+        configurer.configureBean(sb);
+        assertTrue("Unexpected value for attribute booleanAttr", 
+                   !sb.getBooleanAttr());
+        assertEquals("Unexpected value for attribute integerAttr", 
+                     BigInteger.TEN, sb.getIntegerAttr());
+        assertEquals("Unexpected value for attribute stringAttr", 
+                     "StarHallo", sb.getStringAttr());
+    }
+    
+    @Test
     public void testGetBeanName() {
         ConfigurerImpl configurer = new ConfigurerImpl();
         Object beanInstance = new Configurable() {
@@ -236,7 +254,7 @@ public class ConfigurerImplTest extends 
         assertTrue("The conetxts' contains a wrong application context", contexts.contains(context2));
     }
     
-    final class SimpleBean implements Configurable {
+    class SimpleBean implements Configurable {
         
         private String beanName;
         
@@ -398,4 +416,12 @@ public class ConfigurerImplTest extends 
             this.beanName = beanName;
         }    
     }
+    
+    class ChildBean extends SimpleBean {
+
+        public ChildBean(String bn) {
+            super(bn);
+        }
+        
+    }
 }



Mime
View raw message