test/java/fr/jayasoft/ivy/repository/vfs/VfsRepositoryTest.java
/**
	 * Validate that we put will respect a request not to overwrite an existing file
	 * 
	 * @throws Exception
	 */
Validate that we put will respect a request not to overwrite an existing file

@throws Exception
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) {
			}
		}
	}
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 ) { } } }
Validate that we put will respect a request not to overwrite an existing file
Validate that we put will respect a request not to overwrite an existing file