test/java/fr/jayasoft/ivy/repository/vfs/VfsResourceTest.java
/** 
	 * Validate getChildren when given a VFS URI for a directory
	 *
	 */
Validate getChildren when given a VFS URI for a directory
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();
				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());
			}
		}
	}
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 ( ) ; 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 getChildren when given a VFS URI for a directory
Validate getChildren when given a VFS URI for a directory
// remove entries ending in .svn