[jboss-svn-commits] JBL Code SVN: r22465 - in labs/jbossesb/workspace/skeagh: routing/jms/src/main/java/org/jboss/esb/jms and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Sep 6 06:08:26 EDT 2008


Author: beve
Date: 2008-09-06 06:08:25 -0400 (Sat, 06 Sep 2008)
New Revision: 22465

Added:
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedTestPropertiesResource.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedTestPropertiesResource2.java
Modified:
   labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/annotations/Properties.java
   labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java
   labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/jms-inbound-router_01.xml
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/SetProperty.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedResource.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/digest/SetPropertyTest.java
Log:
Updates to Annotations.


Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/annotations/Properties.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/annotations/Properties.java	2008-09-06 09:10:49 UTC (rev 22464)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/annotations/Properties.java	2008-09-06 10:08:25 UTC (rev 22465)
@@ -29,51 +29,30 @@
 /**
  * Configuration paramater field annotation.
  * <p/>
+ * This annotation can be uses to cause all properties that
+ * exist in a configuration to be added to a specified Properties instance.
+ * Any field in a class that does not have a {@link Property} annotation
+ * specified will be added to the Properties instance.
  *
  * <h3>Usage</h3>
- * Where the paramater name is the same as the field name:
  * <pre>{@code
- *     @Property(decoder={@link org.milyn.javabean.decoders.IntegerDecoder}.class)
- *     private int maxDigits;
+ *     @Properties
+ *     private String properties;
  * </pre>}
- * Where the paramater name is NOT the same as the field name:
- * <pre>{@code
- *     @Property(name="max-digits", decoder={@link org.milyn.javabean.decoders.IntegerDecoder}.class)
- *     private int maxDigits;
- * </pre>}
  *
- * @author <a href="mailto:tom.fennelly at gmail.com">tom.fennelly at gmail.com</a>
+ *@author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
 @Target({ ElementType.FIELD })
 public @interface Properties
 {
-
     /**
-     * The paramater name as defined in the resource configuration. If not
-     * defined, the name defaults to the name of the field.
-     */
-    String name() default AnnotationConstants.NULL_STRING;
-
-    /**
      * Paramater required or optional. <p/> Defaults to required.
      */
     Use use() default Use.REQUIRED;
 
     /**
-     * The default paramater value. <p/> Only relevant when use=OPTIONAL and the
-     * paramater is not defined on the configuration..
-     */
-    String defaultVal() default AnnotationConstants.UNASSIGNED;
-
-    /**
-     * Paramater choice values.
-     *
-     */
-    String[] choice() default AnnotationConstants.NULL_STRING;
-
-    /**
      * Configuration paramater use.
      */
     public static enum Use

Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java	2008-09-06 09:10:49 UTC (rev 22464)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java	2008-09-06 10:08:25 UTC (rev 22465)
@@ -62,17 +62,12 @@
     private String destination;
 
     /**
-     * default jms properties.
+     * JMS properties.
      */
     @org.jboss.esb.annotations.Properties
     private final Properties jmsProperties = getDefaultProperties();
 
     /**
-     * Optional properties.
-     */
-    private Properties properties;
-
-    /**
      * Initializes this instance.
      */
     @Initialize
@@ -80,14 +75,7 @@
     {
         // this will be handled by the annotation constraint later
         AssertArgument.isNotNullAndNotEmpty(destination, "destination");
-
-        if (properties != null)
-        {
-            // add/overwrite properties from the configuration
-            jmsProperties.putAll(properties);
-        }
         log.info("JMSProperties : " + jmsProperties);
-
         // add this class as a JMS message listener...
     }
 
@@ -139,7 +127,7 @@
     @Override
     public final String toString()
     {
-        return "[dispatcher=" + dispatcher + ", properties=" + properties + "]";
+        return "[dispatcher=" + dispatcher + ", jmsProperties=" + jmsProperties + "]";
     }
 
     /**

Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/jms-inbound-router_01.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/jms-inbound-router_01.xml	2008-09-06 09:10:49 UTC (rev 22464)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/jms-inbound-router_01.xml	2008-09-06 10:08:25 UTC (rev 22465)
@@ -9,7 +9,7 @@
             </inRouter>
             
             <inRouter name="noproperties" class="org.jboss.esb.jms.JmsInboundRouter">
-                <property name="destination">queue/A</property>
+                <property name="jmsDestination">queue/A</property>
             </inRouter>
             
         </inRouters>

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/SetProperty.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/SetProperty.java	2008-09-06 09:10:49 UTC (rev 22464)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/SetProperty.java	2008-09-06 10:08:25 UTC (rev 22465)
@@ -19,6 +19,12 @@
  */
 package org.jboss.esb.deploy.config.digest;
 
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.esb.annotations.AnnotationConstants;
 import org.jboss.esb.annotations.Property;
 import org.jboss.esb.classpath.ClassUtil;
 import org.milyn.SmooksException;
@@ -30,10 +36,6 @@
 import org.milyn.xml.DomUtils;
 import org.w3c.dom.Element;
 
-import java.lang.reflect.Field;
-import java.util.Map;
-import java.util.Properties;
-
 /**
  * Set the value of a property  of a bean (from the Smooks bean repository).
  *
@@ -84,12 +86,14 @@
         if (instance instanceof Map)
         {
             ((Map) instance).put(propertyName, value);
-        } else
+        }
+        else
         {
             try
             {
                 attemptAnnotationFieldSet(objectClass, instance, propertyName, value);
-            } catch (final IllegalAccessException e)
+            }
+            catch (final IllegalAccessException e)
             {
                 throw new SmooksException("Property '" + propertyName + "' unknown on class '" + objectClass + "' (or super class).", e);
             }
@@ -101,34 +105,37 @@
      *
      * @param clazz         Class object on which the field should be set. Needed to be able to find superclasses.
      * @param instance      the instance that contains the field to be set
-     * @param propertyName  the name of the configuration property
+     * @param configPropertyName  the name of the configuration property
      * @param value         the value to set the field to
      * @return true         if the field was set, otherwise false.
      *
      * @throws IllegalAccessException if the field was not accessible.
      */
-    final boolean attemptAnnotationFieldSet(final Class<?> clazz, final Object instance, final String propertyName, final String value) throws IllegalAccessException
+    final boolean attemptAnnotationFieldSet(final Class<?> clazz, final Object instance, final String configPropertyName, final String value) throws IllegalAccessException
     {
         boolean fieldSet = false;
-        Field[] fields = clazz.getDeclaredFields();
-        for (Field field : fields)
+
+        for (Field field : clazz.getDeclaredFields())
         {
-           Property propertyAnnotation = field.getAnnotation(Property.class);
-           if (propertyAnnotation != null)
+           Property propertyAnno = field.getAnnotation(Property.class);
+           org.jboss.esb.annotations.Properties propertiesAnno = field.getAnnotation(org.jboss.esb.annotations.Properties.class);
+
+           if (propertyAnno != null)
            {
-               if (propertyAnnotation.name().equals(propertyName) || field.getName().equals(propertyName))
+               final String fieldName = AnnotationConstants.NULL_STRING.equals(propertyAnno.name()) ? field.getName() : propertyAnno.name();
+
+               if (fieldName.equals(configPropertyName))
                {
-                   setPropertyValue(field, instance, value);
+                   assertValidChoice(propertyAnno.choice(), configPropertyName, value);
+                   setPropertyValue(field, instance, (value == null ? propertyAnno.defaultVal() : value));
                    fieldSet = true;
+                   break;
                }
            }
-           else
+           else if (propertiesAnno != null)
            {
-               org.jboss.esb.annotations.Properties properties = field.getAnnotation(org.jboss.esb.annotations.Properties.class);
-               if (properties != null)
-               {
-                   fieldSet = attemptPropertiesFieldSet(instance, field, propertyName, value);
-               }
+               fieldSet = attemptPropertiesFieldSet(instance, field, configPropertyName, value);
+               break;
            }
         }
 
@@ -137,14 +144,47 @@
             Class<?> superclass = instance.getClass().getSuperclass();
             if (superclass != null && !superclass.getName().equals(Object.class.getName()))
             {
-                fieldSet = attemptAnnotationFieldSet(superclass, instance, propertyName, value);
+                fieldSet = attemptAnnotationFieldSet(superclass, instance, configPropertyName, value);
             }
         }
 
         return fieldSet;
     }
 
+    /**
+     * Verifies that the passed in paramValue if a valid choice.
+     *
+     * @param choices       the choices available
+     * @param name          the name of the paramter
+     * @param paramValue    the property value
+     */
+    private void assertValidChoice(final String[] choices, final String name, final String paramValue)
+    {
+        if (choices == null || choices.length == 0)
+        {
+            throw new RuntimeException("Unexpected annotation default choice value.  Should not be null or empty.  Code may have changed incompatibly.");
+        }
+        else if (choices.length == 1 && AnnotationConstants.NULL_STRING.equals(choices[0]))
+        {
+            // A choice wasn't specified on the paramater config.
+            return;
+        }
+        else
+        {
+            // A choice was specified. Check it against the value...
+            for (String choice : choices)
+            {
+                if (paramValue.equals(choice))
+                {
+                    return;
+                }
+            }
+        }
 
+        throw new SmooksException("Value '" + paramValue + "' for paramater '" + name + "' is invalid.  Valid choices for this paramater are: " + Arrays.asList(choices));
+    }
+
+
     /**
      * Set property value.
      *

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedResource.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedResource.java	2008-09-06 09:10:49 UTC (rev 22464)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedResource.java	2008-09-06 10:08:25 UTC (rev 22465)
@@ -19,8 +19,6 @@
  */
 package org.jboss.esb.deploy.config;
 
-import java.util.Properties;
-
 import org.jboss.esb.annotations.Property;
 import org.jboss.esb.annotations.Property.Use;
 
@@ -41,19 +39,9 @@
 
     private String password;
 
-    @org.jboss.esb.annotations.Properties
-    private Properties props;
+    @Property ( choice = { "Http", "JMS" })
+    private String transport;
 
-    public Properties getProps()
-    {
-        return props;
-    }
-
-    public String getPassword()
-    {
-        return password;
-    }
-
     @Property ( use = Use.OPTIONAL, defaultVal = "John Doe" )
     private int age;
 
@@ -62,6 +50,9 @@
 
     private String org;
 
+    @Property ( defaultVal = "11" )
+    private String id;
+
     public String getOrganization()
     {
         return org;
@@ -92,4 +83,19 @@
         return lastName;
     }
 
+    public String getTransport()
+    {
+        return transport;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
 }

Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedTestPropertiesResource.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedTestPropertiesResource.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedTestPropertiesResource.java	2008-09-06 10:08:25 UTC (rev 22465)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.deploy.config;
+
+import java.util.Properties;
+
+import org.jboss.esb.annotations.Property;
+import org.jboss.esb.annotations.Property.Use;
+
+/**
+ * Simple pojo which uses properties annotations.
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class AnnotatedTestPropertiesResource
+{
+    @Property ( use = Use.REQUIRED, name = "userName" )
+    private String name;
+
+    @org.jboss.esb.annotations.Properties
+    private Properties props;
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public Properties getProps()
+    {
+        return props;
+    }
+
+}

Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedTestPropertiesResource2.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedTestPropertiesResource2.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/AnnotatedTestPropertiesResource2.java	2008-09-06 10:08:25 UTC (rev 22465)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.deploy.config;
+
+import java.util.Properties;
+
+import org.jboss.esb.annotations.Property;
+import org.jboss.esb.annotations.Property.Use;
+
+/**
+ * Simple pojo which uses properties annotations.
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public class AnnotatedTestPropertiesResource2
+{
+    @Property ( use = Use.REQUIRED, name = "userName" )
+    private String name;
+
+    @org.jboss.esb.annotations.Properties
+    private Properties properties;
+
+    public Properties getProperties()
+    {
+        return properties;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+}

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/digest/SetPropertyTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/digest/SetPropertyTest.java	2008-09-06 09:10:49 UTC (rev 22464)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/digest/SetPropertyTest.java	2008-09-06 10:08:25 UTC (rev 22465)
@@ -25,7 +25,10 @@
 import static org.junit.Assert.assertTrue;
 
 import org.jboss.esb.deploy.config.AnnotatedResource;
+import org.jboss.esb.deploy.config.AnnotatedTestPropertiesResource;
+import org.jboss.esb.deploy.config.AnnotatedTestPropertiesResource2;
 import org.junit.Test;
+import org.milyn.SmooksException;
 
 /**
  * Test for {@link SetProperty}.
@@ -36,45 +39,99 @@
 public class SetPropertyTest
 {
     private final SetProperty setProperty = new SetProperty();
-    private final AnnotatedResource annotatedResource = new AnnotatedResource();
 
     @Test
     public void attemptAnnotationFieldSet() throws IllegalAccessException
     {
+        final AnnotatedResource annotatedResource = new AnnotatedResource();
         final String expectedName = "Fletcher";
-        boolean fieldSet = setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "lastName", expectedName);
-        assertTrue( fieldSet );
+        setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "lastName", expectedName);
         assertEquals( expectedName, annotatedResource.getLastName());
     }
 
     @Test
     public void attemptAnnotationFieldSetNameSpecified() throws IllegalAccessException
     {
+        final AnnotatedResource annotatedResource = new AnnotatedResource();
         final String expectedName = "Dr.Rosen";
-        boolean fieldSet = setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "userName", expectedName);
-        assertTrue( fieldSet );
+        setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "userName", expectedName);
         assertEquals( expectedName, annotatedResource.getName() );
     }
 
     @Test
     public void attemptAnnotationFieldSetNotAnnotated() throws IllegalAccessException
     {
+        final AnnotatedResource annotatedResource = new AnnotatedResource();
         setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "password", "secret");
-        assertNull( annotatedResource.getName() );
+        assertNull("password is not annotated and should not have been set", annotatedResource.getPassword() );
     }
 
     @Test
     public void attemptAnnotationFieldSetProperties() throws IllegalAccessException
     {
-        final String expectedPropValue1 = "value1";
-        final String expectedPropValue2 = "value2";
-        boolean fieldSet = setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "prop1", expectedPropValue1);
-        assertTrue( fieldSet );
-        assertTrue( annotatedResource.getProps().size() == 1 );
+        final AnnotatedTestPropertiesResource pojo = new AnnotatedTestPropertiesResource();
+        final String propKey1 = "key1";
+        final String propKey2 = "key2";
+        final String propValue1 = "value1";
+        final String propValue2 = "value2";
+        final String expectedName = "Dr.Rosen";
 
-        fieldSet = setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "prop2", expectedPropValue2);
-        assertTrue( annotatedResource.getProps().size() == 2 );
-        System.out.println(annotatedResource.getProps());
+        setProperty.attemptAnnotationFieldSet(pojo.getClass(), pojo , "userName", expectedName);
+        setProperty.attemptAnnotationFieldSet(pojo.getClass(), pojo , propKey1, propValue1);
+        setProperty.attemptAnnotationFieldSet(pojo.getClass(), pojo , propKey2, propValue2);
+
+        assertTrue(pojo.getProps().size() == 2 );
+        assertTrue("Properties did not contain key: " + propKey1, pojo.getProps().containsKey(propKey1));
+        assertTrue("Properties did not contain key: " + propKey2, pojo.getProps().containsKey(propKey2));
+        assertEquals(pojo.getProps().get(propKey1), propValue1);
+        assertEquals(pojo.getProps().get(propKey2), propValue2);
+        assertEquals(expectedName, pojo.getName());
     }
 
+    @Test
+    public void attemptAnnotationFieldSetProperties2() throws IllegalAccessException
+    {
+        final AnnotatedTestPropertiesResource2 pojo = new AnnotatedTestPropertiesResource2();
+        final String propKey1 = "key1";
+        final String propKey2 = "key2";
+        final String propValue1 = "value1";
+        final String propValue2 = "value2";
+        final String expectedName = "Dr.Rosen";
+
+        setProperty.attemptAnnotationFieldSet(pojo.getClass(), pojo , "userName", expectedName);
+        setProperty.attemptAnnotationFieldSet(pojo.getClass(), pojo , propKey1, propValue1);
+        setProperty.attemptAnnotationFieldSet(pojo.getClass(), pojo , propKey2, propValue2);
+
+        assertTrue(pojo.getProperties().size() == 2 );
+        assertTrue("Properties did not contain key: " + propKey1, pojo.getProperties().containsKey(propKey1));
+        assertTrue("Properties did not contain key: " + propKey2, pojo.getProperties().containsKey(propKey2));
+        assertEquals(pojo.getProperties().get(propKey1), propValue1);
+        assertEquals(pojo.getProperties().get(propKey2), propValue2);
+        assertEquals(expectedName, pojo.getName());
+    }
+
+    @Test
+    public void attemptAnnotationFieldSetWithChoice() throws IllegalAccessException
+    {
+        final AnnotatedResource annotatedResource = new AnnotatedResource();
+        final String httpTransport = "Http";
+        setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "transport", httpTransport);
+        assertEquals(httpTransport, annotatedResource.getTransport());
+    }
+
+    @Test ( expected = SmooksException.class )
+    public void attemptAnnotationFieldSetWithInvalidChoice() throws IllegalAccessException
+    {
+        final AnnotatedResource annotatedResource = new AnnotatedResource();
+        setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "transport", "InvalidTransport");
+    }
+
+    @Test
+    public void attemptAnnotationFieldSetWithDefaultValue() throws IllegalAccessException
+    {
+        final AnnotatedResource annotatedResource = new AnnotatedResource();
+        setProperty.attemptAnnotationFieldSet(annotatedResource.getClass(), annotatedResource , "id", null);
+        assertEquals("Id was not equals to 'defaultVal' specified on annotation", "11", annotatedResource.getId() );
+    }
+
 }




More information about the jboss-svn-commits mailing list