[jboss-cvs] JBossAS SVN: r92069 - projects/metadata/common/trunk/src/test/java/org/jboss/test/metadata/xml.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 6 11:28:47 EDT 2009


Author: alex.loubyansky at jboss.com
Date: 2009-08-06 11:28:47 -0400 (Thu, 06 Aug 2009)
New Revision: 92069

Modified:
   projects/metadata/common/trunk/src/test/java/org/jboss/test/metadata/xml/XmlValidationUnitTestCase.java
Log:
added xml validation tests to each metadata subproject

Modified: projects/metadata/common/trunk/src/test/java/org/jboss/test/metadata/xml/XmlValidationUnitTestCase.java
===================================================================
--- projects/metadata/common/trunk/src/test/java/org/jboss/test/metadata/xml/XmlValidationUnitTestCase.java	2009-08-06 15:15:02 UTC (rev 92068)
+++ projects/metadata/common/trunk/src/test/java/org/jboss/test/metadata/xml/XmlValidationUnitTestCase.java	2009-08-06 15:28:47 UTC (rev 92069)
@@ -71,20 +71,6 @@
       IGNORE.add("DescriptionGroup_testIconDefaultLanguage.xml");
       IGNORE.add("DescriptionGroup_testDisplayNameDefaultLanguage.xml");
       IGNORE.add("DescriptionGroup_testDescriptionDefaultLanguage.xml");
-      IGNORE.add("handler-chains.xml");
-      IGNORE.add("handler-chains2.xml");
-      // these don't include DTD info on purpose
-      IGNORE.add("JBoss42_testNoDoctype.xml");
-      IGNORE.add("Ear4x_testNoDtd.xml");
-      // here stub-property is expected to be a simple string!
-      IGNORE.add("JBossClient5_test4915.xml");
-      // dtd don't support prefix mapping (xmlns:prefix_name must declared attributes)
-      IGNORE.add("JBoss42_testServiceRefQnameWithNS.xml");
-      // xml with default namespace
-      IGNORE.add("RA15DefaultNS_testDefaultNS.xml");
-      IGNORE.add("RA16DefaultNS_testDefaultNS.xml");
-      IGNORE.add("JbossRA10DefaultNS_testBasic.xml");
-
    }
    
    private static final EntityResolver RESOLVER = new JBossEntityResolver()
@@ -101,9 +87,53 @@
       }
    };
    
+   private Set<String> excluded;
    private int total;
    private int invalid;
+
+   /**
+    * Excludes xml file from validation
+    * 
+    * @param xmlName  xml file name w/o the path part
+    */
+   protected void exclude(String xmlName)
+   {
+      if(excluded == null)
+         throw new IllegalStateException("The excluded set has not been initialized (it's done in setUp())");
+      excluded.add(xmlName);
+   }
    
+   /**
+    * Includes previously excluded xml file into the set of files to be validated
+    * 
+    * @param xmlName  xml file name w/o the path part
+    */
+   protected void include(String xmlName)
+   {
+      if(excluded == null)
+         throw new IllegalStateException("The excluded set has not been initialized (it's done in setUp())");
+      excluded.remove(xmlName);
+   }
+
+   /**
+    * Checks whether the specified file excluded from validation
+    * 
+    * @param xmlName  xml file name w/o the path part
+    * @return true if the file is excluded
+    */
+   protected boolean isExcluded(String xmlName)
+   {
+      if(excluded == null)
+         throw new IllegalStateException("The excluded set has not been initialized (it's done in setUp())");
+      return excluded.contains(xmlName);      
+   }
+   
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      excluded = new HashSet<String>(IGNORE);
+   }
+   
    public void testValidation() throws Exception
    {
       String resourcesPath = System.getProperty("user.dir") + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar + "resources";
@@ -122,7 +152,7 @@
                pathname.listFiles(this);
             
             if(pathname.getName().endsWith(".xml") && 
-               !IGNORE.contains(pathname.getName()) &&
+               !excluded.contains(pathname.getName()) &&
                pathname.getName().indexOf("Negative_testParser") <=0) //*Negative_testParser*.xml should not be well validated
             {
                names.add(pathname.getName());




More information about the jboss-cvs-commits mailing list