Author: sergeyb
Date: Wed Dec 10 08:15:46 2008
New Revision: 725321
URL: http://svn.apache.org/viewvc?rev=725321&view=rev
Log:
Merged revisions 724780 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r724780 | sergeyb | 2008-12-09 17:04:39 +0000 (Tue, 09 Dec 2008) | 1 line
JAXRS : spring security system tests
........
Added:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/
- copied from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringInterface.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringInterface.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringNoAnnotations.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringNoAnnotations.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
- copied, changed from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoAnnotations.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoAnnotations.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
- copied, changed from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityExceptionMapper.java
- copied unchanged from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityExceptionMapper.java
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_security/
- copied from r724780,
cxf/trunk/systests/src/test/resources/jaxrs_security/
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_security_cglib/
- copied from r724780,
cxf/trunk/systests/src/test/resources/jaxrs_security_cglib/
cxf/branches/2.1.x-fixes/systests/src/test/resources/jaxrs_security_no_annotations/
- copied from r724780,
cxf/trunk/systests/src/test/resources/jaxrs_security_no_annotations/
cxf/branches/2.1.x-fixes/systests/src/test/resources/log4j.properties
- copied unchanged from r724780,
cxf/trunk/systests/src/test/resources/log4j.properties
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
cxf/branches/2.1.x-fixes/systests/pom.xml
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookInterface.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreWithInterface.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_async_noservice.wsdl
(props changed)
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Dec 10 08:15:46 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,722412,722988,723024,723338,723378,723716-723791,724333-724372,724433-724438,724449,724481,724485,724668
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,722412,722988,723024,723338,723378,723716-723791,724333-724372,724433-724438,724449,724481,724485,724668,724780
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java?rev=725321&r1=725320&r2=725321&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
(original)
+++
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
Wed Dec 10 08:15:46 2008
@@ -19,6 +19,7 @@
package org.apache.cxf.common.util;
+import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
/**
@@ -27,12 +28,23 @@
class SpringAopClassHelper extends ClassHelper {
SpringAopClassHelper() throws Exception {
Class.forName("org.springframework.aop.support.AopUtils");
+ Class.forName("org.springframework.aop.framework.Advised");
}
protected Class getRealClassInternal(Object o) {
if (AopUtils.isAopProxy(o)) {
- return AopUtils.getTargetClass(o);
+ Advised advised = (Advised)o;
+ if (advised == null) {
+ return AopUtils.getTargetClass(o);
+ }
+ try {
+ return
getRealClassInternal(advised.getTargetSource().getTarget());
+ } catch (Exception ex) {
+ // ignore
+ }
+
}
return o.getClass();
}
+
}
Modified:
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java?rev=725321&r1=725320&r2=725321&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
Wed Dec 10 08:15:46 2008
@@ -136,13 +136,16 @@
public void setResourceClassesFromBeans(List<Object> beans) {
for (Object bean : beans) {
+ Class<?> realClass = ClassHelper.getRealClass(bean);
+
ClassResourceInfo classResourceInfo =
- createClassResourceInfo(bean.getClass(),
- ClassHelper.getRealClass(bean),
- true);
- classResourceInfos.add(classResourceInfo);
- classResourceInfo.setResourceProvider(
- new SingletonResourceProvider(bean));
+ createClassResourceInfo(bean.getClass(), realClass, true);
+ if (classResourceInfo != null) {
+ classResourceInfos.add(classResourceInfo);
+
+ classResourceInfo.setResourceProvider(
+ new SingletonResourceProvider(bean));
+ }
}
}
Modified:
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=725321&r1=725320&r2=725321&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
Wed Dec 10 08:15:46 2008
@@ -27,6 +27,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -155,6 +156,9 @@
@SuppressWarnings("unchecked")
private static <T> ExceptionMapper<T> doCreateExceptionMapper(
List<ProviderInfo<ExceptionMapper>> mappers, Class<?> exceptionType,
Message m) {
+
+ List<ExceptionMapper<T>> candidates = new
LinkedList<ExceptionMapper<T>>();
+
for (ProviderInfo<ExceptionMapper> em : mappers) {
Type[] types = em.getProvider().getClass().getGenericInterfaces();
for (Type t : types) {
@@ -165,13 +169,17 @@
if
(((Class<?>)args[i]).isAssignableFrom(exceptionType)) {
InjectionUtils.injectContextFields(em.getProvider(), em, m);
InjectionUtils.injectContextMethods(em.getProvider(), em, m);
- return em.getProvider();
+ candidates.add(em.getProvider());
}
}
}
}
}
- return null;
+ if (candidates.size() == 0) {
+ return null;
+ }
+ Collections.sort((List)candidates, new ExceptionMapperComparator());
+ return candidates.get(0);
}
public <T> MessageBodyReader<T> createMessageBodyReader(Class<T> bodyType,
@@ -531,4 +539,26 @@
}
}
}
+
+ private static class ExceptionMapperComparator implements
+ Comparator<ExceptionMapper<? extends Throwable>> {
+
+ public int compare(ExceptionMapper<? extends Throwable> em1,
+ ExceptionMapper<? extends Throwable> em2) {
+ Type[] types1 = em1.getClass().getGenericInterfaces();
+ Type[] types2 = em2.getClass().getGenericInterfaces();
+
+ Class<?> realClass1 = InjectionUtils.getActualType(types1[0]);
+ Class<?> realClass2 = InjectionUtils.getActualType(types2[0]);
+ if (realClass1 == realClass2) {
+ return 0;
+ }
+ if (realClass1.isAssignableFrom(realClass2)) {
+ // subclass should go first
+ return 1;
+ }
+ return -1;
+ }
+
+ }
}
Modified:
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=725321&r1=725320&r2=725321&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Wed Dec 10 08:15:46 2008
@@ -81,7 +81,6 @@
public static Method checkProxy(Method methodToInvoke, Object
resourceObject) {
if (Proxy.class.isInstance(resourceObject)) {
-
for (Class<?> c : resourceObject.getClass().getInterfaces()) {
try {
Method m = c.getMethod(
@@ -93,7 +92,6 @@
//ignore
}
}
-
}
return methodToInvoke;
}
Modified:
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java?rev=725321&r1=725320&r2=725321&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
Wed Dec 10 08:15:46 2008
@@ -35,6 +35,7 @@
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.MessageBodyReader;
@@ -71,18 +72,45 @@
}
@Test
- public void testExceptionMappers() throws Exception {
+ public void testDefaultUserExceptionMappers() throws Exception {
ProviderFactory pf = ProviderFactory.getInstance();
ExceptionMapper<?> mapper =
pf.createExceptionMapper(WebApplicationException.class, new
MessageImpl());
assertNotNull(mapper);
- WebApplicationExceptionMapper m = new WebApplicationExceptionMapper();
- pf.registerUserProvider(m);
+ WebApplicationExceptionMapper wm = new
WebApplicationExceptionMapper();
+ pf.registerUserProvider(wm);
ExceptionMapper<?> mapper2 =
pf.createExceptionMapper(WebApplicationException.class, new
MessageImpl());
assertNotSame(mapper, mapper2);
- assertSame(m, mapper2);
+ assertSame(wm, mapper2);
+ }
+
+ @Test
+ public void testExceptionMappersHierarchy1() throws Exception {
+ ProviderFactory pf = ProviderFactory.getInstance();
+ WebApplicationExceptionMapper wm = new
WebApplicationExceptionMapper();
+ pf.registerUserProvider(wm);
+ assertSame(wm, pf.createExceptionMapper(WebApplicationException.class,
new MessageImpl()));
+ assertNull(pf.createExceptionMapper(RuntimeException.class, new
MessageImpl()));
+ TestRuntimeExceptionMapper rm = new TestRuntimeExceptionMapper();
+ pf.registerUserProvider(rm);
+ assertSame(wm, pf.createExceptionMapper(WebApplicationException.class,
new MessageImpl()));
+ assertSame(rm, pf.createExceptionMapper(RuntimeException.class, new
MessageImpl()));
+ }
+
+ @Test
+ public void testExceptionMappersHierarchy2() throws Exception {
+ ProviderFactory pf = ProviderFactory.getInstance();
+ TestRuntimeExceptionMapper rm = new TestRuntimeExceptionMapper();
+ pf.registerUserProvider(rm);
+ assertSame(rm, pf.createExceptionMapper(WebApplicationException.class,
new MessageImpl()));
+ assertSame(rm, pf.createExceptionMapper(RuntimeException.class, new
MessageImpl()));
+
+ WebApplicationExceptionMapper wm = new
WebApplicationExceptionMapper();
+ pf.registerUserProvider(wm);
+ assertSame(wm, pf.createExceptionMapper(WebApplicationException.class,
new MessageImpl()));
+ assertSame(rm, pf.createExceptionMapper(RuntimeException.class, new
MessageImpl()));
}
@Test
@@ -353,4 +381,13 @@
assertNotNull("schema can not be read from classpath", s);
}
+ private static class TestRuntimeExceptionMapper implements
ExceptionMapper<RuntimeException> {
+
+ public Response toResponse(RuntimeException exception) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+
}
Modified: cxf/branches/2.1.x-fixes/systests/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/pom.xml?rev=725321&r1=725320&r2=725321&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/pom.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/pom.xml Wed Dec 10 08:15:46 2008
@@ -333,6 +333,63 @@
<version>${spring.version}</version>
</dependency>
<dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-core-tiger</artifactId>
+ <version>2.0.4</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-dao</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-remoting</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-support</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-acl</artifactId>
+ <version>2.0.4</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-dao</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-remoting</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-support</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
Modified:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookInterface.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookInterface.java?rev=725321&r1=725320&r2=725321&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookInterface.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookInterface.java
Wed Dec 10 08:15:46 2008
@@ -30,4 +30,16 @@
@Path("/thosebooks/{bookId}/")
@ProduceMime("application/xml")
Book getThatBook(@PathParam("bookId") Long id) throws BookNotFoundFault;
+
+
+ @GET
+ @Path("/thosebooks/{bookId}/{id}")
+ @ProduceMime("application/xml")
+ Book getThatBook(@PathParam("bookId") Long id, @PathParam("id") String s)
throws BookNotFoundFault;
+
+ @GET
+ @Path("/thosebooks")
+ @ProduceMime("application/xml")
+ Book getThatBook() throws BookNotFoundFault;
+
}
Modified:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreWithInterface.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreWithInterface.java?rev=725321&r1=725320&r2=725321&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreWithInterface.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreWithInterface.java
Wed Dec 10 08:15:46 2008
@@ -47,6 +47,12 @@
books.put(book.getId(), book);
}
+ public Book getThatBook(Long id, String s) throws BookNotFoundFault {
+ if (!id.toString().equals(s)) {
+ throw new RuntimeException();
+ }
+ return doGetBook(id);
+ }
public Book getThatBook(Long id) throws BookNotFoundFault {
return doGetBook(id);
@@ -64,4 +70,8 @@
}
}
+ public Book getThatBook() throws BookNotFoundFault {
+ return books.get(123L);
+ }
+
}
Modified:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java?rev=725321&r1=725320&r2=725321&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
Wed Dec 10 08:15:46 2008
@@ -54,6 +54,38 @@
}
@Test
+ public void testGetThatBookOverloaded() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123/123";
+ URL url = new URL(endpointAddress);
+ URLConnection connect = url.openConnection();
+ connect.addRequestProperty("Accept", "application/xml");
+ InputStream in = connect.getInputStream();
+
+ InputStream expected = getClass()
+ .getResourceAsStream("resources/expected_get_book123.txt");
+
+ //System.out.println("---" + getStringFromInputStream(in));
+ assertEquals(getStringFromInputStream(expected),
getStringFromInputStream(in));
+ }
+
+ @Test
+ public void testGetThatBookOverloaded2() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks";
+ URL url = new URL(endpointAddress);
+ URLConnection connect = url.openConnection();
+ connect.addRequestProperty("Accept", "application/xml");
+ InputStream in = connect.getInputStream();
+
+ InputStream expected = getClass()
+ .getResourceAsStream("resources/expected_get_book123.txt");
+
+ //System.out.println("---" + getStringFromInputStream(in));
+ assertEquals(getStringFromInputStream(expected),
getStringFromInputStream(in));
+ }
+
+ @Test
public void testGetBook123() throws Exception {
String endpointAddress =
"http://localhost:9080/bookstore/books/123";
Copied:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
(from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java)
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java?p2=cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java&p1=cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java&r1=724780&r2=725321&rev=725321&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
Wed Dec 10 08:15:46 2008
@@ -22,7 +22,7 @@
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
+import javax.ws.rs.ProduceMime;
import org.apache.cxf.systest.jaxrs.Book;
import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
@@ -32,20 +32,20 @@
@GET
@Path("/thosebooks/{bookId}/")
- @Produces("application/xml")
+ @ProduceMime("application/xml")
@Secured({"ROLE_USER", "ROLE_ADMIN" })
Book getThatBook(@PathParam("bookId") Long id) throws BookNotFoundFault;
@GET
@Path("/thosebooks/{bookId}/{id}")
- @Produces("application/xml")
+ @ProduceMime("application/xml")
@Secured("ROLE_USER")
Book getThatBook(@PathParam("bookId") Long id, @PathParam("id") String s)
throws BookNotFoundFault;
@GET
@Path("/thosebooks")
- @Produces("application/xml")
+ @ProduceMime("application/xml")
@Secured("ROLE_ADMIN")
Book getThatBook() throws BookNotFoundFault;
Copied:
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
(from r724780,
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java)
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java?p2=cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java&p1=cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java&r1=724780&r2=725321&rev=725321&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
(original)
+++
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
Wed Dec 10 08:15:46 2008
@@ -25,7 +25,7 @@
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
+import javax.ws.rs.ProduceMime;
import org.apache.cxf.systest.jaxrs.Book;
import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
@@ -44,7 +44,7 @@
@GET
@Path("/thosebooks/{bookId}/{id}")
- @Produces("application/xml")
+ @ProduceMime("application/xml")
@Secured({"ROLE_USER", "ROLE_ADMIN" })
public Book getThatBook(@PathParam("bookId") Long id, @PathParam("id")
String s) {
if (s == null) {
@@ -55,7 +55,7 @@
@GET
@Path("/thosebooks/{bookId}/")
- @Produces("application/xml")
+ @ProduceMime("application/xml")
@Secured("ROLE_USER")
public Book getThatBook(@PathParam("bookId") Long id) {
return books.get(id);
@@ -63,7 +63,7 @@
@GET
@Path("/thosebooks")
- @Produces("application/xml")
+ @ProduceMime("application/xml")
@Secured("ROLE_ADMIN")
public Book getThatBook() throws BookNotFoundFault {
return books.get(123L);
Propchange:
cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_async_noservice.wsdl
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Dec 10 08:15:46 2008
@@ -1 +1 @@
-/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_async_noservice.wsdl:722412,722988,723378,724485,724668
+/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_async_noservice.wsdl:722412,722988,723378,724485,724668,724780