[jboss-cvs] JBossAS SVN: r95245 - in projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers: vfs/structure/ear/support and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 20 23:33:37 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-10-20 23:33:37 -0400 (Tue, 20 Oct 2009)
New Revision: 95245

Modified:
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/SimpleVFSResourceLoader.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/EsbModificationTypeMatcher.java
   projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java
Log:
Fix file existence checks yet more

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java	2009-10-21 03:31:38 UTC (rev 95244)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java	2009-10-21 03:33:37 UTC (rev 95245)
@@ -100,7 +100,7 @@
       if (resourceRoot == null)
          fail("Resource not found: " + root);
       VirtualFile deployment = VFS.getChild(resourceRoot).getChild(child);
-      if (deployment == null)
+      if (! deployment.exists())
          fail("Child not found " + child + " from " + resourceRoot);
       return deployment;
    }

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java	2009-10-21 03:31:38 UTC (rev 95244)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java	2009-10-21 03:33:37 UTC (rev 95245)
@@ -108,12 +108,12 @@
          VirtualFile jbossProps = file.getChild("META-INF/jboss-application.properties");
          boolean scan = true;
          List<EarModule> modules = new ArrayList<EarModule>();
-         if (applicationProps != null)
+         if (applicationProps.exists())
          {
             scan = false;
             readAppXml(applicationProps, modules);
          }
-         if (jbossProps != null)
+         if (jbossProps.exists())
          {
             readAppXml(jbossProps, modules);
          }
@@ -121,7 +121,7 @@
          try
          {
             VirtualFile lib = file.getChild("lib");
-            if (lib != null)
+            if (lib.exists())
             {
                List<VirtualFile> archives = lib.getChildren(earLibFilter);
                for (VirtualFile archive : archives)
@@ -146,7 +146,7 @@
             if (fileName != null && (fileName = fileName.trim()).length() > 0)
             {
                VirtualFile module = file.getChild(fileName);
-               if (module == null)
+               if (! module.exists())
                {
                   throw new RuntimeException(fileName
                         + " module listed in application.xml does not exist within .ear "
@@ -290,13 +290,13 @@
          VirtualFile clientXml = archive.getChild("META-INF/application-client.xml");
          VirtualFile ejbXml = archive.getChild("META-INF/ejb-jar.xml");
          VirtualFile jbossXml = archive.getChild("META-INF/jboss.xml");
-         //VirtualFile seamXml = getMetaDataFile(archive, "META-INF/components.xml");
+         //VirtualFile seamXml = archive.getChild("META-INF/components.xml");
 
-         if (clientXml != null)
+         if (clientXml.exists())
          {
             type = J2eeModuleMetaData.CLIENT;
          }
-         else if (mfFile != null)
+         else if (mfFile.exists())
          {
             Manifest mf = VFSUtils.readManifest(mfFile);
             Attributes attrs = mf.getMainAttributes();
@@ -309,7 +309,7 @@
                determineType(context, archive);
             }
          }
-         else if (ejbXml != null || jbossXml != null) // || seamXml != null)
+         else if (ejbXml.exists() || jbossXml.exists()) // || seamXml.exists())
          {
             type = J2eeModuleMetaData.EJB;
          }

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/SimpleVFSResourceLoader.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/SimpleVFSResourceLoader.java	2009-10-21 03:31:38 UTC (rev 95244)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/SimpleVFSResourceLoader.java	2009-10-21 03:33:37 UTC (rev 95245)
@@ -43,7 +43,7 @@
       try
       {
          VirtualFile child = root.getChild(name);
-         if (child != null)
+         if (child.exists())
             return child.toURL();
          else
             return null;

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/EsbModificationTypeMatcher.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/EsbModificationTypeMatcher.java	2009-10-21 03:31:38 UTC (rev 95244)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/EsbModificationTypeMatcher.java	2009-10-21 03:33:37 UTC (rev 95245)
@@ -48,7 +48,7 @@
          if (root.getName().endsWith(".esb"))
          {
             VirtualFile wars = root.getChild("wars");
-            if (wars != null)
+            if (wars.exists())
             {
                List<VirtualFile> children = wars.getChildren();
                for (VirtualFile war : children)

Modified: projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java
===================================================================
--- projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java	2009-10-21 03:31:38 UTC (rev 95244)
+++ projects/jboss-deployers/branches/vfs3/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java	2009-10-21 03:33:37 UTC (rev 95245)
@@ -98,12 +98,11 @@
          assertFalse(checker.hasStructureBeenModified(originalRoot));
 
          // add new file
-         URI rootURI = VFSUtils.getRealURL(originalRoot).toURI();
-         File rootFile = new File(rootURI);
+         File rootFile = originalRoot.getPhysicalFile();
          File newFile = newFile(rootFile, "newfile.txt");
          try
          {
-            assertNull(tempRoot.getChild("newfile.txt"));                        
+            assertFalse(tempRoot.getChild("newfile.txt").exists());
             assertFalse(checker.hasStructureBeenModified(originalRoot));
             assertNotNull(tempRoot.getChild("newfile.txt"));
 
@@ -122,8 +121,7 @@
          File updateFile = new File(rootFile, "test.jsp");
          assertTrue(updateFile.exists());
          assertTrue(updateFile.setLastModified(System.currentTimeMillis() + 1500l));
-         @SuppressWarnings("deprecation")
-         VirtualFile testJsp = tempRoot.findChild("test.jsp");
+         VirtualFile testJsp = tempRoot.getChild("test.jsp");
          long tempTimestamp = testJsp.getLastModified();
          // Platform dependent precision for last modified, let's wait a minimum of 1 sec
          Thread.sleep(1500l);
@@ -135,11 +133,10 @@
          // update something outside recurse filter
          VirtualFile someProps = originalRoot.getChild("WEB-INF/classes/some.properties");
          assertNotNull(someProps);
-         updateFile = new File(VFSUtils.getRealURL(someProps).toURI());
+         updateFile = someProps.getPhysicalFile();
          assertTrue(updateFile.exists());
          assertTrue(updateFile.setLastModified(System.currentTimeMillis() + 1500l));
-         @SuppressWarnings("deprecation")
-         VirtualFile tempProps = tempRoot.findChild("WEB-INF/classes/some.properties");
+         VirtualFile tempProps = tempRoot.getChild("WEB-INF/classes/some.properties");
          tempTimestamp = tempProps.getLastModified();
          // Platform dependent precision for last modified, let's wait a minimum of 1 sec
          Thread.sleep(1500l);
@@ -148,7 +145,7 @@
 
          // add new file into WEB-INF
          VirtualFile webInfo = originalRoot.getChild("WEB-INF");
-         File webInfFile = new File(VFSUtils.getCompatibleURI(webInfo));
+         File webInfFile = webInfo.getPhysicalFile();
          File newWebInfFile = newFile(webInfFile, "newfile.txt");
          try
          {
@@ -170,7 +167,7 @@
 
          // check we don't update for nothing
          @SuppressWarnings("deprecation")
-         VirtualFile xhtml = tempRoot.findChild("test.xhtml");
+         VirtualFile xhtml = tempRoot.getChild("test.xhtml");
          long xhtmlTimestamp = xhtml.getLastModified();
          // Platform dependent precision for last modified, let's wait a minimum of 1 sec
          Thread.sleep(1500l);




More information about the jboss-cvs-commits mailing list