test/java/fr/jayasoft/ivy/repository/vfs/VfsResourceTest.java
/**
	 * Validating that resource can be created for files which don't physically exists - 
	 * e.g. resources that are going to created.
	 *
	 */
Validating that resource can be created for files which don't physically exists
e.g. resources that are going to created.
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);
			}
			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);								
			}
		}
	}
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 ) ; } 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 ) ; } } }
Validating that resource can be created for files which don't physically exists 
 e.g.
Validating that resource can be created for files which don ' t physically exists e . g .
// 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.