[1/2] git commit: [CXF-6078] Checking service class interfaces if one of its non-interface super classes has no expected JAX-RS annotated method

2014-11-05 Thread sergeyb
Repository: cxf
Updated Branches:
  refs/heads/master b916b1b7a - de0524a87


[CXF-6078] Checking service class interfaces if one of its non-interface super 
classes has no expected JAX-RS annotated method


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/30390cc7
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/30390cc7
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/30390cc7

Branch: refs/heads/master
Commit: 30390cc755f58eab3b346dc7b035e6286d6662b8
Parents: b916b1b
Author: Sergey Beryozkin sberyoz...@talend.com
Authored: Wed Nov 5 11:18:11 2014 +
Committer: Sergey Beryozkin sberyoz...@talend.com
Committed: Wed Nov 5 11:18:11 2014 +

--
 .../apache/cxf/jaxrs/utils/AnnotationUtils.java | 83 +++-
 .../apache/cxf/jaxrs/utils/ResourceUtils.java   |  5 +-
 .../jaxrs/utils/AnnotationTestUtilsTest.java|  4 +-
 .../apache/cxf/jaxrs/utils/JAXRSUtilsTest.java  |  2 +-
 .../JAXRSClientServerProxySpringBookTest.java   | 18 -
 .../resources/jaxrs_proxy/WEB-INF/beans.xml |  1 +
 6 files changed, 72 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/30390cc7/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java
--
diff --git 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java
 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java
index 345fa7c..27f8caf 100644
--- 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java
+++ 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/AnnotationUtils.java
@@ -151,52 +151,65 @@ public final class AnnotationUtils {
 return null;
 }
 
-public static Method getAnnotatedMethod(Method m) {
-Method annotatedMethod = doGetAnnotatedMethod(m);
+public static Method getAnnotatedMethod(Class? serviceClass, Method m) {
+Method annotatedMethod = doGetAnnotatedMethod(serviceClass, m);
 return annotatedMethod == null ? m : annotatedMethod;
 }
 
-private static Method doGetAnnotatedMethod(Method m) {
+private static Method doGetAnnotatedMethod(Class? serviceClass, Method 
m) {
 
-if (m == null) {
-return m;
-}
-
-for (Annotation a : m.getAnnotations()) {
-if (AnnotationUtils.isMethodAnnotation(a)) {
-return m;
+if (m != null) {
+for (Annotation a : m.getAnnotations()) {
+if (AnnotationUtils.isMethodAnnotation(a)) {
+return m;
+}
 }
-}
-for (Annotation[] paramAnnotations : m.getParameterAnnotations()) {
-if (isValidParamAnnotations(paramAnnotations)) {
-LOG.warning(Method  + m.getName() +  in  + 
m.getDeclaringClass().getName()
- +  has no JAX-RS Path or HTTP Method 
annotations);
-return m;
+for (Annotation[] paramAnnotations : m.getParameterAnnotations()) {
+if (isValidParamAnnotations(paramAnnotations)) {
+LOG.warning(Method  + m.getName() +  in  + 
m.getDeclaringClass().getName()
+ +  has no JAX-RS Path or HTTP Method 
annotations);
+return m;
+}
 }
-}
-
-Class? superC = m.getDeclaringClass().getSuperclass();
-if (superC != null  Object.class != superC) {
-try {
-Method method = 
doGetAnnotatedMethod(superC.getMethod(m.getName(), m.getParameterTypes()));
-if (method != null) {
-return method;
+
+Class? declaringClass = m.getDeclaringClass();
+Class? superC = declaringClass.getSuperclass();
+if (superC != null  Object.class != superC) {
+try {
+Method method = doGetAnnotatedMethod(serviceClass,
+ 
superC.getMethod(m.getName(), m.getParameterTypes()));
+if (method != null) {
+return method;
+}
+} catch (NoSuchMethodException ex) {
+// ignore
 }
-} catch (NoSuchMethodException ex) {
-// ignore
 }
-}
-for (Class? i : m.getDeclaringClass().getInterfaces()) {
-try {
-Method method = doGetAnnotatedMethod(i.getMethod(m.getName(), 
m.getParameterTypes()));
-if (method != null) {
-return method;
+for (Class? i : declaringClass.getInterfaces()) {
+try {

[1/2] git commit: [CXF-6078] Checking service class interfaces if one of its non-interface super classes has no expected JAX-RS annotated method

2014-11-05 Thread sergeyb
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes cfde47b86 - aca6e050f


[CXF-6078] Checking service class interfaces if one of its non-interface super 
classes has no expected JAX-RS annotated method


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/aca6e050
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/aca6e050
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/aca6e050

Branch: refs/heads/3.0.x-fixes
Commit: aca6e050f16e438884fffd40d3612c974cd8b1c2
Parents: 1382c55
Author: Sergey Beryozkin sberyoz...@talend.com
Authored: Wed Nov 5 11:19:04 2014 +
Committer: Sergey Beryozkin sberyoz...@talend.com
Committed: Wed Nov 5 11:20:33 2014 +

--
 .../systest/jaxrs/AbstractNameServiceImpl.java  | 30 ++
 .../apache/cxf/systest/jaxrs/NameService.java   | 43 
 .../cxf/systest/jaxrs/NameServiceImpl.java  | 31 ++
 3 files changed, 104 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/aca6e050/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractNameServiceImpl.java
--
diff --git 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractNameServiceImpl.java
 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractNameServiceImpl.java
new file mode 100644
index 000..a8d7c01
--- /dev/null
+++ 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractNameServiceImpl.java
@@ -0,0 +1,30 @@
+/**
+ * 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.systest.jaxrs;
+
+import javax.ws.rs.core.Response;
+
+public abstract class AbstractNameServiceImpl {
+
+public Response set(String id) {
+return Response.ok(id).build();
+}
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/aca6e050/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/NameService.java
--
diff --git 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/NameService.java 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/NameService.java
new file mode 100644
index 000..5302b90
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/NameService.java
@@ -0,0 +1,43 @@
+/**
+ * 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.systest.jaxrs;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+@Path(/v1/names/)
+@Produces({ application/xml, application/json })
+@Consumes({ application/xml, application/json })
+public interface NameService {
+
+@GET
+@Path(/{id})
+Response get(@PathParam(id) String id);
+
+@PUT
+@Path(/{id})
+Response set(@PathParam(id) String id);
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/aca6e050/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/NameServiceImpl.java
--
diff --git 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/NameServiceImpl.java