[jboss-dev-forums] [Design of POJO Server] - Making JBoss Test VFS aware

alesj do-not-reply at jboss.com
Fri Dec 21 10:40:03 EST 2007


When testing deployment/deployers I ran into some problems with URL mappings.
This lead to a simple discovery that our Test project is completely VFS unaware. :-)

The code that previously worked out-of-the-box (JBossTestServices)

  |    protected URL getDeployURL(final String filename)
  |       throws MalformedURLException
  |    {
  |       // First see if it is already a complete url.
  |       try
  |       {
  |          return new URL(filename);
  |       }
  |       catch (MalformedURLException e)
  |       {
  |          log.debug(filename + " is not a valid URL, " + e.getMessage());
  |       }
  | 
  |       // OK, lets see if we can figure out what it might be.
  |       String deployDir = System.getProperty("jbosstest.deploy.dir");
  |       if (deployDir == null)
  |       {
  |          deployDir = "output/lib";
  |       }
  |       String url = deployDir + "/" + filename;
  |       log.debug("Testing file: " + url);
  |       // try to canonicalize the strings a bit.
  |       File file = new File(url);
  |       if (file.exists())
  |       {
  |          log.debug(file.getAbsolutePath() + " is a valid file");
  |          return file.toURL();
  |       }
  |       else
  |       {
  |          log.debug("File does not exist, creating url: " + url);
  |          return new URL(url);
  |       }
  |    }
  | 
now fails if there is no plain-mapping --> vfs-mapping in the middle.
And for subdeployments, there is no such mapping, since old MainDeployer only keeps reference/mapping for the top level deployment.
So if you want to do a isDeployed test for some subdeployment, there is no way to get a useful result unless you do some similar hacking:

  |    public boolean isDeployed(URL url)
  |    {
  |       String name = contextMap.get(url);
  |       if (name == null)
  |       {
  |          if (log.isTraceEnabled())
  |             log.trace("No such context: " + url);
  |          if (url == null)
  |             throw new IllegalArgumentException("Null url");
  |          String urlString = url.toString();
  |          // remove this once the JBoss-test is updated with VFS usage
  |          if (urlString.startsWith("vfs") == false)
  |             return checkDeployed("vfs" + urlString);
  |          else
  |             return checkDeployed(urlString);
  |       }
  | 
  |       return checkDeployed(name);
  |    }
  | 

This is just one of the problems, I'm sure there are more VFS related issues.

On the other hand, we're also missing some VFS performance tests.
The current tests with Seam examples showed a horrible performance hit.
We need to include this in both, VFS and AS tests.

I can go and change the first issue(s), but would need some help on how to start/impl with the second, performance testing.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115013#4115013

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115013



More information about the jboss-dev-forums mailing list