[jboss-cvs] JBossAS SVN: r93007 - in projects/annotations/trunk/core: src/test/java/org/jboss/annotations/test and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Aug 30 10:47:25 EDT 2009


Author: jesper.pedersen
Date: 2009-08-30 10:47:25 -0400 (Sun, 30 Aug 2009)
New Revision: 93007

Added:
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/AbstractTest.java
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/ITest.java
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/Test.java
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/package.html
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/AbstractTest.java
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/ITest.java
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/Test.java
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/package.html
Modified:
   projects/annotations/trunk/core/build.xml
   projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/InheritanceTests.java
Log:
[JBANN-3] Support inheritance (Part 6)

Modified: projects/annotations/trunk/core/build.xml
===================================================================
--- projects/annotations/trunk/core/build.xml	2009-08-30 13:57:36 UTC (rev 93006)
+++ projects/annotations/trunk/core/build.xml	2009-08-30 14:47:25 UTC (rev 93007)
@@ -111,6 +111,12 @@
     <jar destfile="${build.core.dir}/testjars/inheritanceclassclass.jar"
          basedir="${build.core.dir}/test"
          includes="**/common/**, **/inheritanceclassclass/**"/>
+    <jar destfile="${build.core.dir}/testjars/inheritanceclassinterface.jar"
+         basedir="${build.core.dir}/test"
+         includes="**/common/**, **/inheritanceclassinterface/**"/>
+    <jar destfile="${build.core.dir}/testjars/inheritanceclassinterfacemethod.jar"
+         basedir="${build.core.dir}/test"
+         includes="**/common/**, **/inheritanceclassinterfacemethod/**"/>
 
     <!-- Interface based tests --> 
     <jar destfile="${build.core.dir}/testjars/interfaceempty.jar"
@@ -150,6 +156,8 @@
     <!-- Inheritance based tests --> 
     <indexer input="${build.core.dir}/testjars/inheritanceclassabstract.jar"/>
     <indexer input="${build.core.dir}/testjars/inheritanceclassclass.jar"/>
+    <indexer input="${build.core.dir}/testjars/inheritanceclassinterface.jar"/>
+    <indexer input="${build.core.dir}/testjars/inheritanceclassinterfacemethod.jar"/>
 
     <!-- Interface based tests --> 
     <indexer input="${build.core.dir}/testjars/interfaceempty.jar"/>

Modified: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/InheritanceTests.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/InheritanceTests.java	2009-08-30 13:57:36 UTC (rev 93006)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/InheritanceTests.java	2009-08-30 14:47:25 UTC (rev 93007)
@@ -26,6 +26,7 @@
 import org.jboss.annotations.AnnotationRepository;
 import org.jboss.annotations.AnnotationScanner;
 import org.jboss.annotations.AnnotationType;
+import org.jboss.annotations.test.tests.common.MyAnnotation;
 
 import java.net.URL;
 import java.util.Collection;
@@ -137,4 +138,93 @@
          }
       }
    }
+
+   /**
+    * Class: Interface
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testClassInterface() throws Throwable
+   {
+      URL archive = getURL("inheritanceclassinterface.jar");
+      AnnotationRepository ar = scanner.scan(new URL[] {archive});
+
+      assertNotNull(ar);
+
+      assertTrue(ar.hasAnnotation(Deprecated.class));
+
+      Collection<Annotation> l = ar.getAnnotation(Deprecated.class);
+
+      assertNotNull(l);
+      assertTrue("Size=" + l.size(), l.size() == 2);
+
+      for (Annotation annotation : l)
+      {
+         if ("org.jboss.annotations.test.tests.inheritanceclassinterface.ITest".equals(annotation.getClassName()))
+         {
+            assertNotNull(annotation.getAnnotationClassName());
+            assertNotNull(annotation.getAnnotation());
+            assertTrue(annotation.getType() == AnnotationType.CLASS);
+            assertNull(annotation.getMemberName());
+            assertNull(annotation.getParameterTypes());
+         }
+         else if ("org.jboss.annotations.test.tests.inheritanceclassinterface.Test".equals(annotation.getClassName()))
+         {
+            assertNotNull(annotation.getAnnotationClassName());
+            assertNotNull(annotation.getAnnotation());
+            assertTrue(annotation.getType() == AnnotationType.CLASS);
+            assertNull(annotation.getMemberName());
+            assertNull(annotation.getParameterTypes());
+         }
+         else
+         {
+            fail("Unknown annotation location");
+         }
+      }
+   }
+
+   /**
+    * Class interface method
+    * @throws Throwable throwable exception 
+    */
+   @Test
+   public void testClassInterfaceMethod() throws Throwable
+   {
+      URL archive = getURL("inheritanceclassinterfacemethod.jar");
+      AnnotationRepository ar = scanner.scan(new URL[] {archive});
+
+      assertNotNull(ar);
+
+      assertTrue(ar.hasAnnotation(MyAnnotation.class));
+
+      Collection<Annotation> l = ar.getAnnotation(MyAnnotation.class);
+
+      assertNotNull(l);
+      assertTrue("Size=" + l.size(), l.size() == 2);
+
+      for (Annotation annotation : l)
+      {
+         if ("org.jboss.annotations.test.tests.inheritanceclassinterfacemethod.Test".equals(annotation.getClassName()))
+         {
+            assertNotNull(annotation.getAnnotationClassName());
+            assertNotNull(annotation.getAnnotation());
+            assertTrue(annotation.getType() == AnnotationType.METHOD);
+            assertEquals("myMethod", annotation.getMemberName());
+            assertNull(annotation.getParameterTypes());
+         }
+         else if ("org.jboss.annotations.test.tests.inheritanceclassinterfacemethod.ITest"
+                  .equals(annotation.getClassName()))
+         {
+            assertNotNull(annotation.getAnnotationClassName());
+            assertNotNull(annotation.getAnnotation());
+            assertTrue(annotation.getType() == AnnotationType.METHOD);
+            assertEquals("myMethod", annotation.getMemberName());
+            assertNull(annotation.getParameterTypes());
+         }
+         else
+         {
+            fail("Unknown annotation location");
+         }
+      }
+   }
 }

Added: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/AbstractTest.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/AbstractTest.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/AbstractTest.java	2009-08-30 14:47:25 UTC (rev 93007)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.annotations.test.tests.inheritanceclassinterface;
+
+/**
+ * Test
+ */
+public abstract class AbstractTest implements ITest
+{
+}

Added: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/ITest.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/ITest.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/ITest.java	2009-08-30 14:47:25 UTC (rev 93007)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.annotations.test.tests.inheritanceclassinterface;
+
+/**
+ * Test
+ */
+ at Deprecated
+public interface ITest
+{
+}

Added: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/Test.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/Test.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/Test.java	2009-08-30 14:47:25 UTC (rev 93007)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.annotations.test.tests.inheritanceclassinterface;
+
+/**
+ * Test
+ */
+public class Test extends AbstractTest
+{
+}

Added: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/package.html
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/package.html	                        (rev 0)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterface/package.html	2009-08-30 14:47:25 UTC (rev 93007)
@@ -0,0 +1,3 @@
+<body>
+An interface with a class level annotation implemented by an abstract class which a class extends
+</body>

Added: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/AbstractTest.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/AbstractTest.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/AbstractTest.java	2009-08-30 14:47:25 UTC (rev 93007)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.annotations.test.tests.inheritanceclassinterfacemethod;
+
+/**
+ * AbstractTest
+ */
+public abstract class AbstractTest implements ITest
+{
+}

Added: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/ITest.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/ITest.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/ITest.java	2009-08-30 14:47:25 UTC (rev 93007)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.annotations.test.tests.inheritanceclassinterfacemethod;
+
+import org.jboss.annotations.test.tests.common.MyAnnotation;
+
+/**
+ * Test
+ */
+public interface ITest
+{
+   /**
+    * My method
+    */
+   @MyAnnotation
+   public void myMethod();
+}

Added: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/Test.java
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/Test.java	                        (rev 0)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/Test.java	2009-08-30 14:47:25 UTC (rev 93007)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.annotations.test.tests.inheritanceclassinterfacemethod;
+
+/**
+ * Test
+ */
+public class Test extends AbstractTest
+{
+   /**
+    * My method
+    */
+   public void myMethod()
+   {
+   }
+}

Added: projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/package.html
===================================================================
--- projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/package.html	                        (rev 0)
+++ projects/annotations/trunk/core/src/test/java/org/jboss/annotations/test/tests/inheritanceclassinterfacemethod/package.html	2009-08-30 14:47:25 UTC (rev 93007)
@@ -0,0 +1,3 @@
+<body>
+An interface with a method level annotation implemented by an abstract class extended by a class
+</body>




More information about the jboss-cvs-commits mailing list