You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/05 12:02:43 UTC

svn commit: r544459 [34/36] - in /incubator/ivy/core/trunk: src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/ src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver...

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportOutputterTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportOutputterTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportOutputterTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportOutputterTest.java Tue Jun  5 05:02:27 2007
@@ -29,9 +29,9 @@
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Delete;
 
-
 public class XmlReportOutputterTest extends TestCase {
-	private final Ivy _ivy;
+    private final Ivy _ivy;
+
     private File _cache;
 
     public XmlReportOutputterTest() throws Exception {
@@ -47,7 +47,7 @@
         _cache = new File("build/cache");
         _cache.mkdirs();
     }
-    
+
     protected void tearDown() throws Exception {
         cleanCache();
     }
@@ -58,50 +58,57 @@
         del.setDir(_cache);
         del.execute();
     }
-    
-	public void testWriteOrigin() throws Exception {
-        ResolveReport report = _ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
-        		getResolveOptions(new String[] {"default"}));
+
+    public void testWriteOrigin() throws Exception {
+        ResolveReport report = _ivy.resolve(new File(
+                "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
+            getResolveOptions(new String[] {"default"}));
         assertNotNull(report);
-		
-		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-		XmlReportOutputter outputter = new XmlReportOutputter();
-		outputter.output(report.getConfigurationReport("default"), buffer);
-		buffer.flush();
-		String xml = buffer.toString();
-		
-        String expectedLocation = "location=\"" + new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar").getAbsolutePath() + "\"";
+
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        XmlReportOutputter outputter = new XmlReportOutputter();
+        outputter.output(report.getConfigurationReport("default"), buffer);
+        buffer.flush();
+        String xml = buffer.toString();
+
+        String expectedLocation = "location=\""
+                + new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar").getAbsolutePath()
+                + "\"";
         String expectedIsLocal = "is-local=\"true\"";
 
-        assertTrue("XML doesn't contain artifact location attribute", xml.indexOf(expectedLocation) != -1);
-        assertTrue("XML doesn't contain artifact is-local attribute", xml.indexOf(expectedIsLocal) != -1);
-	}
-	
-	public void testWriteModuleInfo() throws Exception {
-        ResolveReport report = _ivy.resolve(new File("test/java/org/apache/ivy/plugins/report/ivy-with-info.xml").toURL(),
-        		getResolveOptions(new String[] {"default"}).setValidate(false));
+        assertTrue("XML doesn't contain artifact location attribute",
+            xml.indexOf(expectedLocation) != -1);
+        assertTrue("XML doesn't contain artifact is-local attribute",
+            xml.indexOf(expectedIsLocal) != -1);
+    }
+
+    public void testWriteModuleInfo() throws Exception {
+        ResolveReport report = _ivy.resolve(new File(
+                "test/java/org/apache/ivy/plugins/report/ivy-with-info.xml").toURL(),
+            getResolveOptions(new String[] {"default"}).setValidate(false));
         assertNotNull(report);
-        
-		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-		XmlReportOutputter outputter = new XmlReportOutputter();
-		outputter.output(report.getConfigurationReport("default"), buffer);
-		buffer.flush();
-		String xml = buffer.toString();
-		
-		String orgAttribute = "organisation=\"org1\"";
-		String modAttribute = "module=\"mod1\"";
-		String revAttribute = "revision=\"1.0\"";
-		String extra1Attribute = "extra-blabla=\"abc\"";
-		String extra2Attribute = "extra-blabla2=\"123\"";
-		
+
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        XmlReportOutputter outputter = new XmlReportOutputter();
+        outputter.output(report.getConfigurationReport("default"), buffer);
+        buffer.flush();
+        String xml = buffer.toString();
+
+        String orgAttribute = "organisation=\"org1\"";
+        String modAttribute = "module=\"mod1\"";
+        String revAttribute = "revision=\"1.0\"";
+        String extra1Attribute = "extra-blabla=\"abc\"";
+        String extra2Attribute = "extra-blabla2=\"123\"";
+
         assertTrue("XML doesn't contain organisation attribute", xml.indexOf(orgAttribute) != -1);
         assertTrue("XML doesn't contain module attribute", xml.indexOf(modAttribute) != -1);
         assertTrue("XML doesn't contain revision attribute", xml.indexOf(revAttribute) != -1);
         assertTrue("XML doesn't contain extra attribute 1", xml.indexOf(extra1Attribute) != -1);
         assertTrue("XML doesn't contain extra attribute 2", xml.indexOf(extra2Attribute) != -1);
-	}
-    
+    }
+
     private ResolveOptions getResolveOptions(String[] confs) {
-		return new ResolveOptions().setConfs(confs).setCache(CacheManager.getInstance(_ivy.getSettings(), _cache));
-	}
+        return new ResolveOptions().setConfs(confs).setCache(
+            CacheManager.getInstance(_ivy.getSettings(), _cache));
+    }
 }

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportParserTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportParserTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportParserTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportParserTest.java Tue Jun  5 05:02:27 2007
@@ -30,7 +30,8 @@
 import org.apache.tools.ant.taskdefs.Delete;
 
 public class XmlReportParserTest extends TestCase {
-	private final Ivy _ivy;
+    private final Ivy _ivy;
+
     private File _cache;
 
     public XmlReportParserTest() throws Exception {
@@ -46,7 +47,7 @@
         _cache = new File("build/cache");
         _cache.mkdirs();
     }
-    
+
     protected void tearDown() throws Exception {
         cleanCache();
     }
@@ -57,22 +58,26 @@
         del.setDir(_cache);
         del.execute();
     }
-    
+
     public void testGetResolvedModule() throws Exception {
-        ResolveReport report = _ivy.resolve(new File("test/java/org/apache/ivy/plugins/report/ivy-with-info.xml").toURL(),
-        		getResolveOptions(new String[] {"default"}).setValidate(false).setResolveId("testGetResolvedModule"));
+        ResolveReport report = _ivy.resolve(new File(
+                "test/java/org/apache/ivy/plugins/report/ivy-with-info.xml").toURL(),
+            getResolveOptions(new String[] {"default"}).setValidate(false).setResolveId(
+                "testGetResolvedModule"));
         assertNotNull(report);
 
         ModuleRevisionId modRevId = report.getModuleDescriptor().getModuleRevisionId();
-        
+
         XmlReportParser parser = new XmlReportParser();
-        parser.parse(_ivy.getCacheManager(_cache).getConfigurationResolveReportInCache("testGetResolvedModule", "default"));
+        parser.parse(_ivy.getCacheManager(_cache).getConfigurationResolveReportInCache(
+            "testGetResolvedModule", "default"));
         ModuleRevisionId parsedModRevId = parser.getResolvedModule();
-        
+
         assertEquals("Resolved module doesn't equals parsed module", modRevId, parsedModRevId);
     }
-    
+
     private ResolveOptions getResolveOptions(String[] confs) {
-		return new ResolveOptions().setConfs(confs).setCache(CacheManager.getInstance(_ivy.getSettings(), _cache));
-	}
+        return new ResolveOptions().setConfs(confs).setCache(
+            CacheManager.getInstance(_ivy.getSettings(), _cache));
+    }
 }

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java Tue Jun  5 05:02:27 2007
@@ -26,268 +26,251 @@
 import org.apache.ivy.util.FileUtil;
 
 /**
- * Testing
- * Testing was the single biggest hurdle I faced. I have tried to provide a
- * complete test suite that covers all protocols and which can be easily extended.
- * It does differ - somewhat - in structure from the resolver/repository test
- * suites.
-
- * Setting up smb, ftp, sftp will undoubtedly be your biggest headache (it was
- * mine). Here are a few notes about the setup:
- * - the VFS test suite uses the build/test/repositories area
- * - when setting samba, sftp, etc. the corresponding user needs both read and
- * write privileges.
- * - the tests assume that the user and password is the same for all services.
- * - a limited amount of configuration is available by setting the following
- * properties in the ivy.properties file:
- *   * vfs.host
- *   * vfs.username
- *   * vfs.password
- *   * vfs.samba_share
- * 
- * Running the test requires that commons-io and ant.jar are on the classpath.
- * 
- * Also, I would recommend that at some time the tests be converted from straight
- * junit to something which betters supports functional testing.
- * Although somewhat crude I am using jsystem (http://jsystemtest.sourceforge.net/)
- * in other projects and am finding it a much better solution than straight junit.
- * 
- * Stephen Nesbitt
+ * Testing Testing was the single biggest hurdle I faced. I have tried to provide a complete test
+ * suite that covers all protocols and which can be easily extended. It does differ - somewhat - in
+ * structure from the resolver/repository test suites. Setting up smb, ftp, sftp will undoubtedly be
+ * your biggest headache (it was mine). Here are a few notes about the setup: - the VFS test suite
+ * uses the build/test/repositories area - when setting samba, sftp, etc. the corresponding user
+ * needs both read and write privileges. - the tests assume that the user and password is the same
+ * for all services. - a limited amount of configuration is available by setting the following
+ * properties in the ivy.properties file: * vfs.host * vfs.username * vfs.password * vfs.samba_share
+ * Running the test requires that commons-io and ant.jar are on the classpath. Also, I would
+ * recommend that at some time the tests be converted from straight junit to something which betters
+ * supports functional testing. Although somewhat crude I am using jsystem
+ * (http://jsystemtest.sourceforge.net/) in other projects and am finding it a much better solution
+ * than straight junit. Stephen Nesbitt
  */
 public class VfsRepositoryTest extends TestCase {
-	private VfsRepository repo = null;
-	private VfsTestHelper helper = null;
-	private File scratchDir = null;
-
-	public VfsRepositoryTest(String arg0) throws Exception {
-		super(arg0);
-	}
-
-	protected void setUp() throws Exception {
-		super.setUp();
-		helper = new VfsTestHelper();
-		repo = new VfsRepository();
-		scratchDir = new File(FileUtil.concat(VfsTestHelper.TEST_REPO_DIR,
-				                                   VfsTestHelper.SCRATCH_DIR));
-		scratchDir.mkdir();		
-	}
-
-	protected void tearDown() throws Exception {
-		super.tearDown();
-		repo = null;
-		if (scratchDir.exists()) {
-			FileUtil.forceDelete(scratchDir);
-		}
-	}
-	
-	/**
-	 * Basic validation of happy path put - valid VFS URI and no conflict with existing file
-	 * 
-	 * @throws Exception
-	 */
-	public void testPutValid() throws Exception {
-		String testResource = VfsTestHelper.TEST_IVY_XML;
-		String srcFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, testResource);		
-		String destResource = VfsTestHelper.SCRATCH_DIR + "/" +  testResource;
-		String destFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource);
-		
-		Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
-		while (vfsURIs.hasNext()) {
-			VfsURI vfsURI = (VfsURI) vfsURIs.next();
-			if (scratchDir.exists()) {
-				FileUtil.forceDelete(scratchDir);
-			}
-
-			try {
-				repo.put(new File(srcFile), vfsURI.toString(), false);
-				if (! new File(srcFile).exists()) {
-					fail("Put didn't happen. Src VfsURI: " + vfsURI.toString() + 
-							".\nExpected file: " + destFile);
-				}
-			} catch (IOException e) {
-				fail("Caught unexpected IOException on Vfs URI: " + vfsURI.toString() + "\n" + e.getLocalizedMessage());
-			}
-		}
-	}
-
-	/**
-	 * Validate that we can overwrite an existing file
-	 * 
-	 * @throws Exception
-	 */
-	public void testPutOverwriteTrue() throws Exception {
-		String testResource = VfsTestHelper.TEST_IVY_XML;
-		String srcFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, testResource);		
-		String destResource = VfsTestHelper.SCRATCH_DIR + "/" +  testResource;
-		File destFile = new File(
-				FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource));
-		
-		Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
-		while (vfsURIs.hasNext()) {
-			VfsURI vfsURI = (VfsURI) vfsURIs.next();
-			
-			// remove existing scratch dir and populate it with an empty file
-			// that we can overwrite. We do this so that we can test file sizes.
-			// seeded file has length 0, while put file will have a length > 0
-			if (scratchDir.exists()) {
-				FileUtil.forceDelete(scratchDir);
-			}
+    private VfsRepository repo = null;
+
+    private VfsTestHelper helper = null;
+
+    private File scratchDir = null;
+
+    public VfsRepositoryTest(String arg0) throws Exception {
+        super(arg0);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        helper = new VfsTestHelper();
+        repo = new VfsRepository();
+        scratchDir = new File(FileUtil.concat(VfsTestHelper.TEST_REPO_DIR,
+            VfsTestHelper.SCRATCH_DIR));
+        scratchDir.mkdir();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        repo = null;
+        if (scratchDir.exists()) {
+            FileUtil.forceDelete(scratchDir);
+        }
+    }
+
+    /**
+     * Basic validation of happy path put - valid VFS URI and no conflict with existing file
+     * 
+     * @throws Exception
+     */
+    public void testPutValid() throws Exception {
+        String testResource = VfsTestHelper.TEST_IVY_XML;
+        String srcFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, testResource);
+        String destResource = VfsTestHelper.SCRATCH_DIR + "/" + testResource;
+        String destFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource);
+
+        Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
+        while (vfsURIs.hasNext()) {
+            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+            if (scratchDir.exists()) {
+                FileUtil.forceDelete(scratchDir);
+            }
+
+            try {
+                repo.put(new File(srcFile), vfsURI.toString(), false);
+                if (!new File(srcFile).exists()) {
+                    fail("Put didn't happen. Src VfsURI: " + vfsURI.toString()
+                            + ".\nExpected file: " + destFile);
+                }
+            } catch (IOException e) {
+                fail("Caught unexpected IOException on Vfs URI: " + vfsURI.toString() + "\n"
+                        + e.getLocalizedMessage());
+            }
+        }
+    }
+
+    /**
+     * Validate that we can overwrite an existing file
+     * 
+     * @throws Exception
+     */
+    public void testPutOverwriteTrue() throws Exception {
+        String testResource = VfsTestHelper.TEST_IVY_XML;
+        String srcFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, testResource);
+        String destResource = VfsTestHelper.SCRATCH_DIR + "/" + testResource;
+        File destFile = new File(FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource));
+
+        Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
+        while (vfsURIs.hasNext()) {
+            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+
+            // remove existing scratch dir and populate it with an empty file
+            // that we can overwrite. We do this so that we can test file sizes.
+            // seeded file has length 0, while put file will have a length > 0
+            if (scratchDir.exists()) {
+                FileUtil.forceDelete(scratchDir);
+            }
             destFile.getParentFile().mkdirs();
             destFile.createNewFile();
 
-			try {
-				repo.put(new File(srcFile), vfsURI.toString(), true);
-				if (! new File(srcFile).exists()) {
-					fail("Put didn't happen. Src VfsURI: " + vfsURI.toString() + 
-							".\nExpected file: " + destFile);
-				}
-				if (destFile.length() == 0) {
-					fail("Zero file size indicates file not overwritten");
-				}
-			} catch (IOException e) {
-				fail("Caught unexpected IOException on Vfs URI: " + vfsURI.toString() + "\n" + e.getLocalizedMessage());
-			}
-		}
-	}
-
-	/**
-	 * Validate that we put will respect a request not to overwrite an existing file
-	 * 
-	 * @throws Exception
-	 */
-	public void testPutOverwriteFalse() throws Exception {
-		String testResource = VfsTestHelper.TEST_IVY_XML;
-		String srcFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, testResource);		
-		String destResource = VfsTestHelper.SCRATCH_DIR + "/" +  testResource;
-		File destFile = new File(
-				FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource));
-		destFile.getParentFile().mkdirs();
+            try {
+                repo.put(new File(srcFile), vfsURI.toString(), true);
+                if (!new File(srcFile).exists()) {
+                    fail("Put didn't happen. Src VfsURI: " + vfsURI.toString()
+                            + ".\nExpected file: " + destFile);
+                }
+                if (destFile.length() == 0) {
+                    fail("Zero file size indicates file not overwritten");
+                }
+            } catch (IOException e) {
+                fail("Caught unexpected IOException on Vfs URI: " + vfsURI.toString() + "\n"
+                        + e.getLocalizedMessage());
+            }
+        }
+    }
+
+    /**
+     * Validate that we put will respect a request not to overwrite an existing file
+     * 
+     * @throws Exception
+     */
+    public void testPutOverwriteFalse() throws Exception {
+        String testResource = VfsTestHelper.TEST_IVY_XML;
+        String srcFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, testResource);
+        String destResource = VfsTestHelper.SCRATCH_DIR + "/" + testResource;
+        File destFile = new File(FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource));
+        destFile.getParentFile().mkdirs();
         destFile.createNewFile();
-		
-		Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
-		while (vfsURIs.hasNext()) {
-			VfsURI vfsURI = (VfsURI) vfsURIs.next();
-			
-			try {
-				repo.put(new File(srcFile), vfsURI.toString(), false);
-				fail("Did not throw expected IOException from attempted overwrite of existing file");
-			} catch (IOException e) {
-			}
-		}
-	}
-
-	/**
-	 * Test the retrieval of an artifact from the repository creating a new artifact
-	 * 
-	 * @throws Exception
-	 */
-	public void testGetNoExisting() throws Exception {
-		String testResource = VfsTestHelper.TEST_IVY_XML;
-		String testFile = FileUtil.concat(scratchDir.getAbsolutePath(), 
-				                                 testResource);
-		
-		Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
-		while (vfsURIs.hasNext()) {
-			VfsURI vfsURI = (VfsURI) vfsURIs.next();
-			if (scratchDir.exists()) {
-				FileUtil.forceDelete(scratchDir);
-			}
-			
-			try {
-				repo.get(vfsURI.toString(), new File(testFile));
-				if (! new File(testFile).exists()) {
-					fail("Expected file: " + testFile + "not found. Failed vfsURI: " + vfsURI.toString());
-				}
-			} catch (IOException e) {
-				fail("Caught unexpected IOException on Vfs URI: " + vfsURI.toString() + "\n" + e.getLocalizedMessage());
-			}
-		}
-	}
-	
-	/**
-	 * Test the retrieval of an artifact from the repository overwriting an existing artifact
-	 * 
-	 * @throws Exception
-	 */
-	public void testGetOverwriteExisting() throws Exception {
-		String testResource = VfsTestHelper.TEST_IVY_XML;
-		File testFile = new File( FileUtil.concat(scratchDir.getAbsolutePath(), 
-				                                           testResource));
-		
-		Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
-		while (vfsURIs.hasNext()) {
-			VfsURI vfsURI = (VfsURI) vfsURIs.next();
-			
-			// setup - remove existing scratch area and populate with a file to override
-			if (scratchDir.exists()) {
-				FileUtil.forceDelete(scratchDir);
-			}
+
+        Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
+        while (vfsURIs.hasNext()) {
+            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+
+            try {
+                repo.put(new File(srcFile), vfsURI.toString(), false);
+                fail("Did not throw expected IOException from attempted overwrite of existing file");
+            } catch (IOException e) {
+            }
+        }
+    }
+
+    /**
+     * Test the retrieval of an artifact from the repository creating a new artifact
+     * 
+     * @throws Exception
+     */
+    public void testGetNoExisting() throws Exception {
+        String testResource = VfsTestHelper.TEST_IVY_XML;
+        String testFile = FileUtil.concat(scratchDir.getAbsolutePath(), testResource);
+
+        Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
+        while (vfsURIs.hasNext()) {
+            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+            if (scratchDir.exists()) {
+                FileUtil.forceDelete(scratchDir);
+            }
+
+            try {
+                repo.get(vfsURI.toString(), new File(testFile));
+                if (!new File(testFile).exists()) {
+                    fail("Expected file: " + testFile + "not found. Failed vfsURI: "
+                            + vfsURI.toString());
+                }
+            } catch (IOException e) {
+                fail("Caught unexpected IOException on Vfs URI: " + vfsURI.toString() + "\n"
+                        + e.getLocalizedMessage());
+            }
+        }
+    }
+
+    /**
+     * Test the retrieval of an artifact from the repository overwriting an existing artifact
+     * 
+     * @throws Exception
+     */
+    public void testGetOverwriteExisting() throws Exception {
+        String testResource = VfsTestHelper.TEST_IVY_XML;
+        File testFile = new File(FileUtil.concat(scratchDir.getAbsolutePath(), testResource));
+
+        Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
+        while (vfsURIs.hasNext()) {
+            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+
+            // setup - remove existing scratch area and populate with a file to override
+            if (scratchDir.exists()) {
+                FileUtil.forceDelete(scratchDir);
+            }
             testFile.getParentFile().mkdirs();
-			testFile.createNewFile();
-			
-			
-			try {
-				repo.get(vfsURI.toString(), testFile);
-				if (! testFile.exists()) {
-					fail("Expected file: " + testFile + "not found. Failed vfsURI: " + vfsURI.toString());
-				}
-				if (testFile.length() == 0) {
-					fail("Zero file size indicates file not overwritten");
-				}
-			} catch (IOException e) {
-				fail("Caught unexpected IOException on Vfs URI: " + vfsURI.toString() + "\n" + e.getLocalizedMessage());
-			}
-		}
-	}
-	
-	/**
-	 * Validate that we get a non null Resource instance when
-	 * passed a well-formed VfsURI pointing to an existing file
-	 *
-	 */
-	public void testGetResourceValidExist() throws Exception {
-		String testResource = VfsTestHelper.TEST_IVY_XML;
-		
-		Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
-
-		while (vfsURIs.hasNext()) {
-			VfsURI vfsURI = (VfsURI) vfsURIs.next();
-			try {				
-				assertNotNull(repo.getResource(vfsURI.toString()));
-			} catch (IOException e) {
-				fail("Unexpected IOError on fetch of valid resource");
-				e.printStackTrace();
-			}
-		}
-	}
-
-
-	
-	/**
-	 * Validate that we get a non null Resource instance when
-	 * passed a well-formed VfsURI pointing to a non-existent
-	 * file.
-	 *
-	 */
-	public void testGetResourceValidNoExist() throws Exception {
-		String testResource = VfsTestHelper.SCRATCH_DIR + "/nosuchfile.jar";
-		
-		Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
-		while (vfsURIs.hasNext()) {
-			VfsURI vfsURI = (VfsURI) vfsURIs.next();
-			
-			// make sure the declared resource does not exist
-			if (scratchDir.exists()) {
-				FileUtil.forceDelete(scratchDir);
-			}
-			try {
-				assertNotNull(repo.getResource(vfsURI.toString()));
-			} catch (IOException e) {
-				// this should not happen
-				fail("Unexpected IOException");
-			}
-		}
-	}
+            testFile.createNewFile();
+
+            try {
+                repo.get(vfsURI.toString(), testFile);
+                if (!testFile.exists()) {
+                    fail("Expected file: " + testFile + "not found. Failed vfsURI: "
+                            + vfsURI.toString());
+                }
+                if (testFile.length() == 0) {
+                    fail("Zero file size indicates file not overwritten");
+                }
+            } catch (IOException e) {
+                fail("Caught unexpected IOException on Vfs URI: " + vfsURI.toString() + "\n"
+                        + e.getLocalizedMessage());
+            }
+        }
+    }
+
+    /**
+     * Validate that we get a non null Resource instance when passed a well-formed VfsURI pointing
+     * to an existing file
+     */
+    public void testGetResourceValidExist() throws Exception {
+        String testResource = VfsTestHelper.TEST_IVY_XML;
+
+        Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
+
+        while (vfsURIs.hasNext()) {
+            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+            try {
+                assertNotNull(repo.getResource(vfsURI.toString()));
+            } catch (IOException e) {
+                fail("Unexpected IOError on fetch of valid resource");
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * Validate that we get a non null Resource instance when passed a well-formed VfsURI pointing
+     * to a non-existent file.
+     */
+    public void testGetResourceValidNoExist() throws Exception {
+        String testResource = VfsTestHelper.SCRATCH_DIR + "/nosuchfile.jar";
+
+        Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
+        while (vfsURIs.hasNext()) {
+            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+
+            // make sure the declared resource does not exist
+            if (scratchDir.exists()) {
+                FileUtil.forceDelete(scratchDir);
+            }
+            try {
+                assertNotNull(repo.getResource(vfsURI.toString()));
+            } catch (IOException e) {
+                // this should not happen
+                fail("Unexpected IOException");
+            }
+        }
+    }
 
-	
 }

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java Tue Jun  5 05:02:27 2007
@@ -26,212 +26,202 @@
 
 import junit.framework.TestCase;
 
-
 public class VfsResourceTest extends TestCase {
-	private VfsTestHelper helper = null;
+    private VfsTestHelper helper = null;
 
-	public VfsResourceTest() {
-		super();
-	}
-
-	public VfsResourceTest(String arg0) {
-		super(arg0);
-	}
-	
-	public void setUp() throws Exception {
-		helper = new VfsTestHelper();
-	}
-	
-	public void tearDown() {
-		helper = null;
-	}
-	
-	/**
-	 * Validate VFSResource creation for a valid VFS URI pointing to an physically existing file
-	 */
-	public void testCreateResourceThatExists() throws Exception{
-		Iterator vfsURIs = helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
-		while (vfsURIs.hasNext()) {
-			VfsURI vfsURI = (VfsURI) vfsURIs.next();
-			String resId = vfsURI.toString();
-			VfsResource res = new VfsResource(resId, helper.fsManager);
-			if (res == null) {
-				fail("Unexpected null value on VFS URI: " + resId);
-			}
-
-			if (! res.exists()) {
-				fail("Resource does not exist and it should: " + resId);
-			}
-			
-			// VFS apparently does some weird normalization so that resource id used to create
-			// the VFS resource is not necessarily identical to the id returned from the getName
-			// method <sigh>. We try to work around this by transforming things into java URIs.
-			if (! new URI(resId).equals(new URI(res.getName()).normalize())) {
-				fail("Failed on getName. Expected: " + resId + ". Actual: " + res.getName());
-			}
-			
-			if (res.getLastModified() == 0 ) {
-				fail("Expected non-null file modification date for URI: " + resId);
-			}
-			
-			if (res.getContentLength() == 0 ) {
-				fail("Expected non-zero file length for URI: " + resId);				
-			}
-			
-			if (! res.physicallyExists()) {
-				fail("Physical existence check returned false for existing resource: " + resId);								
-			}
-		}
-	}
-	
-	/**
-	 * Validating that resource can be created for files which don't physically exists - 
-	 * e.g. resources that are going to created.
-	 *
-	 */
-	public void testCreateResourceThatDoesntExist() throws Exception {
-		Iterator vfsURIs = helper.createVFSUriSet("zzyyxx.zzyyxx").iterator();
-		while (vfsURIs.hasNext()) {
-			VfsURI vfsURI = (VfsURI) vfsURIs.next();
-			String resId = vfsURI.toString();
-			VfsResource res = new VfsResource(resId, helper.fsManager);
-			if (res == null) {
-				fail("Unexpected null value on VFS URI: " + resId);
-			}
-
-			if (res.exists()) {
-				fail("Resource does not exist and it shouldn't: " + resId);
-			}
-			
-			// VFS apparently does some weird normalization so that resource id used to create
-			// the VFS resource is not necessarily identical to the id returned from the getName
-			// method <sigh>. We try to work around this by transforming things into java URIs.
-			if (! new URI(resId).equals(new URI(res.getName()).normalize())) {
-				fail("Failed on getName. Expected: " + resId + ". Actual: " + res.getName());
-			}
-			
-			if (res.getLastModified() != 0 ) {
-				fail("Expected null file modification date for URI: " + resId + ": " + res.getLastModified());
-			}
-			
-			if (res.getContentLength() != 0 ) {
-				fail("Expected non-zero file length for URI: " + resId);				
-			}
-			
-			if (res.physicallyExists()) {
-				fail("Physical existence check returned true for non-existent resource: " + resId);								
-			}
-		}
-	}
-	
-	/**
-	 * Validate VFSResource creation when given a poorly formed VFS identifier
-	 *
-	 */
-	public void testBadURI() throws Exception {
-		String vfsURI = "smb1:/goobeldygook";
-		VfsResource res = new VfsResource(vfsURI, helper.fsManager);
-		
-		
-		if (res == null) {
-			fail("Unexpected null value on VFS URI: " + vfsURI);
-		}
-		
-		if (res.exists()) {
-			fail("Resource is marked as existing and it should not: " + vfsURI);
-		}
-		
-		if (! res.getName().equals("smb1:/goobeldygook")) {
-			fail("Failed on getName. Expected: " + vfsURI + ". Actual: " + res.getName());
-		}
-		
-		if (res.getLastModified() != 0 ) {
-			fail("Expected null file modification date for URI: " + vfsURI + ": " + res.getLastModified());
-		}
-		
-		if (res.getContentLength() != 0 ) {
-			fail("Expected zero file length for URI: " + vfsURI);				
-		}
-
-		if (res.physicallyExists()) {
-			fail("Physical existence check returned false for existing resource: " + vfsURI);								
-		}
-	}
-	
-	
-	
-	/** 
-	 * Validate getChildren when given a VFS URI for a directory
-	 *
-	 */
-	public void testListFolderChildren() throws Exception {
-		final String testFolder = "2/mod10.1";
-		final List expectedFiles = Arrays.asList(new String[]  {"ivy-1.0.xml", 
-				                                                 "ivy-1.1.xml",
-				                                                 "ivy-1.2.xml",
-				                                                 "ivy-1.3.xml"});
-		
-		Iterator baseVfsURIs = helper.createVFSUriSet(testFolder).iterator();
-		while(baseVfsURIs.hasNext()) {
-			VfsURI baseVfsURI = (VfsURI) baseVfsURIs.next();
-			
-			List expected = new ArrayList();
-			for (int i = 0; i < expectedFiles.size(); i++) {
-				String resId = baseVfsURI.toString() + "/" + expectedFiles.get(i);
-				expected.add(resId);
-			}
-			
-			List actual = new ArrayList();			
-			VfsResource res = new VfsResource(baseVfsURI.toString(), helper.fsManager);
-			Iterator children = res.getChildren().iterator();
-			while (children.hasNext()) {
-				String resId = (String) children.next();
-				// remove entries ending in .svn
-				if (! resId.endsWith(".svn")) {
-					actual.add(resId);
-				}
-			}
-			
-			Collections.sort(actual);
-			Collections.sort(expected);
-			if (! actual.equals(expected)) {
-				fail("\nExpected: " + expected.toString() + "\n.Actual: " + actual.toString());
-			}
-		}
-	}
-	
-	/**
-	 * Validate that we don't get any results when we query a VFSResource file object
-	 * for its children
-	 *
-	 */
-	public void testListFileChildren() throws Exception {
-		Iterator testSet = helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
-		while (testSet.hasNext()) {
-			VfsURI vfsURI = (VfsURI) testSet.next();
-			VfsResource res = new VfsResource(vfsURI.toString(), helper.fsManager);
-			List results = res.getChildren();
-			if (results.size() > 0) {
-				fail("getChildren query on file provided results when it shouldn't have");
-			}
-		}
-	}
-	
-	/**
-	 * Validate that we don't get any results if we ask an IMAGINARY VFSResource - a
-	 * nonexistent file - for a list of its children
-	 *
-	 */
-	public void testListImaginary() throws Exception {
-		Iterator testSet = helper.createVFSUriSet("idontexistzzxx").iterator();
-		while (testSet.hasNext()) {
-			VfsURI vfsURI = (VfsURI) testSet.next();
-			VfsResource res = new VfsResource(vfsURI.toString(), helper.fsManager);
-			List results = res.getChildren();
-			if (results.size() > 0) {
-				fail("getChildren query on file provided results when it shouldn't have");
-			}
-		}		
-	}
+    public VfsResourceTest() {
+        super();
+    }
+
+    public VfsResourceTest(String arg0) {
+        super(arg0);
+    }
+
+    public void setUp() throws Exception {
+        helper = new VfsTestHelper();
+    }
+
+    public void tearDown() {
+        helper = null;
+    }
+
+    /**
+     * Validate VFSResource creation for a valid VFS URI pointing to an physically existing file
+     */
+    public void testCreateResourceThatExists() throws Exception {
+        Iterator vfsURIs = helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
+        while (vfsURIs.hasNext()) {
+            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+            String resId = vfsURI.toString();
+            VfsResource res = new VfsResource(resId, helper.fsManager);
+            if (res == null) {
+                fail("Unexpected null value on VFS URI: " + resId);
+            }
+
+            if (!res.exists()) {
+                fail("Resource does not exist and it should: " + resId);
+            }
+
+            // VFS apparently does some weird normalization so that resource id used to create
+            // the VFS resource is not necessarily identical to the id returned from the getName
+            // method <sigh>. We try to work around this by transforming things into java URIs.
+            if (!new URI(resId).equals(new URI(res.getName()).normalize())) {
+                fail("Failed on getName. Expected: " + resId + ". Actual: " + res.getName());
+            }
+
+            if (res.getLastModified() == 0) {
+                fail("Expected non-null file modification date for URI: " + resId);
+            }
+
+            if (res.getContentLength() == 0) {
+                fail("Expected non-zero file length for URI: " + resId);
+            }
+
+            if (!res.physicallyExists()) {
+                fail("Physical existence check returned false for existing resource: " + resId);
+            }
+        }
+    }
+
+    /**
+     * Validating that resource can be created for files which don't physically exists - e.g.
+     * resources that are going to created.
+     */
+    public void testCreateResourceThatDoesntExist() throws Exception {
+        Iterator vfsURIs = helper.createVFSUriSet("zzyyxx.zzyyxx").iterator();
+        while (vfsURIs.hasNext()) {
+            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+            String resId = vfsURI.toString();
+            VfsResource res = new VfsResource(resId, helper.fsManager);
+            if (res == null) {
+                fail("Unexpected null value on VFS URI: " + resId);
+            }
+
+            if (res.exists()) {
+                fail("Resource does not exist and it shouldn't: " + resId);
+            }
+
+            // VFS apparently does some weird normalization so that resource id used to create
+            // the VFS resource is not necessarily identical to the id returned from the getName
+            // method <sigh>. We try to work around this by transforming things into java URIs.
+            if (!new URI(resId).equals(new URI(res.getName()).normalize())) {
+                fail("Failed on getName. Expected: " + resId + ". Actual: " + res.getName());
+            }
+
+            if (res.getLastModified() != 0) {
+                fail("Expected null file modification date for URI: " + resId + ": "
+                        + res.getLastModified());
+            }
+
+            if (res.getContentLength() != 0) {
+                fail("Expected non-zero file length for URI: " + resId);
+            }
+
+            if (res.physicallyExists()) {
+                fail("Physical existence check returned true for non-existent resource: " + resId);
+            }
+        }
+    }
+
+    /**
+     * Validate VFSResource creation when given a poorly formed VFS identifier
+     */
+    public void testBadURI() throws Exception {
+        String vfsURI = "smb1:/goobeldygook";
+        VfsResource res = new VfsResource(vfsURI, helper.fsManager);
+
+        if (res == null) {
+            fail("Unexpected null value on VFS URI: " + vfsURI);
+        }
+
+        if (res.exists()) {
+            fail("Resource is marked as existing and it should not: " + vfsURI);
+        }
+
+        if (!res.getName().equals("smb1:/goobeldygook")) {
+            fail("Failed on getName. Expected: " + vfsURI + ". Actual: " + res.getName());
+        }
+
+        if (res.getLastModified() != 0) {
+            fail("Expected null file modification date for URI: " + vfsURI + ": "
+                    + res.getLastModified());
+        }
+
+        if (res.getContentLength() != 0) {
+            fail("Expected zero file length for URI: " + vfsURI);
+        }
+
+        if (res.physicallyExists()) {
+            fail("Physical existence check returned false for existing resource: " + vfsURI);
+        }
+    }
+
+    /**
+     * Validate getChildren when given a VFS URI for a directory
+     */
+    public void testListFolderChildren() throws Exception {
+        final String testFolder = "2/mod10.1";
+        final List expectedFiles = Arrays.asList(new String[] {"ivy-1.0.xml", "ivy-1.1.xml",
+                "ivy-1.2.xml", "ivy-1.3.xml"});
+
+        Iterator baseVfsURIs = helper.createVFSUriSet(testFolder).iterator();
+        while (baseVfsURIs.hasNext()) {
+            VfsURI baseVfsURI = (VfsURI) baseVfsURIs.next();
+
+            List expected = new ArrayList();
+            for (int i = 0; i < expectedFiles.size(); i++) {
+                String resId = baseVfsURI.toString() + "/" + expectedFiles.get(i);
+                expected.add(resId);
+            }
+
+            List actual = new ArrayList();
+            VfsResource res = new VfsResource(baseVfsURI.toString(), helper.fsManager);
+            Iterator children = res.getChildren().iterator();
+            while (children.hasNext()) {
+                String resId = (String) children.next();
+                // remove entries ending in .svn
+                if (!resId.endsWith(".svn")) {
+                    actual.add(resId);
+                }
+            }
+
+            Collections.sort(actual);
+            Collections.sort(expected);
+            if (!actual.equals(expected)) {
+                fail("\nExpected: " + expected.toString() + "\n.Actual: " + actual.toString());
+            }
+        }
+    }
+
+    /**
+     * Validate that we don't get any results when we query a VFSResource file object for its
+     * children
+     */
+    public void testListFileChildren() throws Exception {
+        Iterator testSet = helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
+        while (testSet.hasNext()) {
+            VfsURI vfsURI = (VfsURI) testSet.next();
+            VfsResource res = new VfsResource(vfsURI.toString(), helper.fsManager);
+            List results = res.getChildren();
+            if (results.size() > 0) {
+                fail("getChildren query on file provided results when it shouldn't have");
+            }
+        }
+    }
+
+    /**
+     * Validate that we don't get any results if we ask an IMAGINARY VFSResource - a nonexistent
+     * file - for a list of its children
+     */
+    public void testListImaginary() throws Exception {
+        Iterator testSet = helper.createVFSUriSet("idontexistzzxx").iterator();
+        while (testSet.hasNext()) {
+            VfsURI vfsURI = (VfsURI) testSet.next();
+            VfsResource res = new VfsResource(vfsURI.toString(), helper.fsManager);
+            List results = res.getChildren();
+            if (results.size() > 0) {
+                fail("getChildren query on file provided results when it shouldn't have");
+            }
+        }
+    }
 }
-

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java Tue Jun  5 05:02:27 2007
@@ -26,62 +26,65 @@
 import org.apache.ivy.Ivy;
 import org.apache.ivy.util.FileUtil;
 
-
 public class VfsTestHelper {
-	private Ivy ivy = null;
-	public StandardFileSystemManager fsManager = null;
-	final static public String VFS_CONF = "ivy_vfs.xml";
-	
-	// Ivy Variables
-	static final public String PROP_VFS_HOST = "vfs.host";
-	static final public String PROP_VFS_SAMBA_REPO = "vfs.samba.share";
-	static final public String PROP_VFS_USER_ID = "vfs.user";
-	static final public String PROP_VFS_USER_PASSWD = "vfs.passwd";
-	
-	// Resources
-	static final public String CWD = System.getProperty("user.dir");
-	static final public String TEST_REPO_DIR = "test/repositories";
-	static final private String IVY_CONFIG_FILE = 
-		FileUtil.concat(TEST_REPO_DIR, "ivysettings.xml");
-	static final public String TEST_IVY_XML = "2/mod5.1/ivy-4.2.xml";
-	static final public String SCRATCH_DIR = "_vfsScratchArea";
-
-	
-	public VfsTestHelper() throws Exception {
-		// setup and initialize VFS
-		fsManager = new StandardFileSystemManager() {
-			protected void configurePlugins() throws FileSystemException {
-				// disable automatic loading potential unsupported extensions 
-			}
-		};
-		fsManager.setConfiguration(getClass().getResource(VFS_CONF).toString());
-		fsManager.init();
-		
-		// setup and initialize ivy
-		ivy = new Ivy();
-		ivy.configure(new File(IVY_CONFIG_FILE));
-	}
-
-	/**
-	 * Generate a set of well-formed VFS resource identifiers
-	 * 
-	 * @param resource name of the resource
-	 * @return <class>List</class> of well-formed VFS reosurce identifiers
-	 */
-	public List createVFSUriSet(String resource) {
-		List set = new ArrayList();
-		for (int i = 0; i < VfsURI.SUPPORTED_SCHEMES.length; i++) {
-			set.add(VfsURI.vfsURIFactory(VfsURI.SUPPORTED_SCHEMES[i], 
-					                        resource,
-					                        ivy));			
-		}	
-		return set;
-	}
-	
-	
-	public Ivy getIvy() {
-		return ivy;
-	}
-	
+    private Ivy ivy = null;
+
+    public StandardFileSystemManager fsManager = null;
+
+    final static public String VFS_CONF = "ivy_vfs.xml";
+
+    // Ivy Variables
+    static final public String PROP_VFS_HOST = "vfs.host";
+
+    static final public String PROP_VFS_SAMBA_REPO = "vfs.samba.share";
+
+    static final public String PROP_VFS_USER_ID = "vfs.user";
+
+    static final public String PROP_VFS_USER_PASSWD = "vfs.passwd";
+
+    // Resources
+    static final public String CWD = System.getProperty("user.dir");
+
+    static final public String TEST_REPO_DIR = "test/repositories";
+
+    static final private String IVY_CONFIG_FILE = FileUtil.concat(TEST_REPO_DIR, "ivysettings.xml");
+
+    static final public String TEST_IVY_XML = "2/mod5.1/ivy-4.2.xml";
+
+    static final public String SCRATCH_DIR = "_vfsScratchArea";
+
+    public VfsTestHelper() throws Exception {
+        // setup and initialize VFS
+        fsManager = new StandardFileSystemManager() {
+            protected void configurePlugins() throws FileSystemException {
+                // disable automatic loading potential unsupported extensions
+            }
+        };
+        fsManager.setConfiguration(getClass().getResource(VFS_CONF).toString());
+        fsManager.init();
+
+        // setup and initialize ivy
+        ivy = new Ivy();
+        ivy.configure(new File(IVY_CONFIG_FILE));
+    }
+
+    /**
+     * Generate a set of well-formed VFS resource identifiers
+     * 
+     * @param resource
+     *            name of the resource
+     * @return <class>List</class> of well-formed VFS reosurce identifiers
+     */
+    public List createVFSUriSet(String resource) {
+        List set = new ArrayList();
+        for (int i = 0; i < VfsURI.SUPPORTED_SCHEMES.length; i++) {
+            set.add(VfsURI.vfsURIFactory(VfsURI.SUPPORTED_SCHEMES[i], resource, ivy));
+        }
+        return set;
+    }
+
+    public Ivy getIvy() {
+        return ivy;
+    }
 
 }

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsURI.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsURI.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsURI.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/repository/vfs/VfsURI.java Tue Jun  5 05:02:27 2007
@@ -20,151 +20,163 @@
 import org.apache.ivy.Ivy;
 
 public class VfsURI {
-	private String host;
-	private String passwd;
-	private String path;
-	private String scheme;
-	private String user;		
-
-	// VFS Schemes
-	static final public String SCHEME_CIFS = "smb";
-	static final public String SCHEME_FILE = "file";
-	static final public String SCHEME_FTP = "ftp";
-	static final public String SCHEME_HTTP = "http";
-	static final public String SCHEME_HTTPS = "https";
-	static final public String SCHEME_SFTP = "sftp";
-	static final public String SCHEME_WEBDAV = "webdav";
-	static final public String[] SUPPORTED_SCHEMES = new String[] {
-        // add other schemes here if other can be tested on your machine
-			SCHEME_FILE,
-	};
-
-	/**
-	 * Create a set of valid VFS URIs for the file access protocol
-	 * 
-	 * @param resourcePath relative path (from the base repo) to the resource to be accessed
-	 * @return
-	 */	
-	static public VfsURI vfsURIFactory(String scheme, String resource, Ivy ivy) {
-		VfsURI vfsURI = null;
-		if (scheme.equals(SCHEME_CIFS)) {
-			vfsURI = new VfsURI(SCHEME_CIFS, 
-					        ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID), 
-					        ivy.getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD),
-					        ivy.getVariable(VfsTestHelper.PROP_VFS_HOST),
-					        ivy.getVariable(VfsTestHelper.PROP_VFS_SAMBA_REPO) + "/" + resource);
-		} else if (scheme.equals(SCHEME_FILE)) {
-			vfsURI = new VfsURI(SCHEME_FILE, 
-					         null, 
-					         null, 
-					         null, 
-					         VfsTestHelper.CWD + "/" + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
-		}  else if (scheme.equals(SCHEME_FTP)) {
-			vfsURI = new VfsURI(SCHEME_FTP, 
-			        		 ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID), 
-			        		 ivy.getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD),
-					         ivy.getVariable(VfsTestHelper.PROP_VFS_HOST),
-					         VfsTestHelper.CWD + "/" + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
-		} else if (scheme.equals(SCHEME_SFTP)) {			
-			vfsURI = new VfsURI(SCHEME_SFTP, 
-					      ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID),
-					      ivy.getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD),
-					      ivy.getVariable(VfsTestHelper.PROP_VFS_HOST),
-					      VfsTestHelper.CWD + "/" + VfsTestHelper.TEST_REPO_DIR + "/" + resource) ;
-		}
-		return vfsURI;
-	}
-	
-	/**
-	 * Create a wellformed VFS resource identifier
-	 * 
-	 * @param scheme the name of the scheme used to acces the resource
-	 * @param user a user name. May be <code>null</code>
-	 * @param passwd a passwd. May be <code>null</code>
-	 * @param host a host identifier. May be <code>null</code>
-	 * @param path a scheme spacific path to a resource
-	 */
-	public VfsURI(String scheme, String user, String passwd, String host, String path) {
-		this.scheme = scheme.trim();
-		
-		if (user != null) {
-			this.user = user.trim();
-		} else {
-			this.user = null;
-		}
-		
-		if (passwd != null) {
-			this.passwd = passwd.trim();
-		} else {
-			this.passwd = null;
-		}
-		
-		if (host != null) {
-			this.host = host.trim();
-		} else {
-			this.host = null;
-		}
-		
-		this.path = normalizePath(path);
-	}
-	
-	/**
-	 * Return a well-formed VFS Resource identifier
-	 * 
-	 * @return <code>String<code> representing a well formed VFS resource identifier
-	 */
-	public String getVfsURI() {
-		StringBuffer uri = new StringBuffer();
-		uri.append(this.scheme + "://");
-		
-		// not all resource identifiers include user/passwd specifiers
-		if (user != null && user.trim().length() > 0) {
-			uri.append(this.user + ":");
-			
-			if (passwd != null && passwd.trim().length() > 0) {
-				this.passwd = passwd.trim();
-			} else {
-				this.passwd = "";
-			}
-			uri.append(this.passwd + "@");
-		}
-		
-		// not all resource identifiers include a host specifier
-		if (host != null && host.trim().length() > 0) {
-			this.host = host.trim();
-			uri.append(this.host);
-		}
-
-		uri.append(this.path);
-		return uri.toString();
-	}
-
-	/**
-	 * Convert a resource path to the format required for a VFS resource identifier
-	 * 
-	 * @param path <code>String</code> path to the resource
-	 * @return <code>String</code> representing a normalized resource path
-	 */
-	private String normalizePath(String path) {
-		// all backslashes replaced with forward slashes
-		String normalizedPath = path.replaceAll("\\\\", "/");
-		
-		// collapse multiple instance of forward slashes to single slashes 
-		normalizedPath = normalizedPath.replaceAll("//+", "/");
-		
-		// ensure that our path starts with a forward slash
-		if(! normalizedPath.startsWith("/")) {
-			normalizedPath = "/" + normalizedPath;
-		}
-		
-		return normalizedPath.trim();
-	}
-
-	public String toString() {
-		return getVfsURI();
-	}
-	
-	public String getScheme() {
-		return scheme;
-	}
+    private String host;
+
+    private String passwd;
+
+    private String path;
+
+    private String scheme;
+
+    private String user;
+
+    // VFS Schemes
+    static final public String SCHEME_CIFS = "smb";
+
+    static final public String SCHEME_FILE = "file";
+
+    static final public String SCHEME_FTP = "ftp";
+
+    static final public String SCHEME_HTTP = "http";
+
+    static final public String SCHEME_HTTPS = "https";
+
+    static final public String SCHEME_SFTP = "sftp";
+
+    static final public String SCHEME_WEBDAV = "webdav";
+
+    static final public String[] SUPPORTED_SCHEMES = new String[] {
+    // add other schemes here if other can be tested on your machine
+    SCHEME_FILE,};
+
+    /**
+     * Create a set of valid VFS URIs for the file access protocol
+     * 
+     * @param resourcePath
+     *            relative path (from the base repo) to the resource to be accessed
+     * @return
+     */
+    static public VfsURI vfsURIFactory(String scheme, String resource, Ivy ivy) {
+        VfsURI vfsURI = null;
+        if (scheme.equals(SCHEME_CIFS)) {
+            vfsURI = new VfsURI(SCHEME_CIFS, ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID), ivy
+                    .getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD), ivy
+                    .getVariable(VfsTestHelper.PROP_VFS_HOST), ivy
+                    .getVariable(VfsTestHelper.PROP_VFS_SAMBA_REPO)
+                    + "/" + resource);
+        } else if (scheme.equals(SCHEME_FILE)) {
+            vfsURI = new VfsURI(SCHEME_FILE, null, null, null, VfsTestHelper.CWD + "/"
+                    + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
+        } else if (scheme.equals(SCHEME_FTP)) {
+            vfsURI = new VfsURI(SCHEME_FTP, ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID), ivy
+                    .getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD), ivy
+                    .getVariable(VfsTestHelper.PROP_VFS_HOST), VfsTestHelper.CWD + "/"
+                    + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
+        } else if (scheme.equals(SCHEME_SFTP)) {
+            vfsURI = new VfsURI(SCHEME_SFTP, ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID), ivy
+                    .getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD), ivy
+                    .getVariable(VfsTestHelper.PROP_VFS_HOST), VfsTestHelper.CWD + "/"
+                    + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
+        }
+        return vfsURI;
+    }
+
+    /**
+     * Create a wellformed VFS resource identifier
+     * 
+     * @param scheme
+     *            the name of the scheme used to acces the resource
+     * @param user
+     *            a user name. May be <code>null</code>
+     * @param passwd
+     *            a passwd. May be <code>null</code>
+     * @param host
+     *            a host identifier. May be <code>null</code>
+     * @param path
+     *            a scheme spacific path to a resource
+     */
+    public VfsURI(String scheme, String user, String passwd, String host, String path) {
+        this.scheme = scheme.trim();
+
+        if (user != null) {
+            this.user = user.trim();
+        } else {
+            this.user = null;
+        }
+
+        if (passwd != null) {
+            this.passwd = passwd.trim();
+        } else {
+            this.passwd = null;
+        }
+
+        if (host != null) {
+            this.host = host.trim();
+        } else {
+            this.host = null;
+        }
+
+        this.path = normalizePath(path);
+    }
+
+    /**
+     * Return a well-formed VFS Resource identifier
+     * 
+     * @return <code>String<code> representing a well formed VFS resource identifier
+     */
+    public String getVfsURI() {
+        StringBuffer uri = new StringBuffer();
+        uri.append(this.scheme + "://");
+
+        // not all resource identifiers include user/passwd specifiers
+        if (user != null && user.trim().length() > 0) {
+            uri.append(this.user + ":");
+
+            if (passwd != null && passwd.trim().length() > 0) {
+                this.passwd = passwd.trim();
+            } else {
+                this.passwd = "";
+            }
+            uri.append(this.passwd + "@");
+        }
+
+        // not all resource identifiers include a host specifier
+        if (host != null && host.trim().length() > 0) {
+            this.host = host.trim();
+            uri.append(this.host);
+        }
+
+        uri.append(this.path);
+        return uri.toString();
+    }
+
+    /**
+     * Convert a resource path to the format required for a VFS resource identifier
+     * 
+     * @param path
+     *            <code>String</code> path to the resource
+     * @return <code>String</code> representing a normalized resource path
+     */
+    private String normalizePath(String path) {
+        // all backslashes replaced with forward slashes
+        String normalizedPath = path.replaceAll("\\\\", "/");
+
+        // collapse multiple instance of forward slashes to single slashes
+        normalizedPath = normalizedPath.replaceAll("//+", "/");
+
+        // ensure that our path starts with a forward slash
+        if (!normalizedPath.startsWith("/")) {
+            normalizedPath = "/" + normalizedPath;
+        }
+
+        return normalizedPath.trim();
+    }
+
+    public String toString() {
+        return getVfsURI();
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
 }

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java Tue Jun  5 05:02:27 2007
@@ -46,67 +46,71 @@
  */
 public class ChainResolverTest extends TestCase {
     private IvySettings _settings;
+
     private ResolveEngine _engine;
+
     private ResolveData _data;
+
     private File _cache;
-    
+
     protected void setUp() throws Exception {
         _settings = new IvySettings();
         _engine = new ResolveEngine(_settings, new EventManager(), new SortEngine(_settings));
         _cache = new File("build/cache");
-        _data = new ResolveData(_engine, new ResolveOptions().setCache(CacheManager.getInstance(_settings, _cache)));
+        _data = new ResolveData(_engine, new ResolveOptions().setCache(CacheManager.getInstance(
+            _settings, _cache)));
         _cache.mkdirs();
         _settings.setDefaultCache(_cache);
     }
-    
+
     protected void tearDown() throws Exception {
         Delete del = new Delete();
         del.setProject(new Project());
         del.setDir(_cache);
         del.execute();
     }
-    
+
     public void testOrderFromConf() throws Exception {
-        new XmlSettingsParser(_settings).parse(ChainResolverTest.class.getResource("chainresolverconf.xml"));
+        new XmlSettingsParser(_settings).parse(ChainResolverTest.class
+                .getResource("chainresolverconf.xml"));
         DependencyResolver resolver = _settings.getResolver("chain");
         assertNotNull(resolver);
         assertTrue(resolver instanceof ChainResolver);
-        ChainResolver chain = (ChainResolver)resolver;
+        ChainResolver chain = (ChainResolver) resolver;
         assertResolversSizeAndNames(chain, 3);
     }
 
     private void assertResolversSizeAndNames(ChainResolver chain, int size) {
         List resolvers = chain.getResolvers();
         assertEquals(size, resolvers.size());
-        for (int i=0; i < resolvers.size(); i++) {
-            DependencyResolver r = (DependencyResolver)resolvers.get(i);
-            assertEquals(String.valueOf(i+1), r.getName());
+        for (int i = 0; i < resolvers.size(); i++) {
+            DependencyResolver r = (DependencyResolver) resolvers.get(i);
+            assertEquals(String.valueOf(i + 1), r.getName());
         }
     }
-    
+
     public void testName() throws Exception {
         ChainResolver chain = new ChainResolver();
         chain.setSettings(_settings);
         chain.setName("chain");
         assertEquals("chain", chain.getName());
     }
-    
+
     public void testResolveOrder() throws Exception {
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
         MockResolver[] resolvers = new MockResolver[] {
-                MockResolver.buildMockResolver("1", false, null), 
-                MockResolver.buildMockResolver("2", true, null), 
-                MockResolver.buildMockResolver("3", true, null)
-            };
+                MockResolver.buildMockResolver("1", false, null),
+                MockResolver.buildMockResolver("2", true, null),
+                MockResolver.buildMockResolver("3", true, null)};
         for (int i = 0; i < resolvers.length; i++) {
             chain.add(resolvers[i]);
         }
         assertResolversSizeAndNames(chain, resolvers.length);
-        
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org","mod", "rev"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org", "mod", "rev"), false);
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("2", rmr.getResolver().getName());
@@ -114,27 +118,30 @@
         assertEquals(Arrays.asList(new DependencyDescriptor[] {dd}), resolvers[1].askedDeps);
         assertTrue(resolvers[2].askedDeps.isEmpty());
     }
-    
+
     public void testLatestTimeResolve() throws Exception {
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
         chain.setLatestStrategy(new LatestTimeStrategy());
         MockResolver[] resolvers = new MockResolver[] {
-                MockResolver.buildMockResolver("1", true, new GregorianCalendar(2005, 1, 20).getTime()), 
-                MockResolver.buildMockResolver("2", false, null), 
-                MockResolver.buildMockResolver("3", true, new GregorianCalendar(2005, 1, 25).getTime()), // younger -> should the one kept 
-                MockResolver.buildMockResolver("4", false, null), 
-                MockResolver.buildMockResolver("5", true, new GregorianCalendar(2005, 1, 22).getTime()),
-                MockResolver.buildMockResolver("6", true, new GregorianCalendar(2005, 1, 18).getTime()),
-                MockResolver.buildMockResolver("7", false, null)
-            };
+                MockResolver.buildMockResolver("1", true, new GregorianCalendar(2005, 1, 20)
+                        .getTime()),
+                MockResolver.buildMockResolver("2", false, null),
+                MockResolver.buildMockResolver("3", true, new GregorianCalendar(2005, 1, 25)
+                        .getTime()), // younger -> should the one kept
+                MockResolver.buildMockResolver("4", false, null),
+                MockResolver.buildMockResolver("5", true, new GregorianCalendar(2005, 1, 22)
+                        .getTime()),
+                MockResolver.buildMockResolver("6", true, new GregorianCalendar(2005, 1, 18)
+                        .getTime()), MockResolver.buildMockResolver("7", false, null)};
         for (int i = 0; i < resolvers.length; i++) {
             chain.add(resolvers[i]);
         }
         assertResolversSizeAndNames(chain, resolvers.length);
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org","mod", "latest.integration"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org", "mod", "latest.integration"), false);
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("3", rmr.getResolver().getName());
@@ -143,27 +150,33 @@
             assertEquals(ddAsList, resolvers[i].askedDeps);
         }
     }
-    
+
     public void testLatestRevisionResolve() throws Exception {
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
         chain.setLatestStrategy(new LatestRevisionStrategy());
         MockResolver[] resolvers = new MockResolver[] {
-                MockResolver.buildMockResolver("1", true, ModuleRevisionId.newInstance("org", "mod", "1"), new GregorianCalendar(2005, 1, 20).getTime()), 
-                MockResolver.buildMockResolver("2", false, null), 
-                MockResolver.buildMockResolver("3", true, ModuleRevisionId.newInstance("org", "mod", "2"), new GregorianCalendar(2005, 1, 25).getTime()),
-                MockResolver.buildMockResolver("4", false, null), 
-                MockResolver.buildMockResolver("5", true, ModuleRevisionId.newInstance("org", "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime()), // latest -> should the one kept 
-                MockResolver.buildMockResolver("6", true, ModuleRevisionId.newInstance("org", "mod", "3"), new GregorianCalendar(2005, 1, 18).getTime()),
-                MockResolver.buildMockResolver("7", false, null)
-            };
+                MockResolver.buildMockResolver("1", true, ModuleRevisionId.newInstance("org",
+                    "mod", "1"), new GregorianCalendar(2005, 1, 20).getTime()),
+                MockResolver.buildMockResolver("2", false, null),
+                MockResolver.buildMockResolver("3", true, ModuleRevisionId.newInstance("org",
+                    "mod", "2"), new GregorianCalendar(2005, 1, 25).getTime()),
+                MockResolver.buildMockResolver("4", false, null),
+                MockResolver.buildMockResolver("5", true, ModuleRevisionId.newInstance("org",
+                    "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime()), // latest ->
+                // should the
+                // one kept
+                MockResolver.buildMockResolver("6", true, ModuleRevisionId.newInstance("org",
+                    "mod", "3"), new GregorianCalendar(2005, 1, 18).getTime()),
+                MockResolver.buildMockResolver("7", false, null)};
         for (int i = 0; i < resolvers.length; i++) {
             chain.add(resolvers[i]);
         }
         assertResolversSizeAndNames(chain, resolvers.length);
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org","mod", "latest.integration"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org", "mod", "latest.integration"), false);
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("5", rmr.getResolver().getName());
@@ -172,27 +185,34 @@
             assertEquals(ddAsList, resolvers[i].askedDeps);
         }
     }
-    
+
     public void testWithDefault() throws Exception {
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
         chain.setLatestStrategy(new LatestRevisionStrategy());
         MockResolver[] resolvers = new MockResolver[] {
-                MockResolver.buildMockResolver("1", false, null), 
-                MockResolver.buildMockResolver("2", true, ModuleRevisionId.newInstance("org", "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime(), true), // latest -> but default 
+                MockResolver.buildMockResolver("1", false, null),
+                MockResolver.buildMockResolver("2", true, ModuleRevisionId.newInstance("org",
+                    "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime(), true), // latest
+                // ->
+                // but
+                // default
                 MockResolver.buildMockResolver("3", false, null),
-                MockResolver.buildMockResolver("4", false, null), 
-                MockResolver.buildMockResolver("5", true, ModuleRevisionId.newInstance("org", "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime()), // latest -> should the one kept 
+                MockResolver.buildMockResolver("4", false, null),
+                MockResolver.buildMockResolver("5", true, ModuleRevisionId.newInstance("org",
+                    "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime()), // latest ->
+                // should the
+                // one kept
                 MockResolver.buildMockResolver("6", false, null),
-                MockResolver.buildMockResolver("7", false, null)
-            };
+                MockResolver.buildMockResolver("7", false, null)};
         for (int i = 0; i < resolvers.length; i++) {
             chain.add(resolvers[i]);
         }
         assertResolversSizeAndNames(chain, resolvers.length);
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org","mod", "4"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org", "mod", "4"), false);
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("5", rmr.getResolver().getName());
@@ -204,27 +224,37 @@
             assertTrue(resolvers[i].askedDeps.isEmpty());
         }
     }
-    
+
     public void testLatestWithDefault() throws Exception {
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
         chain.setLatestStrategy(new LatestRevisionStrategy());
         MockResolver[] resolvers = new MockResolver[] {
-                MockResolver.buildMockResolver("1", true, ModuleRevisionId.newInstance("org", "mod", "1"), new GregorianCalendar(2005, 1, 20).getTime()), 
-                MockResolver.buildMockResolver("2", true, ModuleRevisionId.newInstance("org", "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime(), true), // latest -> but default 
-                MockResolver.buildMockResolver("3", true, ModuleRevisionId.newInstance("org", "mod", "2"), new GregorianCalendar(2005, 1, 25).getTime()),
-                MockResolver.buildMockResolver("4", false, null), 
-                MockResolver.buildMockResolver("5", true, ModuleRevisionId.newInstance("org", "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime()), // latest -> should the one kept 
-                MockResolver.buildMockResolver("6", true, ModuleRevisionId.newInstance("org", "mod", "3"), new GregorianCalendar(2005, 1, 18).getTime()),
-                MockResolver.buildMockResolver("7", false, null)
-            };
+                MockResolver.buildMockResolver("1", true, ModuleRevisionId.newInstance("org",
+                    "mod", "1"), new GregorianCalendar(2005, 1, 20).getTime()),
+                MockResolver.buildMockResolver("2", true, ModuleRevisionId.newInstance("org",
+                    "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime(), true), // latest
+                // ->
+                // but
+                // default
+                MockResolver.buildMockResolver("3", true, ModuleRevisionId.newInstance("org",
+                    "mod", "2"), new GregorianCalendar(2005, 1, 25).getTime()),
+                MockResolver.buildMockResolver("4", false, null),
+                MockResolver.buildMockResolver("5", true, ModuleRevisionId.newInstance("org",
+                    "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime()), // latest ->
+                // should the
+                // one kept
+                MockResolver.buildMockResolver("6", true, ModuleRevisionId.newInstance("org",
+                    "mod", "3"), new GregorianCalendar(2005, 1, 18).getTime()),
+                MockResolver.buildMockResolver("7", false, null)};
         for (int i = 0; i < resolvers.length; i++) {
             chain.add(resolvers[i]);
         }
         assertResolversSizeAndNames(chain, resolvers.length);
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org","mod", "latest.integration"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org", "mod", "latest.integration"), false);
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("5", rmr.getResolver().getName());
@@ -233,88 +263,102 @@
             assertEquals(ddAsList, resolvers[i].askedDeps);
         }
     }
-    
+
     public void testFixedWithDefault() throws Exception {
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
         chain.setLatestStrategy(new LatestRevisionStrategy());
         MockResolver[] resolvers = new MockResolver[] {
-                MockResolver.buildMockResolver("1", false, null), 
-                MockResolver.buildMockResolver("2", true, ModuleRevisionId.newInstance("org", "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime(), true), // default 
-                MockResolver.buildMockResolver("3", false, null), 
-                MockResolver.buildMockResolver("4", true, ModuleRevisionId.newInstance("org", "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime()), // not default -> should the one kept 
-                MockResolver.buildMockResolver("5", false, null)
-            };
+                MockResolver.buildMockResolver("1", false, null),
+                MockResolver.buildMockResolver("2", true, ModuleRevisionId.newInstance("org",
+                    "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime(), true), // default
+                MockResolver.buildMockResolver("3", false, null),
+                MockResolver.buildMockResolver("4", true, ModuleRevisionId.newInstance("org",
+                    "mod", "4"), new GregorianCalendar(2005, 1, 22).getTime()), // not default
+                // -> should the
+                // one kept
+                MockResolver.buildMockResolver("5", false, null)};
         for (int i = 0; i < resolvers.length; i++) {
             chain.add(resolvers[i]);
         }
         assertResolversSizeAndNames(chain, resolvers.length);
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org","mod", "4"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org", "mod", "4"), false);
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("4", rmr.getResolver().getName());
         List ddAsList = Arrays.asList(new DependencyDescriptor[] {dd});
         for (int i = 0; i < 4; i++) {
-            assertEquals("invalid asked dependencies for "+resolvers[i], ddAsList, resolvers[i].askedDeps);
+            assertEquals("invalid asked dependencies for " + resolvers[i], ddAsList,
+                resolvers[i].askedDeps);
         }
         for (int i = 4; i < resolvers.length; i++) {
-            assertTrue("invalid asked dependencies for "+resolvers[i], resolvers[i].askedDeps.isEmpty());
+            assertTrue("invalid asked dependencies for " + resolvers[i], resolvers[i].askedDeps
+                    .isEmpty());
         }
     }
-    
+
     public void testFixedWithDefaultAndRealResolver() throws Exception {
         // test case for IVY-206
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
-        
+
         // no ivy pattern for first resolver: will only find a 'default' module
         FileSystemResolver resolver = new FileSystemResolver();
         resolver.setName("1");
         resolver.setSettings(_settings);
-        
-        resolver.addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
+
+        resolver
+                .addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
         chain.add(resolver);
-        
-        // second resolver has an ivy pattern and will thus find the real module, which should be kept
+
+        // second resolver has an ivy pattern and will thus find the real module, which should be
+        // kept
         resolver = new FileSystemResolver();
         resolver.setName("2");
         resolver.setSettings(_settings);
-        
-        resolver.addIvyPattern("test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml");
-        resolver.addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
+
+        resolver
+                .addIvyPattern("test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml");
+        resolver
+                .addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
         chain.add(resolver);
-        
+
         _settings.addResolver(chain);
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org1","mod1.1", "1.0"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org1", "mod1.1", "1.0"), false);
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("2", rmr.getResolver().getName());
     }
-    
+
     public void testReturnFirst() throws Exception {
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
         chain.setReturnFirst(true);
         MockResolver[] resolvers = new MockResolver[] {
-                MockResolver.buildMockResolver("1", true, new GregorianCalendar(2005, 1, 20).getTime()), 
-                MockResolver.buildMockResolver("2", false, null), 
-                MockResolver.buildMockResolver("3", true, new GregorianCalendar(2005, 1, 25).getTime()), // younger -> should the one kept 
-                MockResolver.buildMockResolver("4", false, null), 
-                MockResolver.buildMockResolver("5", true, new GregorianCalendar(2005, 1, 22).getTime()),
-                MockResolver.buildMockResolver("6", true, new GregorianCalendar(2005, 1, 18).getTime()),
-                MockResolver.buildMockResolver("7", false, null)
-            };
+                MockResolver.buildMockResolver("1", true, new GregorianCalendar(2005, 1, 20)
+                        .getTime()),
+                MockResolver.buildMockResolver("2", false, null),
+                MockResolver.buildMockResolver("3", true, new GregorianCalendar(2005, 1, 25)
+                        .getTime()), // younger -> should the one kept
+                MockResolver.buildMockResolver("4", false, null),
+                MockResolver.buildMockResolver("5", true, new GregorianCalendar(2005, 1, 22)
+                        .getTime()),
+                MockResolver.buildMockResolver("6", true, new GregorianCalendar(2005, 1, 18)
+                        .getTime()), MockResolver.buildMockResolver("7", false, null)};
         for (int i = 0; i < resolvers.length; i++) {
             chain.add(resolvers[i]);
         }
         assertResolversSizeAndNames(chain, resolvers.length);
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org","mod", "latest.integration"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org", "mod", "latest.integration"), false);
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("1", rmr.getResolver().getName());
@@ -322,80 +366,84 @@
             assertTrue(resolvers[i].askedDeps.isEmpty());
         }
     }
-    
+
     public void testReturnFirstWithDefaultAndCacheAndRealResolver() throws Exception {
         // test case for IVY-207
-        
+
         // 1 ---- we first do a first resolve which puts a default file in cache
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
-        
+
         // no ivy pattern for resolver: will only find a 'default' module
         FileSystemResolver resolver = new FileSystemResolver();
         resolver.setName("old");
         resolver.setSettings(_settings);
-        
-        resolver.addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
+
+        resolver
+                .addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
         chain.add(resolver);
-                
+
         _settings.addResolver(chain);
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org1","mod1.1", "1.0"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org1", "mod1.1", "1.0"), false);
         chain.getDependency(dd, _data);
-        
-        // 2 ---- now we ask to resolve dependencies with a chain in return first mode, in which the first resolver 
-        //        is not able to find the module, but the second is 
-        
+
+        // 2 ---- now we ask to resolve dependencies with a chain in return first mode, in which the
+        // first resolver
+        // is not able to find the module, but the second is
+
         chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
         chain.setReturnFirst(true);
-        
+
         // no pattern for first resolver: will not find the module
         resolver = new FileSystemResolver();
         resolver.setName("1");
         resolver.setSettings(_settings);
-        
+
         chain.add(resolver);
-        
+
         // second resolver will find the real module, which should be kept
         resolver = new FileSystemResolver();
         resolver.setName("2");
         resolver.setSettings(_settings);
-        
-        resolver.addIvyPattern("test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml");
-        resolver.addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
+
+        resolver
+                .addIvyPattern("test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml");
+        resolver
+                .addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
         chain.add(resolver);
-        
+
         _settings.addResolver(chain);
-        
+
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("2", rmr.getResolver().getName());
     }
-    
+
     public void testDual() throws Exception {
         ChainResolver chain = new ChainResolver();
         chain.setName("chain");
         chain.setSettings(_settings);
         chain.setDual(true);
         MockResolver[] resolvers = new MockResolver[] {
-                MockResolver.buildMockResolver("1", false, null), 
-                MockResolver.buildMockResolver("2", true, null), 
-                MockResolver.buildMockResolver("3", true, null)
-            };
+                MockResolver.buildMockResolver("1", false, null),
+                MockResolver.buildMockResolver("2", true, null),
+                MockResolver.buildMockResolver("3", true, null)};
         for (int i = 0; i < resolvers.length; i++) {
             chain.add(resolvers[i]);
         }
         assertResolversSizeAndNames(chain, resolvers.length);
-        
-        
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId.newInstance("org","mod", "rev"), false);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ModuleRevisionId
+                .newInstance("org", "mod", "rev"), false);
         ResolvedModuleRevision rmr = chain.getDependency(dd, _data);
         assertNotNull(rmr);
         assertEquals("2", rmr.getResolver().getName());
         assertEquals("chain", rmr.getArtifactResolver().getName());
     }
-        
+
 }