[jboss-cvs] JBossAS SVN: r80470 - in projects/jboss-mdr/tags: 2.0.1.GA and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 4 05:51:29 EST 2008


Author: alesj
Date: 2008-11-04 05:51:28 -0500 (Tue, 04 Nov 2008)
New Revision: 80470

Added:
   projects/jboss-mdr/tags/2.0.1.GA/
   projects/jboss-mdr/tags/2.0.1.GA/pom.xml
   projects/jboss-mdr/tags/2.0.1.GA/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java
   projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/ContainerTest.java
   projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Complex.java
   projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Name.java
   projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/NameDefaults.java
   projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/NameImpl.java
   projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.java
Removed:
   projects/jboss-mdr/tags/2.0.1.GA/pom.xml
   projects/jboss-mdr/tags/2.0.1.GA/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java
   projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/ContainerTest.java
   projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Complex.java
   projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.java
Log:
[maven-release-plugin]  copy for tag 2.0.1.GA

Copied: projects/jboss-mdr/tags/2.0.1.GA (from rev 79178, projects/jboss-mdr/branches/Branch_2_0)

Deleted: projects/jboss-mdr/tags/2.0.1.GA/pom.xml
===================================================================
--- projects/jboss-mdr/branches/Branch_2_0/pom.xml	2008-10-07 08:03:30 UTC (rev 79178)
+++ projects/jboss-mdr/tags/2.0.1.GA/pom.xml	2008-11-04 10:51:28 UTC (rev 80470)
@@ -1,116 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <groupId>org.jboss</groupId>
-    <artifactId>jboss-parent</artifactId>
-    <version>4</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>jboss-mdr</artifactId>
-  <version>2.0.0-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <name>JBoss MetaData Repository</name>
-  <url>http://www.jboss.com/products/jbossmc</url>
-  <description>JBoss MetaData Repository</description>
-  <scm>
-    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-mdr/branches/Branch_2_0</connection>
-    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-mdr/branches/Branch_2_0</developerConnection>
-    <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-mdr/branches/Branch_2_0</url>
-  </scm>
-
-  <build>
-    <finalName>${artifactId}</finalName>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.4.3</version>
-        <configuration>
-          <redirectTestOutputToFile>true</redirectTestOutputToFile>
-          <includes>
-            <include>org/jboss/test/**/*TestCase.java</include>
-          </includes>
-          <useSystemClassLoader>true</useSystemClassLoader>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <version>2.2-beta-2</version>
-        <configuration>
-          <descriptors>
-            <descriptor>src/assembly/metadata-spi.xml</descriptor>
-            <descriptor>src/assembly/metadata.xml</descriptor>
-          </descriptors>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>2.0.2</version>
-        <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.2</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <!-- Global dependencies -->
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-reflect</artifactId>
-      <version>2.0.0.CR1</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.jboss</groupId>
-          <artifactId>jboss-common-core</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>jboss</groupId>
-          <artifactId>jboss-common-logging-spi</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>javassist</groupId>
-      <artifactId>javassist</artifactId>
-      <version>3.8.1.GA</version>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.logging</groupId>
-      <artifactId>jboss-logging-spi</artifactId>
-      <version>2.0.5.GA</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-common-core</artifactId>
-      <version>2.2.8.GA</version>
-    </dependency>
-    <!-- Test dependencies -->
-    <dependency>
-      <groupId>org.jboss.test</groupId>
-      <artifactId>jboss-test</artifactId>
-      <version>1.1.1.GA</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.4</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>
\ No newline at end of file

Copied: projects/jboss-mdr/tags/2.0.1.GA/pom.xml (from rev 80469, projects/jboss-mdr/branches/Branch_2_0/pom.xml)
===================================================================
--- projects/jboss-mdr/tags/2.0.1.GA/pom.xml	                        (rev 0)
+++ projects/jboss-mdr/tags/2.0.1.GA/pom.xml	2008-11-04 10:51:28 UTC (rev 80470)
@@ -0,0 +1,116 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss</groupId>
+    <artifactId>jboss-parent</artifactId>
+    <version>4</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>jboss-mdr</artifactId>
+  <version>2.0.1.GA</version>
+  <packaging>jar</packaging>
+  <name>JBoss MetaData Repository</name>
+  <url>http://www.jboss.com/products/jbossmc</url>
+  <description>JBoss MetaData Repository</description>
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-mdr/tags/2.0.1.GA</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-mdr/tags/2.0.1.GA</developerConnection>
+    <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/jboss-mdr/tags/2.0.1.GA</url>
+  </scm>
+
+  <build>
+    <finalName>${artifactId}</finalName>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.4.3</version>
+        <configuration>
+          <redirectTestOutputToFile>true</redirectTestOutputToFile>
+          <includes>
+            <include>org/jboss/test/**/*TestCase.java</include>
+          </includes>
+          <useSystemClassLoader>true</useSystemClassLoader>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.2-beta-2</version>
+        <configuration>
+          <descriptors>
+            <descriptor>src/assembly/metadata-spi.xml</descriptor>
+            <descriptor>src/assembly/metadata.xml</descriptor>
+          </descriptors>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.2</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <!-- Global dependencies -->
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-reflect</artifactId>
+      <version>2.0.0.GA</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>jboss</groupId>
+          <artifactId>jboss-common-logging-spi</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>javassist</groupId>
+      <artifactId>javassist</artifactId>
+      <version>3.8.1.GA</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+      <version>2.0.5.GA</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-common-core</artifactId>
+      <version>2.2.9.GA</version>
+    </dependency>
+    <!-- Test dependencies -->
+    <dependency>
+      <groupId>org.jboss.test</groupId>
+      <artifactId>jboss-test</artifactId>
+      <version>1.1.1.GA</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.4</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Deleted: projects/jboss-mdr/tags/2.0.1.GA/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java
===================================================================
--- projects/jboss-mdr/branches/Branch_2_0/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java	2008-10-07 08:03:30 UTC (rev 79178)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -1,130 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt 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.annotation.factory;
-
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Map;
-
-/**
- * InvocationHandler implementation for creating an annotation proxy.
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public class AnnotationProxy implements InvocationHandler, Serializable
-{
-   private static final long serialVersionUID = 1;
-   @SuppressWarnings("unchecked")
-   private Map map;
-   private Class<?> annotationType;
-
-   @SuppressWarnings("unchecked")
-   public AnnotationProxy(Class<?> annotationType, Map valueMap)
-   {
-      this.annotationType = annotationType;
-      map = valueMap;
-   }
-
-   public Object invoke(Object proxy, Method method, Object[] args)
-           throws Throwable
-   {
-      String name = method.getName();
-      if ("equals".equals(name))
-      {
-         return doEquals(proxy, args[0]);
-      }
-      else if ("hashCode".equals(name))
-      {
-         return doHashCode();
-      }
-      else if ("toString".equals(name))
-      {
-         return map.toString();
-      }
-      else if ("annotationType".equals(name))
-      {
-         return annotationType;
-      }
-
-      /*
-      Object obj = map.get(method.getName());
-      if (!method.getReturnType().equals(obj.getClass()))
-      {
-         System.err.println("***** " + method.toString() + " has bad return type: " + obj.getClass().getName());
-      }
-      return obj;
-      */
-      return map.get(name);
-   }
-
-   public Object getValue(String name)
-   {
-      return map.get(name);
-   }
-
-   @SuppressWarnings("unchecked")
-   private Object doEquals(Object proxy, Object obj)
-   {
-      if (obj == proxy)
-         return Boolean.TRUE;
-      if (obj == null)
-         return Boolean.FALSE;
-
-      Class[] intfs = proxy.getClass().getInterfaces();
-      if (intfs[0].isAssignableFrom(obj.getClass()) == false)
-      {
-         return Boolean.FALSE;
-      }
-      try
-      {
-         Proxy.getInvocationHandler(obj);
-      }
-      catch (Exception ex)
-      {
-         return Boolean.FALSE;
-      }
-      return Boolean.TRUE;
-   }
-
-   private Object doHashCode()
-   {
-      return new Integer(map.hashCode());
-   }
-
-   /**
-    * Create a proxy implementation for the annotation class.
-    * @param map - map of the annotation values
-    * @param annotation - the annotation class
-    * @return an instance implementing the annotation
-    * @throws Exception for any error
-    */
-   @SuppressWarnings("unchecked")
-   public static Object createProxy(Map map, Class<?> annotation) throws Exception
-   {
-      AnnotationProxy proxyHandler = new AnnotationProxy(annotation, map);
-      return java.lang.reflect.Proxy.newProxyInstance(annotation.getClassLoader(), new Class[]{annotation}, proxyHandler);
-   }
-}

Copied: projects/jboss-mdr/tags/2.0.1.GA/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java (from rev 80468, projects/jboss-mdr/branches/Branch_2_0/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java)
===================================================================
--- projects/jboss-mdr/tags/2.0.1.GA/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java	                        (rev 0)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/main/java/org/jboss/annotation/factory/AnnotationProxy.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -0,0 +1,179 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.annotation.factory;
+
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.Map;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.config.plugins.property.PropertyConfiguration;
+import org.jboss.config.spi.Configuration;
+import org.jboss.util.JBossObject;
+import org.jboss.util.Objects;
+
+/**
+ * InvocationHandler implementation for creating an annotation proxy.
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class AnnotationProxy implements InvocationHandler, Serializable
+{
+   private static final long serialVersionUID = 1;
+   private static Configuration configuration;
+
+   static
+   {
+      configuration = AccessController.doPrivileged(new PrivilegedAction<Configuration>()
+      {
+         public Configuration run()
+         {
+            return new PropertyConfiguration();
+         }
+      });
+   }
+
+   private Class<?> annotationType;
+   private transient BeanInfo beanInfo;
+   private Map<String, Object> map;
+
+   @SuppressWarnings("unchecked")
+   public AnnotationProxy(Class<?> annotationType, Map valueMap)
+   {
+      if (annotationType == null)
+         throw new IllegalArgumentException("Null annotation type.");
+      this.annotationType = annotationType;
+      this.map = valueMap != null ? valueMap : Collections.<String, Object>emptyMap();
+   }
+
+   /**
+    * Get bean info.
+    *
+    * @return the annotation's bean info
+    */
+   protected BeanInfo getBeanInfo()
+   {
+      if (beanInfo == null)
+         beanInfo = configuration.getBeanInfo(annotationType);
+
+      return beanInfo;
+   }
+
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      String name = method.getName();
+      if ("equals".equals(name))
+      {
+         return doEquals(proxy, args[0]);
+      }
+      else if ("hashCode".equals(name))
+      {
+         return doHashCode();
+      }
+      else if ("toString".equals(name))
+      {
+         return map.toString();
+      }
+      else if ("annotationType".equals(name))
+      {
+         return annotationType;
+      }
+      return map.get(name);
+   }
+
+   public Object getValue(String name)
+   {
+      return map.get(name);
+   }
+
+   @SuppressWarnings("unchecked")
+   private Object doEquals(Object proxy, Object obj)
+   {
+      if (obj == proxy)
+         return Boolean.TRUE;
+      if (obj == null)
+         return Boolean.FALSE;
+
+      if (annotationType.isInstance(obj) == false)
+      {
+         return Boolean.FALSE;
+      }
+
+      try
+      {
+         for (String key : map.keySet())
+         {
+            Object value = getValue(key);
+            Object other = getBeanInfo().getProperty(obj, key);
+            if (Objects.isArray(value))
+            {
+               if (Objects.isArray(other) == false)
+                  return Boolean.FALSE;
+
+               int length = Array.getLength(value);
+               if (length != Array.getLength(other))
+                  return Boolean.FALSE;
+
+               for (int i = 0; i < length; i++)
+               {
+                  if (JBossObject.equals(Array.get(value, i), Array.get(other, i)) == false)
+                     return Boolean.FALSE;
+               }
+            }
+            else if (JBossObject.equals(value, other) == false)
+               return Boolean.FALSE;
+         }
+      }
+      catch (Throwable t)
+      {
+         throw new UndeclaredThrowableException(t);
+      }
+
+      return Boolean.TRUE;
+   }
+
+   private Object doHashCode()
+   {
+      return map.hashCode();
+   }
+
+   /**
+    * Create a proxy implementation for the annotation class.
+    * @param map - map of the annotation values
+    * @param annotation - the annotation class
+    * @return an instance implementing the annotation
+    * @throws Exception for any error
+    */
+   public static Object createProxy(Map<String, Object> map, Class<?> annotation) throws Exception
+   {
+      AnnotationProxy proxyHandler = new AnnotationProxy(annotation, map);
+      return java.lang.reflect.Proxy.newProxyInstance(annotation.getClassLoader(), new Class[]{annotation}, proxyHandler);
+   }
+}

Deleted: projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/ContainerTest.java
===================================================================
--- projects/jboss-mdr/branches/Branch_2_0/src/test/java/org/jboss/test/ContainerTest.java	2008-10-07 08:03:30 UTC (rev 79178)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/ContainerTest.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -1,55 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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;
-
-/**
- * A ContainerTest.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 69888 $
- */
-public class ContainerTest extends AbstractTestCaseWithSetup
-{
-   /**
-    * Create a new ContainerTest.
-    * 
-    * @param name the test name
-    */
-   public ContainerTest(String name)
-   {
-      super(name);
-   }
-   
-   /**
-    * Default setup with security manager enabled
-    * 
-    * @param clazz the class
-    * @return the delegate
-    * @throws Exception for any error
-    */
-   public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
-   {
-      AbstractTestDelegate delegate = new AbstractTestDelegate(clazz);
-      //delegate.enableSecurity = true;
-      return delegate;
-   }
-}

Copied: projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/ContainerTest.java (from rev 80468, projects/jboss-mdr/branches/Branch_2_0/src/test/java/org/jboss/test/ContainerTest.java)
===================================================================
--- projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/ContainerTest.java	                        (rev 0)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/ContainerTest.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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;
+
+import java.lang.reflect.Array;
+
+import org.jboss.util.Objects;
+import org.jboss.util.JBossObject;
+
+/**
+ * A ContainerTest.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 69888 $
+ */
+public class ContainerTest extends AbstractTestCaseWithSetup
+{
+   /**
+    * Create a new ContainerTest.
+    *
+    * @param name the test name
+    */
+   public ContainerTest(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Default setup with security manager enabled
+    *
+    * @param clazz the class
+    * @return the delegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+   {
+      AbstractTestDelegate delegate = new AbstractTestDelegate(clazz);
+      //delegate.enableSecurity = true;
+      return delegate;
+   }
+
+   protected static void assertArrays(Object value, Object other)
+   {
+      assertTrue(Objects.equals(value, other));
+   }
+}

Deleted: projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Complex.java
===================================================================
--- projects/jboss-mdr/branches/Branch_2_0/src/test/java/org/jboss/test/annotation/factory/support/Complex.java	2008-10-07 08:03:30 UTC (rev 79178)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Complex.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -1,54 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.annotation.factory.support;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision$
- */
-public @interface Complex 
-{
-   char ch();
-
-   String string();
-
-   float flt();
-
-   double dbl();
-
-   short shrt();
-
-   long lng();
-
-   int integer();
-
-   boolean bool();
-
-   SimpleValue annotation();
-
-   String[] array();
-
-   Class<?> clazz();
-
-   MyEnum enumVal();
-}

Copied: projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Complex.java (from rev 80468, projects/jboss-mdr/branches/Branch_2_0/src/test/java/org/jboss/test/annotation/factory/support/Complex.java)
===================================================================
--- projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Complex.java	                        (rev 0)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Complex.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.annotation.factory.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public @interface Complex 
+{
+   char ch();
+
+   String string();
+
+   float flt();
+
+   double dbl();
+
+   short shrt();
+
+   long lng();
+
+   int integer();
+
+   boolean bool();
+
+   SimpleValue annotation();
+
+   String[] array();
+
+   Class<?> clazz();
+
+   MyEnum enumVal();
+
+   int[] primitiveArray();
+}

Copied: projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Name.java (from rev 80468, projects/jboss-mdr/branches/Branch_2_0/src/test/java/org/jboss/test/annotation/factory/support/Name.java)
===================================================================
--- projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Name.java	                        (rev 0)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/Name.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.annotation.factory.support;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface Name
+{
+   public String type() default "";
+   public String subtype() default "";
+}

Copied: projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/NameDefaults.java (from rev 80468, projects/jboss-mdr/branches/Branch_2_0/src/test/java/org/jboss/test/annotation/factory/support/NameDefaults.java)
===================================================================
--- projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/NameDefaults.java	                        (rev 0)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/NameDefaults.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.annotation.factory.support;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at Name(type="type", subtype="subtype")
+public class NameDefaults
+{
+   @Name(type="", subtype="")
+   public static class NAME_CLASS {}
+   @Name(type="", subtype="")
+   public static class NAME_CLASS2 {}
+   /** The ManagementComponent uninitialized default */
+   public static final Name COMP_TYPE = defaultNameType();
+   /**
+    * The unitialized/default ManagementComponent value
+    * @return The unitialized/default ManagementComponent value
+    */
+   public static synchronized Name defaultNameType()
+   {
+      Name name = NAME_CLASS.class.getAnnotation(Name.class);
+      return name;
+   }
+
+}

Copied: projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/NameImpl.java (from rev 80468, projects/jboss-mdr/branches/Branch_2_0/src/test/java/org/jboss/test/annotation/factory/support/NameImpl.java)
===================================================================
--- projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/NameImpl.java	                        (rev 0)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/support/NameImpl.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -0,0 +1,81 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.annotation.factory.support;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.util.JBossObject;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class NameImpl implements Name
+{
+   private String type = "";
+   private String subtype = "";
+
+   public NameImpl()
+   {
+   }
+
+   public NameImpl(String type, String subtype)
+   {
+      if (type != null)
+         this.type = type;
+      if (subtype != null)
+         this.subtype = subtype;
+   }
+
+   public String type()
+   {
+      return type;
+   }
+
+   public String subtype()
+   {
+      return subtype;
+   }
+
+   public Class<? extends Annotation> annotationType()
+   {
+      return Name.class;
+   }
+
+   public int hashCode()
+   {
+      return type.hashCode() + subtype.hashCode();
+   }
+
+   public boolean equals(Object obj)
+   {
+      if (obj instanceof Name == false)
+         return false;
+
+      Name name = (Name)obj;
+      return JBossObject.equals(type, name.type()) && JBossObject.equals(subtype, name.subtype());
+   }
+
+   public String toString()
+   {
+      return "@" + annotationType().getName() + "(type=" + type + ", subtype=" + subtype + ")";
+   }
+}

Deleted: projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.java
===================================================================
--- projects/jboss-mdr/branches/Branch_2_0/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.java	2008-10-07 08:03:30 UTC (rev 79178)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -1,158 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.annotation.factory.test;
-
-import java.lang.annotation.Annotation;
-import java.io.Serializable;
-
-import org.jboss.annotation.factory.AnnotationCreator;
-import org.jboss.annotation.factory.AnnotationValidationException;
-import org.jboss.test.ContainerTest;
-import org.jboss.test.annotation.factory.support.Complex;
-import org.jboss.test.annotation.factory.support.MyEnum;
-import org.jboss.test.annotation.factory.support.Simple;
-import org.jboss.test.annotation.factory.support.SimpleValue;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision$
- */
-public abstract class AnnotationCreatorTest extends ContainerTest
-{
-   public AnnotationCreatorTest(String name)
-   {
-      super(name);
-   }
-   
-   public void testSimple() throws Exception
-   {
-      String expr = "@org.jboss.test.annotation.factory.support.Simple";
-      Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, Simple.class);
-      assertEquals(Simple.class, annotation.annotationType());
-   }
-   
-   public void testSimpleValue() throws Exception
-   {
-      String expr = "@org.jboss.test.annotation.factory.support.SimpleValue(\"Test\")";
-      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, SimpleValue.class);
-      assertEquals(SimpleValue.class, annotation.annotationType());
-      assertEquals("Test", ((SimpleValue)annotation).value());
-   }
-   
-   public void testSimpleValueWithPropertyReplacement() throws Exception
-   {
-      String expr = "@org.jboss.test.annotation.factory.support.SimpleValue(\"${value1}\")";
-      System.setProperty("value1", "Test");
-      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, SimpleValue.class, true);
-      assertEquals(SimpleValue.class, annotation.annotationType());
-      assertEquals("Test", ((SimpleValue)annotation).value());
-   }
-   
-   public void testSimpleValueWithPropertyReplacementFromProperties() throws Exception
-   {
-      String expr = "@org.jboss.test.annotation.factory.support.SimpleValue(\"${value1}\")";
-      System.setProperty("value1", "Test");
-      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, SimpleValue.class, System.getProperties());
-      assertEquals(SimpleValue.class, annotation.annotationType());
-      assertEquals("Test", ((SimpleValue)annotation).value());
-   }
-
-   public void testComplex() throws Exception
-   {
-      String expr = "@org.jboss.test.annotation.factory.support.Complex(ch='a', string=\"Test123\", flt=9.9, dbl=123456789.99, shrt=1, lng=987654321, integer=123, bool=true, annotation=@org.jboss.test.annotation.factory.support.SimpleValue(\"Yes\"), array={\"Test\", \"123\"}, clazz=java.lang.Long.class, enumVal=org.jboss.test.annotation.factory.support.MyEnum.TWO)";      
-      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, Complex.class);
-      assertEquals(Complex.class, annotation.annotationType());
-      Complex complex = (Complex)annotation;
-      assertEquals('a', complex.ch());
-      assertEquals("Test123", complex.string());
-      assertEquals(9,9, complex.flt());
-      assertEquals(123456789.99, complex.dbl());
-      assertEquals(1, complex.shrt());
-      assertEquals(987654321, complex.lng());
-      assertEquals(123, complex.integer());
-      assertEquals(true, complex.bool());
-      assertEquals(Long.class, complex.clazz());
-      assertEquals("Yes", complex.annotation().value());
-      assertEquals(new String[]{"Test", "123"}, complex.array());
-      assertEquals(MyEnum.TWO, complex.enumVal());
-   }
-   
-   public void testComplexWithPropertyReplacement() throws Exception
-   {
-      String expr = "@org.jboss.test.annotation.factory.support.Complex(ch='${ch}', string=\"${string}\", flt=${flt}, dbl=${dbl}, shrt=${shrt}, " +
-      		"lng=${lng}, integer=${integer}, bool=${bool}, annotation=${annotation}, array=${array}, clazz=${clazz}, enumVal=${enumVal})";
-      
-      System.setProperty("ch", "a");
-      System.setProperty("string", "Test123");
-      System.setProperty("flt", "9.9");
-      System.setProperty("dbl", "123456789.99");
-      System.setProperty("shrt", "1");
-      System.setProperty("lng", "987654321");
-      System.setProperty("integer", "123");
-      System.setProperty("bool", "true");
-      System.setProperty("annotation", "@org.jboss.test.annotation.factory.support.SimpleValue(\"Yes\")");
-      System.setProperty("array", "{\"Test\", \"123\"}");
-      System.setProperty("clazz", "java.lang.Long.class");
-      System.setProperty("enumVal", "org.jboss.test.annotation.factory.support.MyEnum.TWO");
-      
-      
-      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, Complex.class, true);
-      assertEquals(Complex.class, annotation.annotationType());
-      Complex complex = (Complex)annotation;
-      assertEquals('a', complex.ch());
-      assertEquals("Test123", complex.string());
-      assertEquals(9,9, complex.flt());
-      assertEquals(123456789.99, complex.dbl());
-      assertEquals(1, complex.shrt());
-      assertEquals(987654321, complex.lng());
-      assertEquals(123, complex.integer());
-      assertEquals(true, complex.bool());
-      assertEquals(Long.class, complex.clazz());
-      assertEquals("Yes", complex.annotation().value());
-      assertEquals(new String[]{"Test", "123"}, complex.array());
-      assertEquals(MyEnum.TWO, complex.enumVal());
-   }
-
-   public void testSerializable() throws Exception
-   {
-      String expr = "@org.jboss.test.annotation.factory.support.Complex(ch='a', string=\"Test123\", flt=9.9, dbl=123456789.99, shrt=1, lng=987654321, integer=123, bool=true, annotation=@org.jboss.test.annotation.factory.support.SimpleValue(\"Yes\"), array={\"Test\", \"123\"}, clazz=java.lang.Long.class, enumVal=org.jboss.test.annotation.factory.support.MyEnum.TWO)";
-      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, Complex.class);
-      assertInstanceOf(annotation, Serializable.class);
-      byte[] bytes = serialize((Serializable)annotation);
-      Object desAnn = deserialize(bytes);
-      assertEquals(annotation, desAnn);
-   }
-
-   public void testMissingAttributeAndNoDefault() throws Exception
-   {
-      try
-      {
-         String expr = "@org.jboss.test.annotation.factory.support.SimpleValue";
-         AnnotationCreator.createAnnotation(expr, SimpleValue.class);
-         fail("Should have picked up on missing attribute");
-      }
-      catch (AnnotationValidationException expected)
-      {
-      }
-   }
-}

Copied: projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.java (from rev 80468, projects/jboss-mdr/branches/Branch_2_0/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.java)
===================================================================
--- projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.java	                        (rev 0)
+++ projects/jboss-mdr/tags/2.0.1.GA/src/test/java/org/jboss/test/annotation/factory/test/AnnotationCreatorTest.java	2008-11-04 10:51:28 UTC (rev 80470)
@@ -0,0 +1,198 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.annotation.factory.test;
+
+import java.lang.annotation.Annotation;
+import java.io.Serializable;
+
+import org.jboss.annotation.factory.AnnotationCreator;
+import org.jboss.annotation.factory.AnnotationValidationException;
+import org.jboss.test.ContainerTest;
+import org.jboss.test.annotation.factory.support.Complex;
+import org.jboss.test.annotation.factory.support.MyEnum;
+import org.jboss.test.annotation.factory.support.Name;
+import org.jboss.test.annotation.factory.support.NameDefaults;
+import org.jboss.test.annotation.factory.support.Simple;
+import org.jboss.test.annotation.factory.support.SimpleValue;
+import org.jboss.test.annotation.factory.support.NameImpl;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+
+public abstract class AnnotationCreatorTest extends ContainerTest
+{
+   public AnnotationCreatorTest(String name)
+   {
+      super(name);
+   }
+   
+   public void testSimple() throws Exception
+   {
+      String expr = "@org.jboss.test.annotation.factory.support.Simple";
+      Annotation annotation = (Annotation)AnnotationCreator.createAnnotation(expr, Simple.class);
+      assertEquals(Simple.class, annotation.annotationType());
+   }
+   
+   public void testSimpleValue() throws Exception
+   {
+      String expr = "@org.jboss.test.annotation.factory.support.SimpleValue(\"Test\")";
+      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, SimpleValue.class);
+      assertEquals(SimpleValue.class, annotation.annotationType());
+      assertEquals("Test", ((SimpleValue)annotation).value());
+   }
+   
+   public void testSimpleValueWithPropertyReplacement() throws Exception
+   {
+      String expr = "@org.jboss.test.annotation.factory.support.SimpleValue(\"${value1}\")";
+      System.setProperty("value1", "Test");
+      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, SimpleValue.class, true);
+      assertEquals(SimpleValue.class, annotation.annotationType());
+      assertEquals("Test", ((SimpleValue)annotation).value());
+   }
+   
+   public void testSimpleValueWithPropertyReplacementFromProperties() throws Exception
+   {
+      String expr = "@org.jboss.test.annotation.factory.support.SimpleValue(\"${value1}\")";
+      System.setProperty("value1", "Test");
+      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, SimpleValue.class, System.getProperties());
+      assertEquals(SimpleValue.class, annotation.annotationType());
+      assertEquals("Test", ((SimpleValue)annotation).value());
+   }
+
+   public void testComplex() throws Exception
+   {
+      String expr = "@org.jboss.test.annotation.factory.support.Complex(ch='a', string=\"Test123\", flt=9.9, dbl=123456789.99, shrt=1, lng=987654321, integer=123, bool=true, annotation=@org.jboss.test.annotation.factory.support.SimpleValue(\"Yes\"), array={\"Test\", \"123\"}, clazz=java.lang.Long.class, enumVal=org.jboss.test.annotation.factory.support.MyEnum.TWO, primitiveArray={1,2,3})";
+      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, Complex.class);
+      assertEquals(Complex.class, annotation.annotationType());
+      Complex complex = (Complex)annotation;
+      assertEquals('a', complex.ch());
+      assertEquals("Test123", complex.string());
+      assertEquals(9,9, complex.flt());
+      assertEquals(123456789.99, complex.dbl());
+      assertEquals(1, complex.shrt());
+      assertEquals(987654321, complex.lng());
+      assertEquals(123, complex.integer());
+      assertEquals(true, complex.bool());
+      assertEquals(Long.class, complex.clazz());
+      assertEquals("Yes", complex.annotation().value());
+      assertEquals(new String[]{"Test", "123"}, complex.array());
+      assertEquals(MyEnum.TWO, complex.enumVal());
+      assertArrays(new int[]{1, 2, 3}, complex.primitiveArray());
+   }
+   
+   public void testComplexWithPropertyReplacement() throws Exception
+   {
+      String expr = "@org.jboss.test.annotation.factory.support.Complex(ch='${ch}', string=\"${string}\", flt=${flt}, dbl=${dbl}, shrt=${shrt}, " +
+      		"lng=${lng}, integer=${integer}, bool=${bool}, annotation=${annotation}, array=${array}, clazz=${clazz}, enumVal=${enumVal}, primitiveArray=${primitiveArray})";
+      
+      System.setProperty("ch", "a");
+      System.setProperty("string", "Test123");
+      System.setProperty("flt", "9.9");
+      System.setProperty("dbl", "123456789.99");
+      System.setProperty("shrt", "1");
+      System.setProperty("lng", "987654321");
+      System.setProperty("integer", "123");
+      System.setProperty("bool", "true");
+      System.setProperty("annotation", "@org.jboss.test.annotation.factory.support.SimpleValue(\"Yes\")");
+      System.setProperty("array", "{\"Test\", \"123\"}");
+      System.setProperty("clazz", "java.lang.Long.class");
+      System.setProperty("enumVal", "org.jboss.test.annotation.factory.support.MyEnum.TWO");
+      System.setProperty("primitiveArray", "{1, 2, 3}");
+      
+      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, Complex.class, true);
+      assertEquals(Complex.class, annotation.annotationType());
+      Complex complex = (Complex)annotation;
+      assertEquals('a', complex.ch());
+      assertEquals("Test123", complex.string());
+      assertEquals(9,9, complex.flt());
+      assertEquals(123456789.99, complex.dbl());
+      assertEquals(1, complex.shrt());
+      assertEquals(987654321, complex.lng());
+      assertEquals(123, complex.integer());
+      assertEquals(true, complex.bool());
+      assertEquals(Long.class, complex.clazz());
+      assertEquals("Yes", complex.annotation().value());
+      assertEquals(new String[]{"Test", "123"}, complex.array());
+      assertEquals(MyEnum.TWO, complex.enumVal());
+      assertArrays(new int[]{1, 2, 3}, complex.primitiveArray());
+   }
+
+   public void testSerializable() throws Exception
+   {
+      String expr = "@org.jboss.test.annotation.factory.support.Complex(ch='a', string=\"Test123\", flt=9.9, dbl=123456789.99, shrt=1, lng=987654321, integer=123, bool=true, annotation=@org.jboss.test.annotation.factory.support.SimpleValue(\"Yes\"), array={\"Test\", \"123\"}, clazz=java.lang.Long.class, enumVal=org.jboss.test.annotation.factory.support.MyEnum.TWO, primitiveArray={1,2,3})";
+      Annotation annotation  = (Annotation)AnnotationCreator.createAnnotation(expr, Complex.class);
+      assertInstanceOf(annotation, Serializable.class);
+      byte[] bytes = serialize((Serializable)annotation);
+      Object desAnn = deserialize(bytes);
+      assertEquals(annotation, desAnn);
+   }
+
+   public void testMissingAttributeAndNoDefault() throws Exception
+   {
+      try
+      {
+         String expr = "@org.jboss.test.annotation.factory.support.SimpleValue";
+         AnnotationCreator.createAnnotation(expr, SimpleValue.class);
+         fail("Should have picked up on missing attribute");
+      }
+      catch (AnnotationValidationException expected)
+      {
+      }
+   }
+
+   public void testEquals()
+      throws Exception
+   {
+      String expr = "@"+Name.class.getName() + "(type=\"type\",subtype=\"subtype\")";
+      Name n0 = (Name) AnnotationCreator.createAnnotation(expr, Name.class);
+      getLog().debug("n0: "+n0);
+      Name n1 = NameDefaults.class.getAnnotation(Name.class);
+      getLog().debug("n1: "+n1);
+      assertEquals(n0, n1);
+      assertEquals(n1, n0);
+
+      Name defaultName = NameDefaults.defaultNameType();
+      getLog().debug("defaultName: "+defaultName);
+      // The jdk annotation should not equal the defaultName
+      assertFalse(n1+" != "+defaultName, n1.equals(defaultName));
+      assertFalse(defaultName+" != "+n1, defaultName.equals(n1));
+      // The AnnotationCreator annotation should not equal the defaultName
+      assertFalse(n0+" != "+defaultName, n0.equals(defaultName));
+      assertFalse(defaultName+" != "+n0, defaultName.equals(n0));
+
+      Name n2 = new NameImpl("type", "subtype");
+      getLog().debug("n2: " + n2);
+      assertEquals(n0, n2);
+      assertEquals(n2, n0);
+      assertEquals(n1, n2);
+      assertEquals(n2, n1);
+
+      Name n3 = new NameImpl();
+      assertFalse(n0  + "!=" +  n3, n0.equals(n3));
+      assertFalse(n3  + "!=" +  n0, n3.equals(n0));
+      assertFalse(n1  + "!=" +  n3, n1.equals(n3));
+      assertFalse(n3  + "!=" +  n1, n3.equals(n1));            
+   }
+}




More information about the jboss-cvs-commits mailing list