Index: test/unit/src/org/openide/loaders/FolderLookupTest.java =================================================================== RCS file: /cvs/openide/loaders/test/unit/src/org/openide/loaders/FolderLookupTest.java,v retrieving revision 1.1 diff -u -r1.1 FolderLookupTest.java --- test/unit/src/org/openide/loaders/FolderLookupTest.java 22 Apr 2005 09:05:13 -0000 1.1 +++ test/unit/src/org/openide/loaders/FolderLookupTest.java 17 May 2005 13:40:56 -0000 @@ -442,7 +442,42 @@ Repository.getDefault ().removeFileSystem (lfs); } - + + public void testRecursivity() throws Exception{ + String fsstruct [] = new String [] { + "AAA/BBB/java-lang-String.instance" //NOI18N + }; + + TestUtilHid.destroyLocalFileSystem (getName()); + FileSystem lfs = TestUtilHid.createLocalFileSystem (getWorkDir(), fsstruct); + Repository.getDefault ().addFileSystem (lfs); + + DataFolder folder = DataFolder.findFolder (lfs.findResource("/AAA")); //NOI18N + DataFolder subfolder = DataFolder.findFolder (lfs.findResource("/AAA/BBB/")); //NOI18N + + // default FolderLookup behaviour is recursive. Lookup + // is performed also on children folders + FolderLookup lkp = new FolderLookup (folder); + Object res = lkp.getLookup ().lookup (String.class); + assertNotNull ("String instance should be found although it is located in the children", res); + lkp = new FolderLookup (subfolder); + res = lkp.getLookup ().lookup (String.class); + assertNotNull ("String instance is located directly in the subfolder", res); + + + // testing non-recursive FolderLookup + /* UNCOMMENT THIS IF + * FolderLookup.folderLookup (FileObject fo, boolean recursive) + * METHOD IS IMPLEMENTED + lkp = new FolderLookup.folderLookup(folder, false); + res = lkp.getLookup ().lookup (String.class); + assertNull ("String instance should not be found, since it is located in child folder", res); + lkp = new FolderLookup.folderLookup(subfolder, false); + res = lkp.getLookup ().lookup (String.class); + assertNotNull ("String instance is located directly in the subfolder", res); + */ + + } public static class ALkp extends AbstractLookup { public InstanceContent ic;