[jbosscache-commits] JBoss Cache SVN: r6570 - in core/trunk/src/test/java/org/jboss/cache: config/parsing and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Sun Aug 17 12:52:43 EDT 2008


Author: mircea.markus
Date: 2008-08-17 12:52:43 -0400 (Sun, 17 Aug 2008)
New Revision: 6570

Added:
   core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java
Removed:
   core/trunk/src/test/java/org/jboss/cache/SampleConfigFilesCorrectnessTest.java
Log:
moved to parsing directory

Deleted: core/trunk/src/test/java/org/jboss/cache/SampleConfigFilesCorrectnessTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/SampleConfigFilesCorrectnessTest.java	2008-08-17 16:31:21 UTC (rev 6569)
+++ core/trunk/src/test/java/org/jboss/cache/SampleConfigFilesCorrectnessTest.java	2008-08-17 16:52:43 UTC (rev 6570)
@@ -1,162 +0,0 @@
-/*
- * 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.cache;
-
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.AfterTest;
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.spi.LoggingEvent;
-import org.jboss.cache.config.parsing.XmlConfigurationSchemaTest;
-import org.jboss.cache.config.parsing.XmlConfigurationParser;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-/**
- * The purpose of this test is to make sure that the config files we ship are correct both according to xml schema and
- * according to the used JGroups/JBossCache version. For the latter, we start a cache instance and make sure that no
- * configuration warnings are being logged by both JGroups and JBossCache.
- *
- * @author Mircea.Markus at jboss.com
- * @since 3.0
- */
- at Test(groups = "functional")
-public class SampleConfigFilesCorrectnessTest
-{
-   public static final String CONFIG_ROOT = "src/main/resources/config-samples";
-   public static final String XSD_FILE = "src/main/resources/jbosscache-config-3.0.xsd";
-
-   private InMemoryAppender appender;
-   private Level oldLevel;
-
-
-   /**
-    * Will be called only once, before all test methods run.
-    */
-   @BeforeTest
-   public void setUpTest()
-   {
-      Logger log4jLogger = Logger.getRootLogger();
-      oldLevel = log4jLogger.getLevel();
-      log4jLogger.setLevel(Level.WARN);
-      appender = new InMemoryAppender();
-      log4jLogger.addAppender(appender);
-      File f = new File(".");
-      System.out.println("f = " + f.getAbsolutePath());
-   }
-
-   /**
-    * Will be called only once, after all test methods run.
-    */
-   @AfterTest
-   public void tearDownTest()
-   {
-      Logger log4jLogger = Logger.getRootLogger();
-      log4jLogger.setLevel(oldLevel);
-      log4jLogger.removeAppender(appender);
-   }
-
-   public void testSchemaValidity()
-   {
-      System.setProperty("jbosscache.config.schemaLocation", XSD_FILE);
-      XmlConfigurationSchemaTest.ExceptionCountingErrorHandler errorHandler = new XmlConfigurationSchemaTest.ExceptionCountingErrorHandler();
-      XmlConfigurationParser parser = new XmlConfigurationParser(errorHandler);
-      String[] configFiles = getConfigFileNames();
-      for (String aConfFile : configFiles)
-      {
-         System.out.println("Processing file: " + aConfFile);
-         parser.parseFile(CONFIG_ROOT + "/" + aConfFile);
-      }
-      assert errorHandler.noErrors();
-   }
-
-   public void testConfigWarnings()
-   {
-      DefaultCacheFactory dcf = new DefaultCacheFactory();
-      for (String aConfFile : getConfigFileNames())
-      {
-         System.out.println("Processing file: " + aConfFile);
-         assert !appender.isFoundUnknownWarning();
-         Cache cache = dcf.createCache(CONFIG_ROOT + "/" + aConfFile);
-         cache.stop();
-         assert !appender.isFoundUnknownWarning();
-      }
-   }
-
-   private String[] getConfigFileNames()
-   {
-      File file = new File(CONFIG_ROOT);
-      return file.list(new FilenameFilter()
-      {
-         public boolean accept(File dir, String name)
-         {
-            return name.indexOf("xml") > 0;
-         }
-      });
-   }
-
-
-   private static class InMemoryAppender extends AppenderSkeleton
-   {
-      String[] TOLERABLE_WARNINGS = {"Falling back to DummyTransactionManager"};
-      boolean foundUnknownWarning = false;
-
-      protected void append(LoggingEvent event)
-      {
-         if (event.getLevel().equals(Level.WARN))
-         {
-            boolean skipPrinting = false;
-            foundUnknownWarning = true;
-            for (String knownWarn : TOLERABLE_WARNINGS)
-            {
-               if (event.getMessage().toString().indexOf(knownWarn) >= 0)
-               {
-                  skipPrinting = true;
-                  foundUnknownWarning = false;
-               }
-            }
-            if (!skipPrinting)
-            {
-               System.out.println("Unaccepted warn message :" + event.getMessage());
-            }
-         }
-      }
-
-      public boolean requiresLayout()
-      {
-         return false;
-      }
-
-      public void close()
-      {
-         //do nothing
-      }
-
-      public boolean isFoundUnknownWarning()
-      {
-         return foundUnknownWarning;
-      }
-   }
-}

Copied: core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java (from rev 6567, core/trunk/src/test/java/org/jboss/cache/SampleConfigFilesCorrectnessTest.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java	                        (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/SampleConfigFilesCorrectnessTest.java	2008-08-17 16:52:43 UTC (rev 6570)
@@ -0,0 +1,164 @@
+/*
+ * 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.cache.config.parsing;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.AfterTest;
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.spi.LoggingEvent;
+import org.jboss.cache.config.parsing.XmlConfigurationSchemaTest;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Cache;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+/**
+ * The purpose of this test is to make sure that the config files we ship are correct both according to xml schema and
+ * according to the used JGroups/JBossCache version. For the latter, we start a cache instance and make sure that no
+ * configuration warnings are being logged by both JGroups and JBossCache.
+ *
+ * @author Mircea.Markus at jboss.com
+ * @since 3.0
+ */
+ at Test(groups = "functional")
+public class SampleConfigFilesCorrectnessTest
+{
+   public static final String CONFIG_ROOT = "src/main/resources/config-samples";
+   public static final String XSD_FILE = "src/main/resources/jbosscache-config-3.0.xsd";
+
+   private InMemoryAppender appender;
+   private Level oldLevel;
+
+
+   /**
+    * Will be called only once, before all test methods run.
+    */
+   @BeforeTest
+   public void setUpTest()
+   {
+      Logger log4jLogger = Logger.getRootLogger();
+      oldLevel = log4jLogger.getLevel();
+      log4jLogger.setLevel(Level.WARN);
+      appender = new InMemoryAppender();
+      log4jLogger.addAppender(appender);
+      File f = new File(".");
+      System.out.println("f = " + f.getAbsolutePath());
+   }
+
+   /**
+    * Will be called only once, after all test methods run.
+    */
+   @AfterTest
+   public void tearDownTest()
+   {
+      Logger log4jLogger = Logger.getRootLogger();
+      log4jLogger.setLevel(oldLevel);
+      log4jLogger.removeAppender(appender);
+   }
+
+   public void testSchemaValidity()
+   {
+      System.setProperty("jbosscache.config.schemaLocation", XSD_FILE);
+      XmlConfigurationSchemaTest.ExceptionCountingErrorHandler errorHandler = new XmlConfigurationSchemaTest.ExceptionCountingErrorHandler();
+      XmlConfigurationParser parser = new XmlConfigurationParser(errorHandler);
+      String[] configFiles = getConfigFileNames();
+      for (String aConfFile : configFiles)
+      {
+         System.out.println("Processing file: " + aConfFile);
+         parser.parseFile(CONFIG_ROOT + "/" + aConfFile);
+      }
+      assert errorHandler.noErrors();
+   }
+
+   public void testConfigWarnings()
+   {
+      DefaultCacheFactory dcf = new DefaultCacheFactory();
+      for (String aConfFile : getConfigFileNames())
+      {
+         System.out.println("Processing file: " + aConfFile);
+         assert !appender.isFoundUnknownWarning();
+         Cache cache = dcf.createCache(CONFIG_ROOT + "/" + aConfFile);
+         cache.stop();
+         assert !appender.isFoundUnknownWarning();
+      }
+   }
+
+   private String[] getConfigFileNames()
+   {
+      File file = new File(CONFIG_ROOT);
+      return file.list(new FilenameFilter()
+      {
+         public boolean accept(File dir, String name)
+         {
+            return name.indexOf("xml") > 0;
+         }
+      });
+   }
+
+
+   private static class InMemoryAppender extends AppenderSkeleton
+   {
+      String[] TOLERABLE_WARNINGS = {"Falling back to DummyTransactionManager"};
+      boolean foundUnknownWarning = false;
+
+      protected void append(LoggingEvent event)
+      {
+         if (event.getLevel().equals(Level.WARN))
+         {
+            boolean skipPrinting = false;
+            foundUnknownWarning = true;
+            for (String knownWarn : TOLERABLE_WARNINGS)
+            {
+               if (event.getMessage().toString().indexOf(knownWarn) >= 0)
+               {
+                  skipPrinting = true;
+                  foundUnknownWarning = false;
+               }
+            }
+            if (!skipPrinting)
+            {
+               System.out.println("Unaccepted warn message :" + event.getMessage());
+            }
+         }
+      }
+
+      public boolean requiresLayout()
+      {
+         return false;
+      }
+
+      public void close()
+      {
+         //do nothing
+      }
+
+      public boolean isFoundUnknownWarning()
+      {
+         return foundUnknownWarning;
+      }
+   }
+}




More information about the jbosscache-commits mailing list