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 2010/03/31 17:01:55 UTC
svn commit: r929568 - in /cxf/trunk:
common/common/src/main/java/org/apache/cxf/common/util/ rt/frontend/simple/
rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/
rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/
Author: dkulp
Date: Wed Mar 31 15:01:55 2010
New Revision: 929568
URL: http://svn.apache.org/viewvc?rev=929568&view=rev
Log:
[CXF-2728] Try harder to determine classes for Spring AOP services
Patch from Bryan Stopp applied
Added:
cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceInterceptor.java
cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceProxyFactory.java
Modified:
cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
cxf/trunk/rt/frontend/simple/pom.xml
cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java
cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml
Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java?rev=929568&r1=929567&r2=929568&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java Wed Mar 31 15:01:55 2010
@@ -45,7 +45,10 @@ class SpringAopClassHelper extends Class
Object target = advised.getTargetSource().getTarget();
if (target == null) {
- return AopUtils.getTargetClass(o);
+ Class targetClass = AopUtils.getTargetClass(o);
+ if (targetClass != null) {
+ return targetClass;
+ }
} else {
return getRealClassInternal(target);
}
Modified: cxf/trunk/rt/frontend/simple/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/pom.xml?rev=929568&r1=929567&r2=929568&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/pom.xml (original)
+++ cxf/trunk/rt/frontend/simple/pom.xml Wed Mar 31 15:01:55 2010
@@ -65,7 +65,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-testutils</artifactId>
Modified: cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java?rev=929568&r1=929567&r2=929568&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java (original)
+++ cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/SpringBeansTest.java Wed Mar 31 15:01:55 2010
@@ -44,7 +44,6 @@ import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
-
public class SpringBeansTest extends Assert {
@Test
@@ -79,6 +78,9 @@ public class SpringBeansTest extends Ass
bean = (ServerFactoryBean) ctx.getBean("simpleWithWSDL");
assertNotNull(bean);
assertEquals(bean.getWsdlLocation(), "org/apache/cxf/frontend/spring/simple.wsdl");
+
+ bean = (ServerFactoryBean) ctx.getBean("proxyBean");
+ assertNotNull(bean);
}
@Test
Modified: cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml?rev=929568&r1=929567&r2=929568&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml (original)
+++ cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/spring/servers.xml Wed Mar 31 15:01:55 2010
@@ -88,4 +88,12 @@ http://cxf.apache.org/simple http://cxf.
<soap:soapBinding mtomEnabled="true" version="1.2"/>
</simple:binding>
</simple:server>
+
+ <simple:server id="proxyBean"
+ serviceClass="org.apache.cxf.service.factory.HelloService"
+ address="http://localhost:8080/proxyBean" >
+ <simple:serviceBean>
+ <bean class="org.apache.cxf.service.factory.HelloServiceProxyFactory"/>
+ </simple:serviceBean>
+ </simple:server>
</beans>
Added: cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceInterceptor.java?rev=929568&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceInterceptor.java (added)
+++ cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceInterceptor.java Wed Mar 31 15:01:55 2010
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.service.factory;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+
+public class HelloServiceInterceptor implements MethodInterceptor {
+
+ public Object invoke(MethodInvocation i) throws Throwable {
+
+ return i.proceed();
+
+ }
+
+}
Added: cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceProxyFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceProxyFactory.java?rev=929568&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceProxyFactory.java (added)
+++ cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/HelloServiceProxyFactory.java Wed Mar 31 15:01:55 2010
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.service.factory;
+
+import org.springframework.aop.framework.ProxyFactory;
+import org.springframework.beans.factory.FactoryBean;
+
+public class HelloServiceProxyFactory implements FactoryBean {
+
+ public Object getObject() throws Exception {
+
+ return new ProxyFactory(HelloService.class, new HelloServiceInterceptor()).getProxy();
+ }
+
+ public Class getObjectType() {
+
+ return HelloServiceInterceptor.class;
+ }
+
+ public boolean isSingleton() {
+
+ return true;
+ }
+
+}