[jboss-cvs] JBossAS SVN: r110726 - in projects/jboss-jca/trunk/validator/src: main/java/org/jboss/jca/validator/rules/ao and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 21 11:42:56 EST 2011


Author: jesper.pedersen
Date: 2011-02-21 11:42:56 -0500 (Mon, 21 Feb 2011)
New Revision: 110726

Added:
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AONull.java
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASNull.java
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFNull.java
Modified:
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AORAA.java
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFNull.java
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCF.java
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFEquals.java
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFHashCode.java
   projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RANull.java
   projects/jboss-jca/trunk/validator/src/main/resources/validator.properties
   projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/validator/rules/ra/RATestCase.java
Log:
[JBJCA-501] Add null checks for all instances

Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -39,13 +39,19 @@
    /** Clazz */
    private Class<?> clazz;
 
+   /** The class name */
+   private String className;
+
+   /** The class loader */
+   private ClassLoader cl;
+
    /**
     * Constructor
     * @param key The key
     * @param clazz The class
     */
    public ValidateClass(Key key,
-                         Class<?> clazz)
+                        Class<?> clazz)
    {
       this(key, clazz, null);
    }
@@ -57,12 +63,14 @@
     * @param configProperties The list of config property metadata
     */
    public ValidateClass(Key key,
-                         Class<?> clazz,
-                         List<? extends ConfigProperty> configProperties)
+                        Class<?> clazz,
+                        List<? extends ConfigProperty> configProperties)
    {
       this.key = key;
       this.clazz = clazz;
       this.configProperties = configProperties;
+      this.className = null;
+      this.cl = null;
    }
 
    /**
@@ -78,10 +86,14 @@
       try
       {
          this.clazz = Class.forName(className, true, cl);
+         this.className = null;
+         this.cl = null;
       }
       catch (Exception cne)
       {
          this.clazz = null;
+         this.className = className;
+         this.cl = cl;
       }
       this.configProperties = configProperties;
    }
@@ -112,4 +124,26 @@
    {
       return configProperties;
    }
+
+   /**
+    * Get the class name.
+    *
+    * This property is set if a class can't be resolved
+    * @return The value
+    */
+   public String getClassName()
+   {
+      return className;
+   }
+
+   /**
+    * Get the class loader.
+    *
+    * This property is set if a class can't be resolved
+    * @return The value
+    */
+   public ClassLoader getClassLoader()
+   {
+      return cl;
+   }
 }

Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -40,6 +40,7 @@
     * properties file
     */
    private static final String[] CLASS_RULES = {
+      "org.jboss.jca.validator.rules.mcf.MCFNull",
       "org.jboss.jca.validator.rules.mcf.MCF",
       "org.jboss.jca.validator.rules.mcf.MCFConstructor",
       "org.jboss.jca.validator.rules.mcf.MCFHashCode",
@@ -57,9 +58,11 @@
       "org.jboss.jca.validator.rules.cf.CFNull",
       "org.jboss.jca.validator.rules.cf.CFSerializable",
       "org.jboss.jca.validator.rules.cf.CFReferenceable",
+      "org.jboss.jca.validator.rules.as.ASNull",
       "org.jboss.jca.validator.rules.as.AS",
       "org.jboss.jca.validator.rules.as.ASConstructor",
       "org.jboss.jca.validator.rules.as.ASConfigProperties",
+      "org.jboss.jca.validator.rules.ao.AONull",
       "org.jboss.jca.validator.rules.ao.AOConstructor",
       "org.jboss.jca.validator.rules.ao.AOConfigProperties",
       "org.jboss.jca.validator.rules.ao.AORAA"

Added: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AONull.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AONull.java	                        (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AONull.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jca.validator.rules.ao;
+
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+/**
+ * An AdminObject must be a non-null instance
+ * 
+ * @author 
+ */
+public class AONull implements Rule
+{
+   /** Section */
+   private static final String SECTION = "19.3";
+
+   /**
+    * Constructor
+    */
+   public AONull()
+   {
+   }
+   
+   /**
+    * Validate
+    * @param vo The validate object
+    * @param rb The resource bundle 
+    * @return The list of failures found; <code>null</code> if none
+    */
+   @SuppressWarnings("unchecked")
+   public List<Failure> validate(Validate vo, ResourceBundle rb)
+   {
+      if (vo != null && Key.ADMIN_OBJECT == vo.getKey())
+      {
+         if (vo.getClazz() == null)
+         {
+            ValidateClass vc = (ValidateClass)vo;
+
+            List<Failure> failures = new ArrayList<Failure>(1);
+            Failure failure = null;
+
+            String code = null;
+            if (vc.getClassName() != null)
+            {
+               code = vc.getClassName().equals("") ? "<empty>" : vc.getClassName() +
+                  " (" + vc.getClassLoader().toString() + ")";
+            }
+
+            if (code != null)
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("ao.AONull"));
+            }
+            else
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("ao.AONull"));
+            }
+
+            failures.add(failure);
+
+            return failures;
+         }
+      }
+
+      return null;
+   }
+}

Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AORAA.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AORAA.java	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AORAA.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -62,8 +62,9 @@
    public List<Failure> validate(Validate vo, ResourceBundle rb)
    {
       if (vo != null && 
-         Key.ADMIN_OBJECT == vo.getKey() &&
-         ResourceAdapterAssociation.class.isAssignableFrom(vo.getClazz()))
+          Key.ADMIN_OBJECT == vo.getKey() &&
+          vo.getClazz() != null &&
+          ResourceAdapterAssociation.class.isAssignableFrom(vo.getClazz()))
       {
          if (!Referenceable.class.isAssignableFrom(vo.getClazz()) ||
             !Serializable.class.isAssignableFrom(vo.getClazz()))

Added: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASNull.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASNull.java	                        (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASNull.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jca.validator.rules.as;
+
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+import javax.resource.spi.ActivationSpec;;
+
+/**
+ * An ActivationSpec class must be non-null
+ */
+public class ASNull implements Rule
+{
+   /** Section */
+   private static final String SECTION = "13.4.2.2";
+
+   /**
+    * Constructor
+    */
+   public ASNull()
+   {
+   }
+
+   /**
+    * Validate
+    * @param vo The validate object
+    * @param rb The resource bundle 
+    * @return The list of failures found; <code>null</code> if none
+    */
+   @SuppressWarnings("unchecked")
+   public List<Failure> validate(Validate vo, ResourceBundle rb)
+   {
+      if (vo != null && Key.ACTIVATION_SPEC == vo.getKey())
+      {
+         if (vo.getClazz() == null)
+         {
+            ValidateClass vc = (ValidateClass)vo;
+
+            List<Failure> failures = new ArrayList<Failure>(1);
+            Failure failure = null;
+
+            String code = null;
+            if (vc.getClassName() != null)
+            {
+               code = vc.getClassName().equals("") ? "<empty>" : vc.getClassName() +
+                  " (" + vc.getClassLoader().toString() + ")";
+            }
+
+            if (code != null)
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("as.ASNull"),
+                                     code);
+            }
+            else
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("as.ASNull"));
+            }
+
+            failures.add(failure);
+
+            return failures;
+         }
+      }
+
+      return null;
+   }
+}
+

Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFNull.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFNull.java	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFNull.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -27,6 +27,7 @@
 import org.jboss.jca.validator.Rule;
 import org.jboss.jca.validator.Severity;
 import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -60,11 +61,32 @@
       {
          if (vo.getClazz() == null)
          {
+            ValidateClass vc = (ValidateClass)vo;
+
             List<Failure> failures = new ArrayList<Failure>(1);
+            Failure failure = null;
 
-            Failure failure = new Failure(Severity.ERROR,
-                                          SECTION,
-                                          rb.getString("cf.CFNull"));
+            String code = null;
+            if (vc.getClassName() != null)
+            {
+               code = vc.getClassName().equals("") ? "<empty>" : vc.getClassName() +
+                  " (" + vc.getClassLoader().toString() + ")";
+            }
+
+            if (code != null)
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("cf.CFNull"),
+                                     code);
+            }
+            else
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("cf.CFNull"));
+            }
+
             failures.add(failure);
 
             return failures;

Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCF.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCF.java	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCF.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -60,17 +60,20 @@
    {
       if (vo != null && Key.MANAGED_CONNECTION_FACTORY == vo.getKey())
       {
-         if (!ManagedConnectionFactory.class.isAssignableFrom(vo.getClazz()))
+         if (vo.getClazz() != null)
          {
-            List<Failure> failures = new ArrayList<Failure>(1);
+            if (!ManagedConnectionFactory.class.isAssignableFrom(vo.getClazz()))
+            {
+               List<Failure> failures = new ArrayList<Failure>(1);
 
-            Failure failure = new Failure(Severity.ERROR,
-                                          SECTION,
-                                          rb.getString("mcf.MCF"),
-                                          vo.getClazz().getName());
-            failures.add(failure);
+               Failure failure = new Failure(Severity.ERROR,
+                                             SECTION,
+                                             rb.getString("mcf.MCF"),
+                                             vo.getClazz().getName());
+               failures.add(failure);
 
-            return failures;
+               return failures;
+            }
          }
       }
 

Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFEquals.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFEquals.java	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFEquals.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -61,6 +61,7 @@
    {
       if (vo != null && 
           Key.MANAGED_CONNECTION_FACTORY == vo.getKey() &&
+          vo.getClazz() != null &&
           ManagedConnectionFactory.class.isAssignableFrom(vo.getClazz()))
       {
          boolean error = true;

Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFHashCode.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFHashCode.java	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFHashCode.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -61,6 +61,7 @@
    {
       if (vo != null && 
           Key.MANAGED_CONNECTION_FACTORY == vo.getKey() &&
+          vo.getClazz() != null &&
           ManagedConnectionFactory.class.isAssignableFrom(vo.getClazz()))
       {
          boolean error = true;

Added: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFNull.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFNull.java	                        (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFNull.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jca.validator.rules.mcf;
+
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+/**
+ * ManagedConnectionFactory must be implemented if present
+ */
+public class MCFNull implements Rule
+{
+   /** Section */
+   private static final String SECTION = "6.5.3.2";
+
+   /**
+    * Constructor
+    */
+   public MCFNull()
+   {
+   }
+
+   /**
+    * Validate
+    * @param vo The validate object
+    * @param rb The resource bundle 
+    * @return The list of failures found; <code>null</code> if none
+    */
+   @SuppressWarnings("unchecked")
+   public List<Failure> validate(Validate vo, ResourceBundle rb)
+   {
+      if (vo != null && Key.MANAGED_CONNECTION_FACTORY == vo.getKey())
+      {
+         if (vo.getClazz() == null)
+         {
+            ValidateClass vc = (ValidateClass)vo;
+
+            List<Failure> failures = new ArrayList<Failure>(1);
+            Failure failure = null;
+
+            String code = null;
+            if (vc.getClassName() != null)
+            {
+               code = vc.getClassName().equals("") ? "<empty>" : vc.getClassName() +
+                  " (" + vc.getClassLoader().toString() + ")";
+            }
+
+            if (code != null)
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("mcf.MCFNull"),
+                                     code);
+            }
+            else
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("mcf.MCFNull"));
+            }
+
+            failures.add(failure);
+
+            return failures;
+         }
+      }
+
+      return null;
+   }
+}

Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RANull.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RANull.java	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RANull.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -27,6 +27,7 @@
 import org.jboss.jca.validator.Rule;
 import org.jboss.jca.validator.Severity;
 import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -60,11 +61,32 @@
       {
          if (vo.getClazz() == null)
          {
+            ValidateClass vc = (ValidateClass)vo;
+
             List<Failure> failures = new ArrayList<Failure>(1);
+            Failure failure = null;
 
-            Failure failure = new Failure(Severity.ERROR,
-                                          SECTION,
-                                          rb.getString("ra.RANull"));
+            String code = null;
+            if (vc.getClassName() != null)
+            {
+               code = vc.getClassName().equals("") ? "<empty>" : vc.getClassName() +
+                  " (" + vc.getClassLoader().toString() + ")";
+            }
+
+            if (code != null)
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("ra.RANull"),
+                                     code);
+            }
+            else
+            {
+               failure = new Failure(Severity.ERROR,
+                                     SECTION,
+                                     rb.getString("ra.RANull"));
+            }
+
             failures.add(failure);
 
             return failures;

Modified: projects/jboss-jca/trunk/validator/src/main/resources/validator.properties
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/resources/validator.properties	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/main/resources/validator.properties	2011-02-21 16:42:56 UTC (rev 110726)
@@ -5,30 +5,33 @@
 description=Description
 code=Code
 uncategorized=Uncategorized
-mcf.cnfe=ClassNotFoundException during ManagedConnectionFactory creation
+ao.AONull=An AdminObject must be a non-null instance.
+ao.AOConfigProperties=Invalid config-property-type for AdminObject.
+ao.AOConstructor=An AdminObject must have a default constructor
+ao.AORAA=An AdminObject must implement javax.resource.Referenceable and java.io.Serializable interfaces if javax.resource.spi.ResourceAdapterAssociation is implemented Code
+ao.cnfe=ClassNotFoundException during AdminObject creation
+as.AS=An ActivationSpec class must implement the ActivationSpec interface
+as.ASNull=An ActivationSpec must be a non-null instance.
+as.ASConfigProperties=Invalid config-property-type for ActivationSpec.
+as.ASConstructor=An ActivationSpec must have a default constructor
+as.cnfe=ClassNotFoundException during ActivationSpec creation
+cf.CFConstructor=A ConnectionFactory must have a default constructor 
+cf.CFNull=ConnectionFactory must be a non-null value
+cf.CFReferenceable=ConnectionFactory must implement javax.resource.Referenceable
+cf.CFSerializable=ConnectionFactory must implement java.io.Serializable
+mc.MC=The class must provide an implementation of the ManagedConnection interface.
+mc.MCGetMetaData=ManagedConnection.getMetaData() must return a javax.resource.spi.ManagedConnectionMetaData instance
 mcf.MCF=The class must implement the javax.resource.spi.ManagedConnectionFactory interface.
 mcf.MCFConfigProperties=Invalid config-property-type for ManagedConnectionFactory.
 mcf.MCFConstructor=A ManagedConnectionFactory must have a default constructor
 mcf.MCFEquals=A ManagedConnectionFactory must implement a "public boolean equals(Object)" method.
 mcf.MCFHashCode=A ManagedConnectionFactory must implement a "public int hashCode()" method.
-mc.MC=The class must provide an implementation of the ManagedConnection interface.
-mc.MCGetMetaData=ManagedConnection.getMetaData() must return a javax.resource.spi.ManagedConnectionMetaData instance
-ra.cnfe=ClassNotFoundException during ResourceAdapter creation
+mcf.MCFNull=A ManagedConnectionFactory must be a non-null instance.
+mcf.cnfe=ClassNotFoundException during ManagedConnectionFactory creation
 ra.RA=A ResourceAdapter must implement the javax.resource.spi.ResourceAdapter interface.
 ra.RAConfigProperties=Invalid config-property-type for ResourceAdapter.
 ra.RAConstructor=A ResourceAdapter must have a default constructor
 ra.RAEquals=A ResourceAdapter must implement a "public boolean equals(Object)" method.
 ra.RAHashCode=A ResourceAdapter must implement a "public int hashCode()" method.
 ra.RANull=A ResourceAdapter must be a non-null instance.
-cf.CFConstructor=A ConnectionFactory must have a default constructor 
-cf.CFNull=ConnectionFactory must be a non-null value
-cf.CFSerializable=ConnectionFactory must implement java.io.Serializable
-cf.CFReferenceable=ConnectionFactory must implement javax.resource.Referenceable
-as.cnfe=ClassNotFoundException during ActivationSpec creation
-as.AS=An ActivationSpec class must implement the ActivationSpec interface
-as.ASConstructor=An ActivationSpec must have a default constructor
-as.ASConfigProperties=Invalid config-property-type for ActivationSpec.
-ao.cnfe=ClassNotFoundException during AdminObject creation
-ao.AOConstructor=An AdminObject must have a default constructor
-ao.AOConfigProperties=Invalid config-property-type for AdminObject.
-ao.AORAA=An AdminObject must implement javax.resource.Referenceable and java.io.Serializable interfaces if javax.resource.spi.ResourceAdapterAssociation is implemented Code
+ra.cnfe=ClassNotFoundException during ResourceAdapter creation

Modified: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/validator/rules/ra/RATestCase.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/validator/rules/ra/RATestCase.java	2011-02-21 14:32:36 UTC (rev 110725)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/validator/rules/ra/RATestCase.java	2011-02-21 16:42:56 UTC (rev 110726)
@@ -39,6 +39,7 @@
 import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.IsEqual.equalTo;
 import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 import static org.junit.matchers.JUnitMatchers.hasItem;
@@ -187,11 +188,17 @@
             throw de;
          }
 
-         final Failure failureRA =
-               new Failure(Severity.ERROR, "5.3.1", "A ResourceAdapter must be a non-null instance.", null);
          assertThat(dve.getFailures(), notNullValue());
-         assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
          assertThat(dve.getFailures().size(), is(1));
+
+         final Failure checkRA =
+               new Failure(Severity.ERROR, "5.3.1", "A ResourceAdapter must be a non-null instance.", null);
+
+         Failure failureRA = dve.getFailures().iterator().next();
+
+         assertEquals(checkRA.getSeverity(), failureRA.getSeverity());
+         assertEquals(checkRA.getSection(), failureRA.getSection());
+         assertEquals(checkRA.getDescription(), failureRA.getDescription());
          //success
          throw dve;
       }



More information about the jboss-cvs-commits mailing list