Author: rob.stryker(a)jboss.com
Date: 2009-05-18 04:36:28 -0400 (Mon, 18 May 2009)
New Revision: 15321
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/DirectoryScannerTest.java
Log:
JBIDE-4330 - ISsue Tracker 291358 - single file matching failed
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-05-18
06:14:54 UTC (rev 15320)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-05-18
08:36:28 UTC (rev 15321)
@@ -112,7 +112,7 @@
protected File getChild(File file, String element) {
if( !fs.inWorkspace)
- return super.getChild(file, element);
+ return new FileWrapper(file, new Path(file.getAbsolutePath()),
fs.rootArchiveRelativePath);
FileWrapper pWrapper = (FileWrapper)file;
File child = super.getChild(file, element);
FileWrapper childWrapper = new FileWrapper(child,
pWrapper.getWrapperPath().append(element), fs.rootArchiveRelativePath);
Modified:
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/DirectoryScannerTest.java
===================================================================
---
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/DirectoryScannerTest.java 2009-05-18
06:14:54 UTC (rev 15320)
+++
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/DirectoryScannerTest.java 2009-05-18
08:36:28 UTC (rev 15321)
@@ -45,7 +45,7 @@
ResourcesUtils.deleteProject(proj.getName());
}
- public void testScanner() {
+ public void testScannerIterator() {
DirectoryScannerExtension scanner1 =
DirectoryScannerFactory.createDirectoryScanner(
proj.getLocation().toOSString(), null,
@@ -75,4 +75,24 @@
assertEquals(results.length, iterated.size());
}
+
+ public void testSingleFileScanner() {
+ DirectoryScannerExtension scanner1 =
+ DirectoryScannerFactory.createDirectoryScanner(
+ proj.getLocation().append("Resources").append("images").toOSString(),
null,
+ "multiple_files.gif", "", null,
+ false, 1.2, false);
+ scanner1.scan();
+ FileWrapper[] results = scanner1.getMatchedArray();
+ assertTrue(results != null && results.length == 1);
+
+ DirectoryScannerExtension scanner2 =
+ DirectoryScannerFactory.createDirectoryScanner(
+ proj.getLocation().toOSString(), null,
+ "Resources/images/multiple_files.gif", "", null,
+ false, 1.2, false);
+ scanner2.scan();
+ FileWrapper[] results2 = scanner2.getMatchedArray();
+ assertTrue(results2 != null && results2.length == 1);
+ }
}
Show replies by date