wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jra...@apache.org
Subject svn commit: r938117 - in /incubator/wink/trunk/wink-common/src: main/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollector.java test/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollectorTest.java
Date Mon, 26 Apr 2010 16:38:52 GMT
Author: jramos
Date: Mon Apr 26 16:38:52 2010
New Revision: 938117

URL: http://svn.apache.org/viewvc?rev=938117&view=rev
Log:
[WINK-275] Add similar check in ResourceMetadataCollector

Modified:
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollector.java
    incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollectorTest.java

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollector.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollector.java?rev=938117&r1=938116&r2=938117&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollector.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollector.java
Mon Apr 26 16:38:52 2010
@@ -62,6 +62,10 @@ public class ResourceMetadataCollector e
     }
 
     public static boolean isStaticResource(Class<?> cls) {
+        if(Modifier.isInterface(cls.getModifiers()) || Modifier.isAbstract(cls.getModifiers()))
{
+            return false;
+        }
+        
         if (cls.getAnnotation(Path.class) != null) {
             return true;
         }

Modified: incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollectorTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollectorTest.java?rev=938117&r1=938116&r2=938117&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollectorTest.java
(original)
+++ incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/registry/metadata/ResourceMetadataCollectorTest.java
Mon Apr 26 16:38:52 2010
@@ -67,6 +67,15 @@ public class ResourceMetadataCollectorTe
     public static class MySuperInterfaceImpl extends SuperResource implements MyInterface
{
 
     }
+    
+    @Path("abstractclass")
+    public static abstract class MyAbstractClass {
+        
+    }
+    
+    public static class MyBaseClass extends MyAbstractClass {
+        
+    }
 
     /**
      * Tests that @Path is inheritable. This may not follow the JAX-RS
@@ -94,6 +103,18 @@ public class ResourceMetadataCollectorTe
         assertFalse(ResourceMetadataCollector.isDynamicResource(MySuperInterfaceImpl.class));
         assertTrue(ResourceMetadataCollector.isStaticResource(MySuperInterfaceImpl.class));
         assertEquals("superclassvalue", classMetadata.getPath());
+        
+        assertFalse(ResourceMetadataCollector.isResource(MyInterface.class));
+        assertFalse(ResourceMetadataCollector.isDynamicResource(MyInterface.class));
+        assertFalse(ResourceMetadataCollector.isStaticResource(MyInterface.class));
+        
+        assertFalse(ResourceMetadataCollector.isResource(MyAbstractClass.class));
+        assertFalse(ResourceMetadataCollector.isDynamicResource(MyAbstractClass.class));
+        assertFalse(ResourceMetadataCollector.isStaticResource(MyAbstractClass.class));
+        
+        assertTrue(ResourceMetadataCollector.isResource(MyBaseClass.class));
+        assertFalse(ResourceMetadataCollector.isDynamicResource(MyBaseClass.class));
+        assertTrue(ResourceMetadataCollector.isStaticResource(MyBaseClass.class));
     }
 
     /**



Mime
View raw message