cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r683399 - in /cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org: ./ apache/ apache/cocoon/ apache/cocoon/corona/ apache/cocoon/corona/rest/ apache/cocoon/corona/rest/util/
Date Wed, 06 Aug 2008 20:37:31 GMT
Author: reinhard
Date: Wed Aug  6 13:37:31 2008
New Revision: 683399

URL: http://svn.apache.org/viewvc?rev=683399&view=rev
Log:
add unit tests for the collection of annotations

Added:
    cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/
    cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/
    cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/
    cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/
    cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/
    cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/
    cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedClass.java
  (with props)
    cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedSuperClass.java
  (with props)
    cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotationCollectorTest.java
  (with props)

Added: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedClass.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedClass.java?rev=683399&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedClass.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedClass.java
Wed Aug  6 13:37:31 2008
@@ -0,0 +1,24 @@
+package org.apache.cocoon.corona.rest.util;
+
+import org.apache.cocoon.corona.rest.controller.annotation.RequestHeader;
+import org.apache.cocoon.corona.rest.controller.annotation.RequestParameter;
+import org.apache.cocoon.corona.rest.controller.annotation.SitemapParameter;
+
+public class AnnotatedClass extends AnnotatedSuperClass {
+
+    @SuppressWarnings("unused")
+    @RequestParameter
+    private String abc;
+
+    @SuppressWarnings("unused")
+    @RequestParameter
+    private String[] xyz;
+
+    @SuppressWarnings("unused")
+    @RequestHeader("User-Agent")
+    private String userAgent;
+
+    @SuppressWarnings("unused")
+    @SitemapParameter
+    public String username;
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedClass.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedClass.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedSuperClass.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedSuperClass.java?rev=683399&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedSuperClass.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedSuperClass.java
Wed Aug  6 13:37:31 2008
@@ -0,0 +1,11 @@
+package org.apache.cocoon.corona.rest.util;
+
+import org.apache.cocoon.corona.rest.controller.annotation.RequestParameter;
+
+public class AnnotatedSuperClass {
+
+    @SuppressWarnings("unused")
+    @RequestParameter
+    private String[] opq;
+
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedSuperClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedSuperClass.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotatedSuperClass.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotationCollectorTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotationCollectorTest.java?rev=683399&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotationCollectorTest.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotationCollectorTest.java
Wed Aug  6 13:37:31 2008
@@ -0,0 +1,29 @@
+package org.apache.cocoon.corona.rest.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.cocoon.corona.rest.controller.annotation.RequestHeader;
+import org.apache.cocoon.corona.rest.controller.annotation.RequestParameter;
+import org.junit.Test;
+
+public class AnnotationCollectorTest {
+
+    @Test
+    public void testGetAnnotatedFields() {
+        AnnotationCollector annotationCollector = new AnnotationCollector();
+        Map<Class<? extends Annotation>, List<Field>> annotatedFields =
annotationCollector
+                .getAnnotatedFields(AnnotatedClass.class);
+
+        List<Field> requestHeaderParameterFields = annotatedFields.get(RequestHeader.class);
+        List<Field> requestParameterFields = annotatedFields.get(RequestParameter.class);
+
+        Assert.assertEquals(1, requestHeaderParameterFields.size());
+        Assert.assertEquals("userAgent", requestHeaderParameterFields.get(0).getName());
+        Assert.assertEquals(3, requestParameterFields.size());
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotationCollectorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotationCollectorTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-rest/src/test/java/org/apache/cocoon/corona/rest/util/AnnotationCollectorTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message