[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/loader ...

Galder Zamarreno galder.zamarreno at jboss.com
Thu Nov 16 12:24:46 EST 2006


  User: gzamarreno
  Date: 06/11/16 12:24:46

  Modified:    tests/functional/org/jboss/cache/loader 
                        FileCacheLoaderTest.java
  Log:
  [JBCACHE-644] - When creating an FCL root location, check for any non portable characters throwing a warning. Checks '*' '<' '>' '|' '"' '?' 
  When storing attributes, check that the Fqn tree does not contain non portable characters. Checks '*' '<' '>' '|' '"' '?' and also '\' '/' and ':'
  When storing attributes as well, check for entire path that could be bigger than 255 characters throwing a warning.
  
  Revision  Changes    Path
  1.11      +63 -0     JBossCache/tests/functional/org/jboss/cache/loader/FileCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FileCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/FileCacheLoaderTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- FileCacheLoaderTest.java	25 Oct 2006 04:50:19 -0000	1.10
  +++ FileCacheLoaderTest.java	16 Nov 2006 17:24:46 -0000	1.11
  @@ -2,6 +2,7 @@
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  +import org.jboss.cache.Fqn;
   
   /**
    * Created by IntelliJ IDEA.
  @@ -17,6 +18,68 @@
         cache.getConfiguration().setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.FileCacheLoader", "", false, true, false));
      }
   
  +   public void testIsCharacterPortableLocation()
  +   {
  +      FileCacheLoader fcl = new FileCacheLoader();
  +
  +      Object[][] data = new Object[][] {
  +            {"C:\\here\\there.txt", true},
  +            {"/home/here/there", true},
  +            {"/home/*/jboss", false},
  +            {"C:\\>/jgroups/jboss", false},
  +            {"/cache/jboss<", false},
  +            {"/pojocache|/galder", false},
  +            {"/pojocache/gal\"der", false}};
  +
  +      for (int i=0; i < data.length; i++)
  +      {
  +         String path = (String)data[i][0];
  +         boolean expected = (Boolean)data[i][1];
  +         assertEquals(path, expected, fcl.isCharacterPortableLocation(path));
  +      }
  +   }
  +
  +   public void testIsCharacterPortableTree()
  +   {
  +      FileCacheLoader fcl = new FileCacheLoader();
  +
  +      Object[][] data = new Object[][] {
  +            {Fqn.fromString("/a/b/c/d/e"), true},
  +            {Fqn.fromString("/a/*/c/d/e"), false},
  +            {Fqn.fromString("/a/b/>/d/e"), false},
  +            {Fqn.fromString("/a/</c/d/e"), false},
  +            {Fqn.fromString("/|/b/c/d/e"), false},
  +            {Fqn.fromString("/|/b/c/d/e"), false},
  +            {Fqn.fromString("/a/b/c/d/\""), false},
  +            {Fqn.fromString("/a/b/c/d/\\"), false},
  +            {Fqn.fromString("/a/b/c/d///"), true},
  +            {Fqn.fromString("/a/b/c/:/e"), false}, };
  +
  +      for (int i=0; i < data.length; i++)
  +      {
  +         Fqn fqn = (Fqn)data[i][0];
  +         boolean expected = (Boolean)data[i][1];
  +         assertEquals(fqn.toString(), expected, fcl.isCharacterPortableTree(fqn));
  +      }
  +   }
  +
  +   public void testIsLengthPortablePath()
  +   {
  +      FileCacheLoader fcl = new FileCacheLoader();
  +
  +      Object[][] data = new Object[][] {
  +            {"C:\\here\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\web_services\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\webservices\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\data.dat", true},
  +            {"C:\\there\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\web_services\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\webservices\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\data.dat", true},
  +            {"C:\\deerme\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\web_services\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\webservices\\org\\jboss\\cache\\jgroups\\pojocache\\application\\server\\clustering\\portal\\data.dat", false}};
  +
  +      for (int i=0; i < data.length; i++)
  +      {
  +         String path = (String)data[i][0];
  +         boolean expected = (Boolean)data[i][1];
  +         assertEquals(path, expected, fcl.isLengthPortablePath(path));
  +      }
  +   }
  +
      public static Test suite()
      {
         return new TestSuite(FileCacheLoaderTest.class);
  
  
  



More information about the jboss-cvs-commits mailing list