[jboss-svn-commits] JBoss Common SVN: r2746 - in jbossxb/trunk/src: main/java/org/jboss/xb/builder/runtime and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Mar 19 08:52:40 EDT 2008


Author: alesj
Date: 2008-03-19 08:52:39 -0400 (Wed, 19 Mar 2008)
New Revision: 2746

Added:
   jbossxb/trunk/src/main/java/org/jboss/xb/annotations/JBossXmlEnum.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/Root.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/WrongKeyEnum.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/matchcase/
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/matchcase/Root.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/FailIgnoreCaseTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCaseUnitTestCase.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCaseUnitTestCase.java
   jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCase.xml
   jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCase.xml
Modified:
   jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/EnumValueAdapter.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/ObjectTypeXmlEnumTestSuite.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/AbstractDefaultsTest.java
Log:
Ignore case enum handling.

Added: jbossxb/trunk/src/main/java/org/jboss/xb/annotations/JBossXmlEnum.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/annotations/JBossXmlEnum.java	                        (rev 0)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/annotations/JBossXmlEnum.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -0,0 +1,39 @@
+/*
+* 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.xb.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * JBoss enum extension.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Target(ElementType.TYPE)
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface JBossXmlEnum
+{
+   boolean ignoreCase();
+}

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/EnumValueAdapter.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/EnumValueAdapter.java	2008-03-18 14:08:32 UTC (rev 2745)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/builder/runtime/EnumValueAdapter.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -31,6 +31,7 @@
 import org.jboss.reflect.spi.EnumInfo;
 import org.jboss.reflect.spi.TypeInfo;
 import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter;
+import org.jboss.xb.annotations.JBossXmlEnum;
 
 /**
  * EnumValueAdapter.
@@ -45,7 +46,10 @@
    
    /** The valid values */
    private Map<Object, Object> valid;
-   
+
+   /** The jboss enum extension */
+   private JBossXmlEnum jBossXmlEnum;
+
    /**
     * Create a new EnumValueAdapter.
     * 
@@ -62,7 +66,8 @@
          throw new IllegalArgumentException("Null enumType");
       
       this.qName = qName;
-      
+      this.jBossXmlEnum = enumInfo.getUnderlyingAnnotation(JBossXmlEnum.class);
+
       // Setup the mapping
       EnumConstantInfo[] constants = enumInfo.getEnumConstants();
       valid = new HashMap<Object, Object>(constants.length);
@@ -73,7 +78,7 @@
          if (xmlEnumValue != null)
             enumValue = xmlEnumValue.value();
          
-         Object key = enumValue;
+         Object key;
          try
          {
             key = enumType.convertValue(enumValue, false);
@@ -82,12 +87,29 @@
          {
             throw new RuntimeException("Error for enum " + enumInfo.getName() + " unable to convert " + enumValue + " to " + enumType.getName());
          }
+         if (isCaseIgnored())
+         {
+            if (key instanceof String == false)
+               throw new IllegalArgumentException("Cannot ignore case on non string key: " + enumInfo);
+
+            key = key.toString().toUpperCase();
+         }
          Object value = constant.getValue();
          valid.put(key, value);
       }
    }
-   
+
    /**
+    * Check if we should ignore case.
+    *
+    * @return true if case should be ignored, false otherwise
+    */
+   protected boolean isCaseIgnored()
+   {
+      return jBossXmlEnum != null && jBossXmlEnum.ignoreCase();
+   }
+
+   /**
     * Get the mapping
     * 
     * @return the mapping
@@ -102,8 +124,12 @@
    {
       if (o == null)
          return null;
+
+      Object key = o;
+      if (isCaseIgnored())
+         key = key.toString().toUpperCase();
       
-      Object result = valid.get(o);
+      Object result = valid.get(key);
       if (result == null)
       {
          if (qName == null)

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/ObjectTypeXmlEnumTestSuite.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/ObjectTypeXmlEnumTestSuite.java	2008-03-18 14:08:32 UTC (rev 2745)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/ObjectTypeXmlEnumTestSuite.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -31,6 +31,9 @@
 import org.jboss.test.xb.builder.object.type.xmlenum.test.EnumNotSimpleUnitTestCase;
 import org.jboss.test.xb.builder.object.type.xmlenum.test.NonDefaultsUnitTestCase;
 import org.jboss.test.xb.builder.object.type.xmlenum.test.NoneUnitTestCase;
+import org.jboss.test.xb.builder.object.type.xmlenum.test.IgnoreCaseUnitTestCase;
+import org.jboss.test.xb.builder.object.type.xmlenum.test.FailIgnoreCaseTestCase;
+import org.jboss.test.xb.builder.object.type.xmlenum.test.MatchCaseUnitTestCase;
 
 /**
  * ObjectTypeXmlAnyElementTestSuite.
@@ -55,7 +58,10 @@
       suite.addTest(EnumGlobalTypeUnitTestCase.suite());
       suite.addTest(EnumNotSimpleUnitTestCase.suite());
       suite.addTest(EnumConstantUnconvertableUnitTestCase.suite());
-      
+      suite.addTest(IgnoreCaseUnitTestCase.suite());
+      suite.addTest(FailIgnoreCaseTestCase.suite());
+      suite.addTest(MatchCaseUnitTestCase.suite());
+
       return suite;
    }
 }

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/Root.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/Root.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/Root.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -0,0 +1,35 @@
+/*
+* 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.xb.builder.object.type.xmlenum.support.ignorecase;
+
+import org.jboss.xb.annotations.JBossXmlEnum;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at JBossXmlEnum(ignoreCase=true)
+public enum Root
+{
+   ONE,
+   TWO,
+   THREE
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/WrongKeyEnum.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/WrongKeyEnum.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/WrongKeyEnum.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -0,0 +1,54 @@
+/*
+* 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.xb.builder.object.type.xmlenum.support.ignorecase;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+
+import org.jboss.xb.annotations.JBossXmlEnum;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at JBossXmlEnum(ignoreCase=true)
+ at XmlEnum(Integer.class)
+public enum WrongKeyEnum
+{
+   @XmlEnumValue("1")
+   ONE(1),
+   @XmlEnumValue("2")
+   TWO(2),
+   @XmlEnumValue("3")
+   THREE(3);
+
+   private int number;
+
+   WrongKeyEnum(int number)
+   {
+      this.number = number;
+   }
+
+   public int getNumber()
+   {
+      return number;
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/matchcase/Root.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/matchcase/Root.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/matchcase/Root.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -0,0 +1,35 @@
+/*
+* 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.xb.builder.object.type.xmlenum.support.matchcase;
+
+import org.jboss.xb.annotations.JBossXmlEnum;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at JBossXmlEnum(ignoreCase=false)
+public enum Root
+{
+   ONE,
+   TWO,
+   THREE
+}

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/AbstractDefaultsTest.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/AbstractDefaultsTest.java	2008-03-18 14:08:32 UTC (rev 2745)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/AbstractDefaultsTest.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -89,8 +89,11 @@
       ValueAdapter valueAdapter = typeBinding.getValueAdapter();
       assertNotNull(valueAdapter);
       assertTrue(valueAdapter instanceof EnumValueAdapter);
-      EnumValueAdapter enumValueAdapter = (EnumValueAdapter) valueAdapter;
-      
+      testEnumValueAdapter((EnumValueAdapter)valueAdapter);
+   }
+
+   protected void testEnumValueAdapter(EnumValueAdapter enumValueAdapter)
+   {
       Map<Object, Object> actual = enumValueAdapter.getMapping();
       assertEquals(expected, actual);
    }

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/FailIgnoreCaseTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/FailIgnoreCaseTestCase.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/FailIgnoreCaseTestCase.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -0,0 +1,44 @@
+/*
+* 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.xb.builder.object.type.xmlenum.test;
+
+import junit.framework.Test;
+import org.jboss.test.xb.builder.object.AbstractErrorTest;
+import org.jboss.test.xb.builder.object.type.xmlenum.support.ignorecase.WrongKeyEnum;
+
+/**
+ * Fail ignore test case enum.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class FailIgnoreCaseTestCase extends AbstractErrorTest<RuntimeException>
+{
+   public FailIgnoreCaseTestCase(String name)
+   {
+      super(name, WrongKeyEnum.class, RuntimeException.class);
+   }
+
+   public static Test suite()
+   {
+      return suite(FailIgnoreCaseTestCase.class);
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCaseUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCaseUnitTestCase.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCaseUnitTestCase.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -0,0 +1,61 @@
+/*
+* 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.xb.builder.object.type.xmlenum.test;
+
+import junit.framework.Test;
+import org.jboss.test.xb.builder.object.type.xmlenum.support.ignorecase.Root;
+import org.jboss.xb.builder.runtime.EnumValueAdapter;
+
+/**
+ * Ignore test case enum.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class IgnoreCaseUnitTestCase extends AbstractDefaultsTest<Root>
+{
+   public IgnoreCaseUnitTestCase(String name)
+   {
+      super(name, Root.class);
+   }
+
+   public static Test suite()
+   {
+      return suite(IgnoreCaseUnitTestCase.class);
+   }
+
+   protected void testEnumValueAdapter(EnumValueAdapter enumValueAdapter)
+   {
+      super.testEnumValueAdapter(enumValueAdapter);
+
+      assertEquals(Root.ONE, enumValueAdapter.cast("one", Root.class));
+      assertEquals(Root.ONE, enumValueAdapter.cast("One", Root.class));
+      assertEquals(Root.ONE, enumValueAdapter.cast("ONE", Root.class));
+
+      assertEquals(Root.TWO, enumValueAdapter.cast("two", Root.class));
+      assertEquals(Root.TWO, enumValueAdapter.cast("Two", Root.class));
+      assertEquals(Root.TWO, enumValueAdapter.cast("TWO", Root.class));
+
+      assertEquals(Root.THREE, enumValueAdapter.cast("three", Root.class));
+      assertEquals(Root.THREE, enumValueAdapter.cast("Three", Root.class));
+      assertEquals(Root.THREE, enumValueAdapter.cast("THREE", Root.class));      
+   }
+}

Added: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCaseUnitTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCaseUnitTestCase.java	                        (rev 0)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCaseUnitTestCase.java	2008-03-19 12:52:39 UTC (rev 2746)
@@ -0,0 +1,74 @@
+/*
+* 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.xb.builder.object.type.xmlenum.test;
+
+import org.jboss.test.xb.builder.object.type.xmlenum.support.matchcase.Root;
+import org.jboss.xb.builder.runtime.EnumValueAdapter;
+import junit.framework.Test;
+
+/**
+ * Match case test case enum.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class MatchCaseUnitTestCase extends AbstractDefaultsTest<Root>
+{
+   public MatchCaseUnitTestCase(String name)
+   {
+      super(name, Root.class);
+   }
+
+   public static Test suite()
+   {
+      return suite(MatchCaseUnitTestCase.class);
+   }
+
+   protected void fail(EnumValueAdapter enumValueAdapter, String key)
+   {
+      try
+      {
+         enumValueAdapter.cast(key, Root.class);
+         fail("Should not be here.");
+      }
+      catch(Exception e)
+      {
+         assertInstanceOf(e, RuntimeException.class);
+      }
+   }
+
+   protected void testEnumValueAdapter(EnumValueAdapter enumValueAdapter)
+   {
+      super.testEnumValueAdapter(enumValueAdapter);
+
+      fail(enumValueAdapter, "one");
+      fail(enumValueAdapter, "One");
+      assertEquals(Root.ONE, enumValueAdapter.cast("ONE", Root.class));
+
+      fail(enumValueAdapter, "two");
+      fail(enumValueAdapter, "Two");
+      assertEquals(Root.TWO, enumValueAdapter.cast("TWO", Root.class));
+
+      fail(enumValueAdapter, "three");
+      fail(enumValueAdapter, "Three");
+      assertEquals(Root.THREE, enumValueAdapter.cast("THREE", Root.class));
+   }
+}

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCase.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCase.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCase.xml	2008-03-19 12:52:39 UTC (rev 2746)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root>One</root>

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCase.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCase.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCase.xml	2008-03-19 12:52:39 UTC (rev 2746)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root>ONE</root>




More information about the jboss-svn-commits mailing list