[jboss-svn-commits] JBoss Common SVN: r2718 - in jbossxb/trunk/src/test/java/org/jboss: test/xb/builder/object/mc/support/model and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Mar 4 11:36:05 EST 2008


Author: adrian at jboss.org
Date: 2008-03-04 11:36:05 -0500 (Tue, 04 Mar 2008)
New Revision: 2718

Modified:
   jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/LanguageMetaData.java
   jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/MappedAnnotationMetaData.java
   jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/NamedAnnotationMetaData.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractAnnotationMetaData.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AnnotationMetaData.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/AbstractMCTest.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/AnnotationTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/BeanTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/CallbackTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/ConstructorTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/InstallTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/LifecycleTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/ParameterTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/PropertyTestCase.java
Log:
Remove the dependency of JBossXB testsuite on the metadata repository code, it isn't necessary.

Modified: jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/LanguageMetaData.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/LanguageMetaData.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/LanguageMetaData.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -27,7 +27,6 @@
 import javax.xml.bind.annotation.XmlAttribute;
 
 import org.jboss.javaee.annotation.Description;
-import org.jboss.metadata.annotation.AbstractAnnotationImpl;
 import org.jboss.xb.binding.Constants;
 
 /**

Modified: jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/MappedAnnotationMetaData.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/MappedAnnotationMetaData.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/MappedAnnotationMetaData.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -27,8 +27,6 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import org.jboss.metadata.annotation.AbstractAnnotationImpl;
-
 /**
  * MappedAnnotationMetaData.
  * 

Modified: jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/NamedAnnotationMetaData.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/NamedAnnotationMetaData.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/javaee/metadata/support/NamedAnnotationMetaData.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -24,8 +24,6 @@
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
 
-import org.jboss.metadata.annotation.AbstractAnnotationImpl;
-
 /**
  * NamedAnnotationMetaData.
  * 

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractAnnotationMetaData.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractAnnotationMetaData.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractAnnotationMetaData.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -24,15 +24,11 @@
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
 
-import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlValue;
 
-import org.jboss.annotation.factory.AnnotationCreator;
-import org.jboss.annotation.factory.ast.TokenMgrError;
 import org.jboss.util.JBossObject;
 import org.jboss.util.JBossStringBuilder;
-import org.jboss.util.StringPropertyReplacer;
 
 /**
  * Metadata for an annotation.
@@ -81,32 +77,6 @@
       this.replace = replace;
    }
 
-   @XmlTransient
-   public Annotation getAnnotationInstance()
-   {
-      try
-      {
-         String annString = annotation;
-         // TODO - JBMICROCONT-143 + any better way?
-         if (replace)
-         {
-            annString = StringPropertyReplacer.replaceProperties(annString);
-         }
-         //FIXME [JBMICROCONT-99] [JBAOP-278] Use the loader for the bean?
-         ann = (Annotation)AnnotationCreator.createAnnotation(annString, Thread.currentThread().getContextClassLoader());
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Error creating annotation for " + annotation, e);
-      }
-      catch(TokenMgrError e)
-      {
-         throw new RuntimeException("Error creating annotation for " + annotation, e);
-      }
-
-      return ann;
-   }
-
    public void toString(JBossStringBuilder buffer)
    {
       if (ann == null)

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AnnotationMetaData.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AnnotationMetaData.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AnnotationMetaData.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -21,10 +21,6 @@
 */
 package org.jboss.test.xb.builder.object.mc.support.model;
 
-import java.lang.annotation.Annotation;
-
-import javax.xml.bind.annotation.XmlTransient;
-
 import org.jboss.util.JBossInterface;
 
 /**
@@ -35,6 +31,5 @@
  */
 public interface AnnotationMetaData extends JBossInterface, MetaDataVisitorNode
 {
-   @XmlTransient
-   Annotation getAnnotationInstance();
+   String getAnnotation();
 }

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/AbstractMCTest.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/AbstractMCTest.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/AbstractMCTest.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -88,7 +88,7 @@
       for (Iterator i = annotations.iterator(); i.hasNext();)
       {
          AnnotationMetaData annotation = (AnnotationMetaData) i.next();
-         if (clonedExpected.remove(annotation.getAnnotationInstance().annotationType().getName()) == false)
+         if (clonedExpected.remove(annotation.getAnnotation()) == false)
             fail("Did not expect " + annotation + " expected " + expected);
       }
       if (clonedExpected.size() != 0)

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/AnnotationTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/AnnotationTestCase.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/AnnotationTestCase.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -21,14 +21,11 @@
 */
 package org.jboss.test.xb.builder.object.mc.test;
 
-import java.lang.annotation.Annotation;
 import java.util.Set;
 
 import junit.framework.Test;
 
 import org.jboss.test.xb.builder.object.mc.support.Annotation1;
-import org.jboss.test.xb.builder.object.mc.support.AnnotationWithAttribute;
-import org.jboss.test.xb.builder.object.mc.support.AnnotationWithAttributes;
 import org.jboss.test.xb.builder.object.mc.support.model.AbstractAnnotationMetaData;
 import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData;
 import org.jboss.test.xb.builder.object.mc.support.model.ConstructorMetaData;
@@ -56,82 +53,9 @@
    public void testAnnotationSimple() throws Exception
    {
       AbstractAnnotationMetaData annotation = getAnnotation();
-      Annotation ann = annotation.getAnnotationInstance();
-      assertEquals(Annotation1.class.getName(), ann.annotationType().getName());
-      assertTrue(ann instanceof Annotation1);
+      assertEquals("@" + Annotation1.class.getName(), annotation.getAnnotation());
    }
-   
-   public void testAnnotationWithAttribute() throws Exception
-   {
-      AbstractAnnotationMetaData annotation = getAnnotation();
-      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();
-      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());
-   }
 
-   /* TODO
-   public void testAnnotationBadNoContent() throws Exception
-   {
-      try
-      {
-         unmarshalBean("AnnotationBadNoContent.xml");
-         fail("Should not be here");
-      }
-      catch (Exception expected)
-      {
-         checkJBossXBException(IllegalArgumentException.class, expected);
-      }
-   }
-   */
-
-   /* TODO
-   public void testAnnotationBadNoContent2() throws Exception
-   {
-      try
-      {
-         unmarshalBean("AnnotationBadNoContent2.xml");
-         fail("Should not be here");
-      }
-      catch (Exception expected)
-      {
-         checkJBossXBException(IllegalArgumentException.class, expected);
-      }
-   }
-   */
-
-   /* TODO
-   public void testAnnotationBadNoLeadingAt() throws Exception
-   {
-      try
-      {
-         unmarshalBean("AnnotationBadNoLeadingAt.xml");
-         fail("Should not be here");
-      }
-      catch (Exception expected)
-      {
-         checkJBossXBException(IllegalArgumentException.class, expected);
-      }
-   }
-   */
-
    public static Test suite()
    {
       return suite(AnnotationTestCase.class);

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/BeanTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/BeanTestCase.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/BeanTestCase.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -113,7 +113,7 @@
       assertEquals("Dummy", bean.getBean());
       assertNull(bean.getMode());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
+      expected.add("@" + Annotation1.class.getName());
       assertAnnotations(expected, bean.getAnnotations());
       assertNull(bean.getClassLoader());
       assertNull(bean.getConstructor());
@@ -137,9 +137,9 @@
       assertEquals("Dummy", bean.getBean());
       assertNull(bean.getMode());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
-      expected.add(Annotation2.class.getName());
-      expected.add(Annotation3.class.getName());
+      expected.add("@" + Annotation1.class.getName());
+      expected.add("@" + Annotation2.class.getName());
+      expected.add("@" + Annotation3.class.getName());
       assertAnnotations(expected, bean.getAnnotations());
       assertNull(bean.getClassLoader());
       assertNull(bean.getConstructor());

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/CallbackTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/CallbackTestCase.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/CallbackTestCase.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -109,7 +109,7 @@
       assertEquals(ControllerState.INSTALLED, install.getDependentState());
       assertEquals("Dummy", install.getMethodName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
+      expected.add("@" + Annotation1.class.getName());
       assertAnnotations(expected, install.getAnnotations());
       assertNull(install.getParameters());
    }
@@ -121,9 +121,9 @@
       assertEquals(ControllerState.INSTALLED, install.getDependentState());
       assertEquals("Dummy", install.getMethodName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
-      expected.add(Annotation2.class.getName());
-      expected.add(Annotation3.class.getName());
+      expected.add("@" + Annotation1.class.getName());
+      expected.add("@" + Annotation2.class.getName());
+      expected.add("@" + Annotation3.class.getName());
       assertAnnotations(expected, install.getAnnotations());
       assertNull(install.getParameters());
    }
@@ -203,7 +203,7 @@
       assertEquals(ControllerState.INSTALLED, install.getDependentState());
       assertEquals("Dummy", install.getMethodName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
+      expected.add("@" + Annotation1.class.getName());
       assertAnnotations(expected, install.getAnnotations());
       assertNull(install.getParameters());
    }
@@ -215,9 +215,9 @@
       assertEquals(ControllerState.INSTALLED, install.getDependentState());
       assertEquals("Dummy", install.getMethodName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
-      expected.add(Annotation2.class.getName());
-      expected.add(Annotation3.class.getName());
+      expected.add("@" + Annotation1.class.getName());
+      expected.add("@" + Annotation2.class.getName());
+      expected.add("@" + Annotation3.class.getName());
       assertAnnotations(expected, install.getAnnotations());
       assertNull(install.getParameters());
    }

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/ConstructorTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/ConstructorTestCase.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/ConstructorTestCase.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -100,7 +100,7 @@
       assertNull(constructor.getFactoryClass());
       assertNull(constructor.getFactoryMethod());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
+      expected.add("@" + Annotation1.class.getName());
       assertAnnotations(expected, constructor.getAnnotations());
       assertNull(constructor.getFactory());
       assertNull(constructor.getParameters());
@@ -113,9 +113,9 @@
       assertNull(constructor.getFactoryClass());
       assertNull(constructor.getFactoryMethod());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
-      expected.add(Annotation2.class.getName());
-      expected.add(Annotation3.class.getName());
+      expected.add("@" + Annotation1.class.getName());
+      expected.add("@" + Annotation2.class.getName());
+      expected.add("@" + Annotation3.class.getName());
       assertAnnotations(expected, constructor.getAnnotations());
       assertNull(constructor.getFactory());
       assertNull(constructor.getParameters());

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/InstallTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/InstallTestCase.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/InstallTestCase.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -90,7 +90,7 @@
       assertEquals(ControllerState.INSTALLED, install.getDependentState());
       assertEquals("Dummy", install.getMethodName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
+      expected.add("@" + Annotation1.class.getName());
       assertAnnotations(expected, install.getAnnotations());
       assertNull(install.getParameters());
    }
@@ -102,9 +102,9 @@
       assertEquals(ControllerState.INSTALLED, install.getDependentState());
       assertEquals("Dummy", install.getMethodName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
-      expected.add(Annotation2.class.getName());
-      expected.add(Annotation3.class.getName());
+      expected.add("@" + Annotation1.class.getName());
+      expected.add("@" + Annotation2.class.getName());
+      expected.add("@" + Annotation3.class.getName());
       assertAnnotations(expected, install.getAnnotations());
       assertNull(install.getParameters());
    }

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/LifecycleTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/LifecycleTestCase.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/LifecycleTestCase.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -78,7 +78,7 @@
       LifecycleMetaData lifecycle = getLifecycle();
       assertNull(lifecycle.getMethodName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
+      expected.add("@" + Annotation1.class.getName());
       assertAnnotations(expected, lifecycle.getAnnotations());
       assertNull(lifecycle.getParameters());
    }
@@ -88,9 +88,9 @@
       LifecycleMetaData lifecycle = getLifecycle();
       assertNull(lifecycle.getMethodName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
-      expected.add(Annotation2.class.getName());
-      expected.add(Annotation3.class.getName());
+      expected.add("@" + Annotation1.class.getName());
+      expected.add("@" + Annotation2.class.getName());
+      expected.add("@" + Annotation3.class.getName());
       assertAnnotations(expected, lifecycle.getAnnotations());
       assertNull(lifecycle.getParameters());
    }

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/ParameterTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/ParameterTestCase.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/ParameterTestCase.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -84,7 +84,7 @@
       ParameterMetaData parameter = getParameter();
       assertNull(parameter.getType());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
+      expected.add("@" + Annotation1.class.getName());
       assertAnnotations(expected, parameter.getAnnotations());
       assertNull(parameter.getValue());
    }
@@ -94,9 +94,9 @@
       ParameterMetaData parameter = getParameter();
       assertNull(parameter.getType());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
-      expected.add(Annotation2.class.getName());
-      expected.add(Annotation3.class.getName());
+      expected.add("@" + Annotation1.class.getName());
+      expected.add("@" + Annotation2.class.getName());
+      expected.add("@" + Annotation3.class.getName());
       assertAnnotations(expected, parameter.getAnnotations());
       assertNull(parameter.getValue());
    }

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/PropertyTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/PropertyTestCase.java	2008-03-03 17:34:22 UTC (rev 2717)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/PropertyTestCase.java	2008-03-04 16:36:05 UTC (rev 2718)
@@ -89,7 +89,7 @@
       PropertyMetaData property = getProperty();
       assertNotNull("PropertyName", property.getName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
+      expected.add("@" + Annotation1.class.getName());
       assertAnnotations(expected, property.getAnnotations());
       assertNull(property.getValue());
    }
@@ -99,9 +99,9 @@
       PropertyMetaData property = getProperty();
       assertNotNull("PropertyName", property.getName());
       HashSet<String> expected = new HashSet<String>();
-      expected.add(Annotation1.class.getName());
-      expected.add(Annotation2.class.getName());
-      expected.add(Annotation3.class.getName());
+      expected.add("@" + Annotation1.class.getName());
+      expected.add("@" + Annotation2.class.getName());
+      expected.add("@" + Annotation3.class.getName());
       assertAnnotations(expected, property.getAnnotations());
       assertNull(property.getValue());
    }




More information about the jboss-svn-commits mailing list