[jboss-cvs] microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test ...

Kabir Khan kkhan at jboss.com
Wed Jul 19 14:19:58 EDT 2006


  User: kkhan   
  Date: 06/07/19 14:19:58

  Modified:    src/tests/org/jboss/test/kernel/deployment/xml/test          
                        BeanTestCase.java InstallTestCase.java
                        AbstractXMLTest.java PropertyTestCase.java
                        AnnotationTestCase.java XMLTestSuite.java
                        ConstructorTestCase.java ParameterTestCase.java
                        LifecycleTestCase.java
  Removed:     src/tests/org/jboss/test/kernel/deployment/xml/test          
                        AttributeTestCase.java
  Log:
  [JBMICROCONT-98] Make the annotation metadata more free format
  
  Revision  Changes    Path
  1.4       +5 -5      microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BeanTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- BeanTestCase.java	23 Jun 2006 10:07:09 -0000	1.3
  +++ BeanTestCase.java	19 Jul 2006 18:19:58 -0000	1.4
  @@ -33,7 +33,7 @@
    * BeanTestCase.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class BeanTestCase extends AbstractXMLTest
   {
  @@ -104,7 +104,7 @@
         assertEquals("Dummy", bean.getBean());
         assertNull(bean.getMode());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
         assertAnnotations(expected, bean.getAnnotations());
         assertNull(bean.getClassLoader());
         assertNull(bean.getConstructor());
  @@ -126,9 +126,9 @@
         assertEquals("Dummy", bean.getBean());
         assertNull(bean.getMode());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  -      expected.add("Annotation2");
  -      expected.add("Annotation3");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation2");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation3");
         assertAnnotations(expected, bean.getAnnotations());
         assertNull(bean.getClassLoader());
         assertNull(bean.getConstructor());
  
  
  
  1.4       +5 -5      microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InstallTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: InstallTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InstallTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- InstallTestCase.java	23 Jun 2006 10:07:09 -0000	1.3
  +++ InstallTestCase.java	19 Jul 2006 18:19:58 -0000	1.4
  @@ -35,7 +35,7 @@
    * InstallTestCase.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class InstallTestCase extends AbstractXMLTest
   {
  @@ -87,7 +87,7 @@
         assertEquals(ControllerState.INSTALLED, install.getDependentState());
         assertEquals("Dummy", install.getMethodName());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
         assertAnnotations(expected, install.getAnnotations());
         assertNull(install.getParameters());
      }
  @@ -99,9 +99,9 @@
         assertEquals(ControllerState.INSTALLED, install.getDependentState());
         assertEquals("Dummy", install.getMethodName());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  -      expected.add("Annotation2");
  -      expected.add("Annotation3");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation2");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation3");
         assertAnnotations(expected, install.getAnnotations());
         assertNull(install.getParameters());
      }
  
  
  
  1.6       +2 -2      microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractXMLTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AbstractXMLTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractXMLTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- AbstractXMLTest.java	23 Jun 2006 10:07:09 -0000	1.5
  +++ AbstractXMLTest.java	19 Jul 2006 18:19:58 -0000	1.6
  @@ -56,7 +56,7 @@
    * AbstractXMLTest.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class AbstractXMLTest extends AbstractTestCaseWithSetup
   {
  @@ -148,7 +148,7 @@
         for (Iterator i = annotations.iterator(); i.hasNext();)
         {
            AnnotationMetaData annotation = (AnnotationMetaData) i.next();
  -         if (clonedExpected.remove(annotation.getName()) == false)
  +         if (clonedExpected.remove(annotation.getAnnotationInstance().annotationType().getName()) == false)
               fail("Did not expect " + annotation + " expected " + expected);
         }
         if (clonedExpected.size() != 0)
  
  
  
  1.4       +5 -5      microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/PropertyTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PropertyTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/PropertyTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- PropertyTestCase.java	23 Jun 2006 10:07:09 -0000	1.3
  +++ PropertyTestCase.java	19 Jul 2006 18:19:58 -0000	1.4
  @@ -35,7 +35,7 @@
    * PropertyTestCase.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class PropertyTestCase extends AbstractXMLTest
   {
  @@ -75,7 +75,7 @@
         PropertyMetaData property = getProperty("PropertyWithAnnotation.xml");
         assertNotNull("PropertyName", property.getName());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
         assertAnnotations(expected, property.getAnnotations());
         assertNull(property.getValue());
      }
  @@ -85,9 +85,9 @@
         PropertyMetaData property = getProperty("PropertyWithAnnotations.xml");
         assertNotNull("PropertyName", property.getName());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  -      expected.add("Annotation2");
  -      expected.add("Annotation3");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation2");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation3");
         assertAnnotations(expected, property.getAnnotations());
         assertNull(property.getValue());
      }
  
  
  
  1.4       +55 -18    microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AnnotationTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AnnotationTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AnnotationTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- AnnotationTestCase.java	23 Jun 2006 10:07:09 -0000	1.3
  +++ AnnotationTestCase.java	19 Jul 2006 18:19:58 -0000	1.4
  @@ -21,7 +21,7 @@
   */
   package org.jboss.test.kernel.deployment.xml.test;
   
  -import java.util.HashSet;
  +import java.lang.annotation.Annotation;
   import java.util.Set;
   
   import junit.framework.Test;
  @@ -29,12 +29,15 @@
   import org.jboss.beans.metadata.plugins.AbstractAnnotationMetaData;
   import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
   import org.jboss.beans.metadata.spi.ConstructorMetaData;
  +import org.jboss.test.kernel.deployment.xml.support.Annotation1;
  +import org.jboss.test.kernel.deployment.xml.support.AnnotationWithAttribute;
  +import org.jboss.test.kernel.deployment.xml.support.AnnotationWithAttributes;
   
   /**
    * AnnotationTestCase.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class AnnotationTestCase extends AbstractXMLTest
   {
  @@ -50,38 +53,72 @@
         return annotation;
      }
      
  -   public void testAnnotationWithName() throws Exception
  +   public void testSimpleAnnotation() throws Exception
      {
  -      AbstractAnnotationMetaData annotation = getAnnotation("AnnotationWithName.xml");
  -      assertEquals("Annotation1", annotation.getName());
  -      assertNull(annotation.getAttributes());
  +      AbstractAnnotationMetaData annotation = getAnnotation("AnnotationSimple.xml");
  +      Annotation ann = annotation.getAnnotationInstance();
  +      assertEquals(Annotation1.class.getName(), ann.annotationType().getName());
  +      assertTrue(ann instanceof Annotation1);
  +      Annotation1 ann1 = (Annotation1)ann;
      }
      
      public void testAnnotationWithAttribute() throws Exception
      {
         AbstractAnnotationMetaData annotation = getAnnotation("AnnotationWithAttribute.xml");
  -      assertEquals("Dummy", annotation.getName());
  -      HashSet<String> expected = new HashSet<String>();
  -      expected.add("Attribute1");
  -      assertAttributes(expected, annotation.getAttributes());
  +      Annotation ann = annotation.getAnnotationInstance();
  +      assertEquals(AnnotationWithAttribute.class.getName(), ann.annotationType().getName());
  +      assertTrue(ann instanceof AnnotationWithAttribute);
  +      AnnotationWithAttribute ann1 = (AnnotationWithAttribute)ann;
  +      assertNotNull(ann1.attribute());
  +      assertEquals(Long.class, ann1.attribute());
      }
      
      public void testAnnotationWithAttributes() throws Exception
      {
         AbstractAnnotationMetaData annotation = getAnnotation("AnnotationWithAttributes.xml");
  -      assertEquals("Dummy", annotation.getName());
  -      HashSet<String> expected = new HashSet<String>();
  -      expected.add("Attribute1");
  -      expected.add("Attribute2");
  -      expected.add("Attribute3");
  -      assertAttributes(expected, annotation.getAttributes());
  +      Annotation ann = annotation.getAnnotationInstance();
  +      assertEquals(AnnotationWithAttributes.class.getName(), ann.annotationType().getName());
  +      assertTrue(ann instanceof AnnotationWithAttributes);
  +      AnnotationWithAttributes ann1 = (AnnotationWithAttributes)ann;
  +      assertNotNull(ann1.clazz());
  +      assertEquals(Integer.class, ann1.clazz());
  +      assertNotNull(ann1.integer());
  +      assertEquals(100, ann1.integer());
  +      assertNotNull(ann1.str());
  +      assertEquals("Annotations are nice", ann1.str());
      }
   
  -   public void testAnnotationBadNoName() throws Exception
  +   public void testAnnotationBadNoContent() throws Exception
      {
         try
         {
  -         unmarshalBean("AnnotationBadNoName.xml");
  +         unmarshalBean("AnnotationBadNoContent.xml");
  +         fail("Should not be here");
  +      }
  +      catch (Exception expected)
  +      {
  +         checkJBossXBException(IllegalArgumentException.class, expected);
  +      }
  +   }
  +
  +   public void testAnnotationBadNoContent2() throws Exception
  +   {
  +      try
  +      {
  +         unmarshalBean("AnnotationBadNoContent2.xml");
  +         fail("Should not be here");
  +      }
  +      catch (Exception expected)
  +      {
  +         checkJBossXBException(IllegalArgumentException.class, expected);
  +      }
  +   }
  +
  +   public void testAnnotationBadNoLeadingAt() throws Exception
  +   {
  +      try
  +      {
  +         unmarshalBean("AnnotationBadNoLeadingAt.xml");
            fail("Should not be here");
         }
         catch (Exception expected)
  
  
  
  1.4       +1 -2      microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: XMLTestSuite.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- XMLTestSuite.java	31 Jan 2006 14:34:57 -0000	1.3
  +++ XMLTestSuite.java	19 Jul 2006 18:19:58 -0000	1.4
  @@ -29,7 +29,7 @@
    * XML Test Suite.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class XMLTestSuite extends TestSuite
   {
  @@ -63,7 +63,6 @@
         suite.addTest(ArrayTestCase.suite());
         suite.addTest(MapTestCase.suite());
         suite.addTest(AnnotationTestCase.suite());
  -      suite.addTest(AttributeTestCase.suite());
         
         return suite;
      }
  
  
  
  1.6       +5 -5      microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ConstructorTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConstructorTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ConstructorTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- ConstructorTestCase.java	23 Jun 2006 10:07:09 -0000	1.5
  +++ ConstructorTestCase.java	19 Jul 2006 18:19:58 -0000	1.6
  @@ -33,7 +33,7 @@
    * ConstructorTestCase.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class ConstructorTestCase extends AbstractXMLTest
   {
  @@ -84,7 +84,7 @@
         assertNull(constructor.getFactoryClass());
         assertNull(constructor.getFactoryMethod());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
         assertAnnotations(expected, constructor.getAnnotations());
         assertNull(constructor.getFactory());
         assertNull(constructor.getParameters());
  @@ -97,9 +97,9 @@
         assertNull(constructor.getFactoryClass());
         assertNull(constructor.getFactoryMethod());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  -      expected.add("Annotation2");
  -      expected.add("Annotation3");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation2");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation3");
         assertAnnotations(expected, constructor.getAnnotations());
         assertNull(constructor.getFactory());
         assertNull(constructor.getParameters());
  
  
  
  1.3       +5 -5      microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ParameterTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ParameterTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ParameterTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- ParameterTestCase.java	23 Jun 2006 10:07:09 -0000	1.2
  +++ ParameterTestCase.java	19 Jul 2006 18:19:58 -0000	1.3
  @@ -34,7 +34,7 @@
    * ParameterTestCase.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class ParameterTestCase extends AbstractXMLTest
   {
  @@ -72,7 +72,7 @@
         ParameterMetaData parameter = getParameter("ParameterWithAnnotation.xml");
         assertNull(parameter.getType());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
         assertAnnotations(expected, parameter.getAnnotations());
         assertNull(parameter.getValue());
      }
  @@ -82,9 +82,9 @@
         ParameterMetaData parameter = getParameter("ParameterWithAnnotations.xml");
         assertNull(parameter.getType());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  -      expected.add("Annotation2");
  -      expected.add("Annotation3");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation2");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation3");
         assertAnnotations(expected, parameter.getAnnotations());
         assertNull(parameter.getValue());
      }
  
  
  
  1.3       +5 -5      microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LifecycleTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- LifecycleTestCase.java	23 Jun 2006 10:07:09 -0000	1.2
  +++ LifecycleTestCase.java	19 Jul 2006 18:19:58 -0000	1.3
  @@ -33,7 +33,7 @@
    * LifecycleTestCase.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class LifecycleTestCase extends AbstractXMLTest
   {
  @@ -66,7 +66,7 @@
         LifecycleMetaData lifecycle = getLifecycle("LifecycleWithAnnotation.xml");
         assertNull(lifecycle.getMethodName());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
         assertAnnotations(expected, lifecycle.getAnnotations());
         assertNull(lifecycle.getParameters());
      }
  @@ -76,9 +76,9 @@
         LifecycleMetaData lifecycle = getLifecycle("LifecycleWithAnnotations.xml");
         assertNull(lifecycle.getMethodName());
         HashSet<String> expected = new HashSet<String>();
  -      expected.add("Annotation1");
  -      expected.add("Annotation2");
  -      expected.add("Annotation3");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation1");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation2");
  +      expected.add("org.jboss.test.kernel.deployment.xml.support.Annotation3");
         assertAnnotations(expected, lifecycle.getAnnotations());
         assertNull(lifecycle.getParameters());
      }
  
  
  



More information about the jboss-cvs-commits mailing list