[jboss-cvs] JBossAS SVN: r90149 - in projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified: test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jun 12 06:51:15 EDT 2009
Author: alesj
Date: 2009-06-12 06:51:15 -0400 (Fri, 12 Jun 2009)
New Revision: 90149
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/AbstractSynchTest.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java
Log:
[JBDEPLOY-192]; metadata + synch overlap test.
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java 2009-06-12 10:20:03 UTC (rev 90148)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java 2009-06-12 10:51:15 UTC (rev 90149)
@@ -21,18 +21,17 @@
*/
package org.jboss.test.deployers.vfs.structure.modified.support;
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.deployers.vfs.spi.structure.modified.AbstractPathNameFilter;
/**
* Include only .xml files.
*
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class XmlIncludeVirtualFileFilter implements VirtualFileFilter
+public class XmlIncludeVirtualFileFilter extends AbstractPathNameFilter
{
- public boolean accepts(VirtualFile file)
+ public boolean accepts(String path)
{
- return file.getName().endsWith(".xml");
+ return path.endsWith(".xml");
}
}
\ No newline at end of file
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/AbstractSynchTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/AbstractSynchTest.java 2009-06-12 10:20:03 UTC (rev 90148)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/AbstractSynchTest.java 2009-06-12 10:51:15 UTC (rev 90149)
@@ -51,6 +51,8 @@
MetaDataStructureModificationChecker mdsmc = new MetaDataStructureModificationChecker(mainDeployerStructure);
mdsmc.setFilter(filter);
+ mdsmc.start();
+
SynchWrapperModificationChecker synch = new SynchWrapperModificationChecker(mdsmc, synchAdapter);
VisitorAttributes attributes = new VisitorAttributes();
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java 2009-06-12 10:20:03 UTC (rev 90148)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java 2009-06-12 10:51:15 UTC (rev 90149)
@@ -21,12 +21,13 @@
*/
package org.jboss.test.deployers.vfs.structure.modified.test;
+import java.io.BufferedWriter;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.FileOutputStream;
-import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.net.URI;
+import java.net.URL;
import junit.framework.Test;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
@@ -34,9 +35,9 @@
import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
import org.jboss.deployers.vfs.spi.structure.modified.SynchAdapter;
import org.jboss.test.deployers.vfs.structure.modified.support.XmlIncludeVirtualFileFilter;
+import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VFSUtils;
/**
* Test file synch.
@@ -66,9 +67,17 @@
{
public boolean accepts(VirtualFile file)
{
- String path = file.getPathName();
- // only wars, but not its classes
- return (path.contains(".war") && path.contains("/WEB-INF") == false);
+ try
+ {
+ URL url = file.toURL();
+ String path = url.toExternalForm();
+ // only wars, but not its classes
+ return (path.contains(".war") && path.contains("/WEB-INF/classes") == false);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
}
};
}
@@ -137,6 +146,28 @@
assertFalse(checker.hasStructureBeenModified(originalRoot));
assertEquals(tempTimestamp, tempProps.getLastModified());
+ // add new file into WEB-INF
+ VirtualFile webInfo = originalRoot.getChild("WEB-INF");
+ File webInfFile = new File(VFSUtils.getCompatibleURI(webInfo));
+ File newWebInfFile = newFile(webInfFile, "newfile.txt");
+ try
+ {
+ assertNull(tempRoot.getChild("WEB-INF/newfile.txt"));
+ assertFalse(checker.hasStructureBeenModified(originalRoot));
+ assertNotNull(tempRoot.getChild("WEB-INF/newfile.txt"));
+ assertFalse(checker.hasStructureBeenModified(originalRoot));
+
+ // try deleting this one now
+ assertTrue(newWebInfFile.delete());
+ assertFalse(checker.hasStructureBeenModified(originalRoot));
+ assertNull(tempRoot.getChild("WEB-INF/newfile.txt"));
+ }
+ finally
+ {
+ if (newWebInfFile.exists())
+ assertTrue(newWebInfFile.delete());
+ }
+
// check we don't update for nothing
@SuppressWarnings("deprecation")
VirtualFile xhtml = tempRoot.findChild("test.xhtml");
@@ -145,7 +176,6 @@
Thread.sleep(1500l);
assertFalse(checker.hasStructureBeenModified(originalRoot));
assertEquals(xhtmlTimestamp, xhtml.getLastModified());
-
}
finally
{
More information about the jboss-cvs-commits
mailing list