[jboss-cvs] JBossAS SVN: r103131 - in projects/jboss-reflect/trunk: src/test/java/org/jboss/test/classinfo/support and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 29 10:18:41 EDT 2010
Author: kabir.khan at jboss.com
Date: 2010-03-29 10:18:40 -0400 (Mon, 29 Mar 2010)
New Revision: 103131
Added:
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/AnnotationWithClass.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithClass.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithClassArray.java
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithInterfaceArray.java
Modified:
projects/jboss-reflect/trunk/pom.xml
projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/AnnotatedClassInfoTest.java
Log:
Upgrade to javassist snapshot and test annotation class values for array classes
Modified: projects/jboss-reflect/trunk/pom.xml
===================================================================
--- projects/jboss-reflect/trunk/pom.xml 2010-03-29 14:15:59 UTC (rev 103130)
+++ projects/jboss-reflect/trunk/pom.xml 2010-03-29 14:18:40 UTC (rev 103131)
@@ -21,7 +21,7 @@
<version.jboss.common.core>2.2.17.GA</version.jboss.common.core>
<version.jboss.logging.spi>2.2.0.CR1</version.jboss.logging.spi>
<version.jboss.logging.log4j>2.2.0.CR1</version.jboss.logging.log4j>
- <version.javassist>3.11.0.GA</version.javassist>
+ <version.javassist>3.12.0-SNAPSHOT</version.javassist>
<version.org.jboss.test>1.1.5.GA</version.org.jboss.test>
<version.junit>4.8.1</version.junit>
<version.jboss.profiler.jvmti>1.0.0.CR5</version.jboss.profiler.jvmti>
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/AnnotationWithClass.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/AnnotationWithClass.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/AnnotationWithClass.java 2010-03-29 14:18:40 UTC (rev 103131)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.classinfo.support;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface AnnotationWithClass
+{
+ Class<?> clazz();
+}
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithClass.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithClass.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithClass.java 2010-03-29 14:18:40 UTC (rev 103131)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.classinfo.support;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at AnnotationWithClass(clazz=String.class)
+public class ClassWithAnnotationWithClass
+{
+
+}
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithClassArray.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithClassArray.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithClassArray.java 2010-03-29 14:18:40 UTC (rev 103131)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.classinfo.support;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at AnnotationWithClass(clazz=String[].class)
+public class ClassWithAnnotationWithClassArray
+{
+
+}
Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithInterfaceArray.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithInterfaceArray.java (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassWithAnnotationWithInterfaceArray.java 2010-03-29 14:18:40 UTC (rev 103131)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.classinfo.support;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at AnnotationWithClass(clazz=Comparable[][].class)
+public class ClassWithAnnotationWithInterfaceArray
+{
+
+}
Modified: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/AnnotatedClassInfoTest.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/AnnotatedClassInfoTest.java 2010-03-29 14:15:59 UTC (rev 103130)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/AnnotatedClassInfoTest.java 2010-03-29 14:18:40 UTC (rev 103131)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.classinfo.test;
+import java.lang.annotation.Annotation;
import java.util.HashSet;
import org.jboss.reflect.spi.AnnotatedInfo;
@@ -44,7 +45,11 @@
import org.jboss.test.ContainerTest;
import org.jboss.test.classinfo.support.AnnotatedClass;
import org.jboss.test.classinfo.support.AnnotatedSubClass;
+import org.jboss.test.classinfo.support.AnnotationWithClass;
import org.jboss.test.classinfo.support.AnotherAnnotation;
+import org.jboss.test.classinfo.support.ClassWithAnnotationWithClass;
+import org.jboss.test.classinfo.support.ClassWithAnnotationWithClassArray;
+import org.jboss.test.classinfo.support.ClassWithAnnotationWithInterfaceArray;
import org.jboss.test.classinfo.support.ComplexAnnotation;
import org.jboss.test.classinfo.support.ExpectedAnnotations;
import org.jboss.test.classinfo.support.JDK14ExpectedAnnotations;
@@ -296,7 +301,41 @@
checkParameterAnnotations(methods[0].getParameters());
}
+
+ public void testPlainClassValueAnnotation() throws Exception
+ {
+ ClassInfo info = getClassInfo(ClassWithAnnotationWithClass.class);
+
+ checkAnnotationWithClassAnnotation(info, String.class);
+ }
+ public void testClassArrayValueAnnotation() throws Exception
+ {
+ ClassInfo info = getClassInfo(ClassWithAnnotationWithClassArray.class);
+
+ checkAnnotationWithClassAnnotation(info, String[].class);
+ }
+
+ public void testInterfaceArrayValueAnnotation() throws Exception
+ {
+ ClassInfo info = getClassInfo(ClassWithAnnotationWithInterfaceArray.class);
+
+ checkAnnotationWithClassAnnotation(info, Comparable[][].class);
+ }
+
+ private void checkAnnotationWithClassAnnotation(ClassInfo info, Class<?> clazz) throws Exception
+ {
+ AnnotationValue[] annotations = info.getAnnotations();
+ assertNotNull(annotations);
+ checkExpectedAnnotations(info.getAnnotations(), new Class[] {AnnotationWithClass.class});
+ AnnotationValue annotation = getAnnotationCheckTypeAndName(info, AnnotationWithClass.class.getName());
+ Value value = annotation.getValue("clazz");
+ checkClassValue(value, clazz);
+ Annotation ann = annotation.getUnderlyingAnnotation();
+ AnnotationWithClass real = assertInstanceOf(ann, AnnotationWithClass.class);
+ assertSame(clazz, real.clazz());
+ }
+
private void checkAnnotations(AnnotatedInfo info, ExpectedComplexAnnotationData expectedComplexAnnotationData)
{
AnnotationValue[] annotations = info.getAnnotations();
More information about the jboss-cvs-commits
mailing list