[jboss-cvs] JBossCache/src/org/jboss/cache/factories ...

Manik Surtani msurtani at jboss.com
Thu Jan 11 07:07:29 EST 2007


  User: msurtani
  Date: 07/01/11 07:07:29

  Modified:    src/org/jboss/cache/factories  UnitTestCacheFactory.java
  Log:
  Force node construction thru factory
  
  Revision  Changes    Path
  1.5       +76 -79    JBossCache/src/org/jboss/cache/factories/UnitTestCacheFactory.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UnitTestCacheFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/factories/UnitTestCacheFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- UnitTestCacheFactory.java	5 Jan 2007 03:45:05 -0000	1.4
  +++ UnitTestCacheFactory.java	11 Jan 2007 12:07:29 -0000	1.5
  @@ -6,27 +6,24 @@
    */
   package org.jboss.cache.factories;
   
  -import java.io.InputStream;
  -
   import org.jboss.cache.Cache;
   import org.jboss.cache.CacheImpl;
   import org.jboss.cache.config.CacheLoaderConfig;
   import org.jboss.cache.config.Configuration;
  -import org.jboss.cache.config.ConfigurationException;
  -import org.jboss.cache.config.EvictionConfig;
   import org.jboss.cache.config.Configuration.CacheMode;
  +import org.jboss.cache.config.ConfigurationException;
   import org.jboss.cache.xml.XmlHelper;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
  +import java.io.InputStream;
  +
   /**
    * Cache factory used by unit tests. 
  - *
  - * 
    */
   public class UnitTestCacheFactory
   {
  -   public static String JGROUPS_CHANNEL = "udp"; //use udp by default
  +   public static String JGROUPS_CHANNEL = "udp";//use udp by default
      public static String JGROUPS_STACK_TYPE = "jgroups.stack";
      public static String DEFAULT_CONFIGURATION_FILE = "META-INF/unit-test-cache-service.xml";   
      
  @@ -59,14 +56,14 @@
      public static Configuration createConfiguration(CacheMode mode, boolean useEviction, boolean usePassivation) throws ConfigurationException
      {
         UnitTestXmlConfigurationParser parser = new UnitTestXmlConfigurationParser();
  -      Configuration c = parser.parseFile(DEFAULT_CONFIGURATION_FILE,mode);
  +      Configuration c = parser.parseFile(DEFAULT_CONFIGURATION_FILE, mode);
         
  -      if(!useEviction)
  +      if (!useEviction)
         {
            c.setEvictionConfig(null);
         }
         
  -      if(!usePassivation)
  +      if (!usePassivation)
         {
            c.setCacheLoaderConfig(null);
         }
  @@ -128,16 +125,16 @@
     
         public Configuration parseFile(String filename, CacheMode mode)
         {         
  -         return parseStream(getAsInputStreamFromClassLoader(DEFAULT_CONFIGURATION_FILE),mode);         
  +         return parseStream(getAsInputStreamFromClassLoader(DEFAULT_CONFIGURATION_FILE), mode);
         }
         
  -      public Configuration parseStream(InputStream stream,CacheMode mode)
  +      public Configuration parseStream(InputStream stream, CacheMode mode)
         {
             // loop through all elements in XML.
             if (stream == null) throw new ConfigurationException("Input stream for configuration xml is null!");
   
  -          Element root= XmlHelper.getDocumentRoot(stream);
  -          Element mbeanElement= getMBeanElement(root);
  +         Element root = XmlHelper.getDocumentRoot(stream);
  +         Element mbeanElement = getMBeanElement(root);
   
             ParsedAttributes attributes = extractAttributes(mbeanElement);
             
  @@ -167,7 +164,7 @@
                if (stackName.startsWith(JGROUPS_CHANNEL))
                {
                   Element jgroupsStack = (Element) stack.getElementsByTagName("config").item(0);
  -                if(mode == CacheMode.REPL_ASYNC && !stackName.contains("-"))
  +               if (mode == CacheMode.REPL_ASYNC && !stackName.contains("-"))
                   {                   
                      c.setClusterConfig(jgroupsStack);
                      c.setCacheMode(CacheMode.REPL_ASYNC);
  
  
  



More information about the jboss-cvs-commits mailing list