test/java/fr/jayasoft/ivy/repository/vfs/VfsRepositoryTest.java
/**
	 * Basic validation of happy path put - valid VFS URI and no conflict with existing file
	 * 
	 * @throws Exception
	 */
Basic validation of happy path put - valid VFS URI and no conflict with existing file

@throws Exception
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());
			}
		}
	}
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 ( ) ) ; } } }
Basic validation of happy path put - valid VFS URI and no conflict with existing file
Basic validation of happy path put - valid VFS URI and no conflict with existing file