diff -r c06fe6e89701 core.startup/src/org/netbeans/core/startup/layers/BinaryFS.java --- a/core.startup/src/org/netbeans/core/startup/layers/BinaryFS.java Tue Jun 24 15:23:08 2008 +0200 +++ b/core.startup/src/org/netbeans/core/startup/layers/BinaryFS.java Thu Jun 26 18:51:58 2008 +0200 @@ -81,6 +81,7 @@ import org.openide.util.Enumerations; import org.openide.util.Enumerations; import org.openide.util.Exceptions; import org.openide.util.Lookup; +import org.openide.util.NbBundle; import org.openide.util.SharedClassObject; import org.openide.util.Union2; import org.openide.util.actions.SystemAction; @@ -494,6 +495,9 @@ public class BinaryFS extends FileSystem case 12: // serialvalue return decodeValue(value); + case 13: // bundle value + String[] arr = value.split("#"); + return NbBundle.getBundle(arr[0]).getObject(arr[1]); default: throw new IllegalStateException("Bad index: " + index); // NOI18N } diff -r c06fe6e89701 core.startup/src/org/netbeans/core/startup/layers/ParsingLayerCacheManager.java --- a/core.startup/src/org/netbeans/core/startup/layers/ParsingLayerCacheManager.java Tue Jun 24 15:23:08 2008 +0200 +++ b/core.startup/src/org/netbeans/core/startup/layers/ParsingLayerCacheManager.java Thu Jun 26 18:51:58 2008 +0200 @@ -80,6 +80,7 @@ abstract class ParsingLayerCacheManager private final static String[] ATTR_TYPES = { "boolvalue", + "bundlevalue", "bytevalue", "charvalue", "doublevalue", @@ -91,7 +92,7 @@ abstract class ParsingLayerCacheManager "serialvalue", "shortvalue", "stringvalue", - "urlvalue" + "urlvalue", }; private final static String DTD_1_0 = "-//NetBeans//DTD Filesystem 1.0//EN"; diff -r c06fe6e89701 core.startup/test/unit/src/org/netbeans/core/startup/layers/BinaryFSTest.java --- a/core.startup/test/unit/src/org/netbeans/core/startup/layers/BinaryFSTest.java Tue Jun 24 15:23:08 2008 +0200 +++ b/core.startup/test/unit/src/org/netbeans/core/startup/layers/BinaryFSTest.java Thu Jun 26 18:51:58 2008 +0200 @@ -41,11 +41,9 @@ package org.netbeans.core.startup.layers; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.net.URL; -import java.nio.ByteBuffer; import java.util.Arrays; import junit.framework.Test; import org.netbeans.junit.NbTestSuite; @@ -56,12 +54,14 @@ import org.openide.filesystems.FileSyste import org.openide.filesystems.FileSystemTestHid; import org.openide.filesystems.TestUtilHid; import org.openide.filesystems.XMLFileSystem; +import org.openide.filesystems.XMLFileSystemTestHid; /** * * @author Radek Matous */ -public class BinaryFSTest extends FileSystemFactoryHid { +public class BinaryFSTest extends FileSystemFactoryHid +implements XMLFileSystemTestHid.Factory { public BinaryFSTest(Test test) { super(test); } @@ -71,6 +71,7 @@ public class BinaryFSTest extends FileSy suite.addTestSuite(FileSystemTestHid.class); suite.addTestSuite(FileObjectTestHid.class); suite.addTestSuite(AttributesTestHidden.class); + suite.addTestSuite(XMLFileSystemTestHid.class); return new BinaryFSTest(suite); } @@ -88,5 +89,14 @@ public class BinaryFSTest extends FileSy String workDirProperty = System.getProperty("workdir");//NOI18N workDirProperty = (workDirProperty != null) ? workDirProperty : System.getProperty("java.io.tmpdir");//NOI18N return new File(workDirProperty); - } + } + + public FileSystem createLayerSystem(String testName, URL[] layers) throws IOException { + LayerCacheManager bm = LayerCacheManager.manager(true); + return BinaryCacheManagerTest.store(bm, Arrays.asList(layers)); + } + + public boolean setXmlUrl(FileSystem fs, URL[] layers) throws IOException { + return false; + } } diff -r c06fe6e89701 openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java --- a/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java Tue Jun 24 15:23:08 2008 +0200 +++ b/openide.filesystems/src/org/openide/filesystems/XMLMapAttr.java Thu Jun 26 18:51:58 2008 +0200 @@ -388,7 +388,7 @@ final class XMLMapAttr implements Map { // static final long serialVersionUID = -62733358015297232L; private static final String[] ALLOWED_ATTR_KEYS = { "bytevalue", "shortvalue", "intvalue", "longvalue", "floatvalue", "doublevalue", "boolvalue", "charvalue", - "stringvalue", "methodvalue", "serialvalue", "urlvalue", "newvalue" + "stringvalue", "methodvalue", "serialvalue", "urlvalue", "newvalue", "bundlevalue" }; // NOI18N private String value; private int keyIndex; @@ -865,6 +865,9 @@ final class XMLMapAttr implements Map { } else { return cls.newInstance(); } + case 13: + String[] arr = value.split("#"); + return NbBundle.getBundle(arr[0]).getObject(arr[1]); } } catch (Exception exc) { ExternalUtil.annotate(exc, "value = " + value); //NOI18N diff -r c06fe6e89701 openide.filesystems/test/unit/src/org/openide/filesystems/AttributesTestHidden.java --- a/openide.filesystems/test/unit/src/org/openide/filesystems/AttributesTestHidden.java Tue Jun 24 15:23:08 2008 +0200 +++ b/openide.filesystems/test/unit/src/org/openide/filesystems/AttributesTestHidden.java Thu Jun 26 18:51:59 2008 +0200 @@ -41,12 +41,9 @@ package org.openide.filesystems; -import junit.framework.*; -//import org.openide.filesystems.hidden.*; import java.util.*; import java.io.*; -import java.net.URL; /** * @@ -55,6 +52,7 @@ import java.net.URL; * */ public class AttributesTestHidden extends TestBaseHid { + static final String TEST_ERR = "Not the tested code, but this test contains errors"; static final String COMMON_ATTR_STRING = "testAttribute"; @@ -245,55 +243,6 @@ public class AttributesTestHidden extend assertTrue ("There was not found expected key: " + COMMON_ATTR_STRING +" in .nbattrs",content.indexOf("name=\""+COMMON_ATTR_STRING) != -1 );// } - - public void testAttribute08 () throws Exception { - URL fsURLDef = this.getClass().getResource ("data/Attributes.xml"); - assertTrue ("Cannot create XML FS for testing purposes", fsURLDef != null); - FileSystem fs = new XMLFileSystem (fsURLDef); - FileObject fo = fs.findResource("testMethodValue"); - assertTrue ("Cannot acces FileObject named testMethodValue", fo != null); - - String testName = "test1"; - Object obj = fo.getAttribute(testName); - assertTrue ("methodValue failed", obj != null); - assertTrue ("methodValue doesn't keep order ", - obj.equals(getObjectViaMethodValue1 (fo, testName))); - - testName = "test2"; - obj = fo.getAttribute(testName); - assertTrue ("methodValue failed", obj != null); - assertTrue ("methodValue doesn't keep order ", - obj.equals(getObjectViaMethodValue2 (testName, fo))); - - testName = "test3"; - obj = fo.getAttribute(testName); - assertTrue ("methodValue failed", obj != null); - assertTrue ("methodValue doesn't keep order ", - obj.equals(getObjectViaMethodValue3 (fo))); - - testName = "test4"; - obj = fo.getAttribute(testName); - assertTrue ("methodValue failed", obj != null); - assertTrue ("methodValue doesn't keep order ", - obj.equals(getObjectViaMethodValue4 (testName))); - - testName = "test5"; - obj = fo.getAttribute(testName); - assertTrue ("methodValue failed", obj != null); - assertTrue ("methodValue doesn't keep order ", - obj.equals(getObjectViaMethodValue5 ())); - - testName = "test6"; - obj = fo.getAttribute(testName); - assertTrue ("methodValue failed", obj != null); - assertEquals("even works for java.util.Map", "Ahoj1", obj); - - testName = "test7"; - obj = fo.getAttribute(testName); - assertTrue ("methodValue failed", obj != null); - assertEquals("works for map and string", "Ahoj1test7", obj); - } - public void testAttribute09 () throws IOException { assertTrue (TEST_ERR,testedFS != null); if (testedFS.isReadOnly ()) return; @@ -322,101 +271,6 @@ public class AttributesTestHidden extend } } - private static String getObjectViaMethodValue1 (FileObject fo, String testName) { - return fo.getPath()+testName; - } - - private static String getObjectViaMethodValue1 (String testName, FileObject fo) { - return testName+fo.getPath(); - } - - private static String getObjectViaMethodValue1 (FileObject fo) { - return fo.getPath(); - } - - private static String getObjectViaMethodValue1 (String testName) { - return testName; - } - - private static String getObjectViaMethodValue1 () { - return ""; - } -/// - private static String getObjectViaMethodValue2 (String testName, FileObject fo) { - return testName+fo.getPath(); - } - - private static String getObjectViaMethodValue2 (FileObject fo) { - return fo.getPath(); - } - - private static String getObjectViaMethodValue2 (String testName) { - return testName; - } - - private static String getObjectViaMethodValue2 () { - return ""; - } -/// - private static String getObjectViaMethodValue3 (FileObject fo) { - return fo.getPath(); - } - - private static String getObjectViaMethodValue3 (String testName) { - return testName; - } - - private static String getObjectViaMethodValue3 () { - return ""; - } -/// - private static String getObjectViaMethodValue4 (String testName) { - return testName; - } - - private static String getObjectViaMethodValue4 () { - return ""; - } -/// - private static String getObjectViaMethodValue5 () { - return ""; - } - - private static Object getObjectViaMethodValue6 (Map attrs) { - try { - attrs.keySet().iterator().remove(); - return "UnsupportedOperationException"; - } catch (UnsupportedOperationException ex) { - // ok - } - try { - attrs.put("value1", "nothing"); - return "UnsupportedOperationException"; - } catch (UnsupportedOperationException ex) { - // ok - } - try { - attrs.remove("value1"); - return "UnsupportedOperationException"; - } catch (UnsupportedOperationException ex) { - // ok - } - - - return attrs.get("value1"); - } - private static Object getObjectViaMethodValue7 (Map attrs, String attrName) { - assertEquals(8, attrs.keySet().size()); - try { - attrs.entrySet().remove(null); - return "UnsupportedOperationException"; - } catch (UnsupportedOperationException ex) { - // ok - } - - - return attrs.get("value1") + attrName; - } private String basicAttributeTest (String attrName, String attrValue) throws IOException { FileObject foTested = testedFS.getRoot (); diff -r c06fe6e89701 openide.filesystems/test/unit/src/org/openide/filesystems/FileSystemFactoryHid.java --- a/openide.filesystems/test/unit/src/org/openide/filesystems/FileSystemFactoryHid.java Tue Jun 24 15:23:08 2008 +0200 +++ b/openide.filesystems/test/unit/src/org/openide/filesystems/FileSystemFactoryHid.java Thu Jun 26 18:51:59 2008 +0200 @@ -45,9 +45,9 @@ import org.netbeans.junit.*; import org.netbeans.junit.*; import java.io.*; +import java.net.URL; import java.util.*; -import org.openide.filesystems.*; /** @@ -77,6 +77,27 @@ public abstract class FileSystemFactoryH * @return array of FileSystems that should be tested in test named: "testName"*/ final static FileSystem[] createFileSystem (String testName,String[] resources, Test test) throws IOException { return getInstance (test,true).createFileSystem(testName, resources); + } + + /** + * Intended to allow prepare tested environment for each individual test. + * @param testName name of test + * @return array of FileSystems that should be tested in test named: "testName"*/ + final static FileSystem createXMLSystem (String testName, Test test, URL... layers) throws IOException { + FileSystemFactoryHid factory = getInstance(test, false); + if (factory instanceof XMLFileSystemTestHid.Factory) { + XMLFileSystemTestHid.Factory f = (XMLFileSystemTestHid.Factory) factory; + return f.createLayerSystem(testName, layers); + } + throw new IllegalStateException("You need to implement XMLFileSystemTestHid.Factory to use the AttributesTestHidden!"); + } + final static boolean switchXMLSystem (FileSystem fs, Test test, URL... layers) throws IOException { + FileSystemFactoryHid factory = getInstance(test, false); + if (factory instanceof XMLFileSystemTestHid.Factory) { + XMLFileSystemTestHid.Factory f = (XMLFileSystemTestHid.Factory) factory; + return f.setXmlUrl(fs, layers); + } + throw new IllegalStateException("You need to implement XMLFileSystemTestHid.Factory to use the AttributesTestHidden!"); } final static void destroyFileSystem (String testName, Test test) throws IOException { diff -r c06fe6e89701 openide.filesystems/test/unit/src/org/openide/filesystems/LocalFileSystemTest.java --- a/openide.filesystems/test/unit/src/org/openide/filesystems/LocalFileSystemTest.java Tue Jun 24 15:23:08 2008 +0200 +++ b/openide.filesystems/test/unit/src/org/openide/filesystems/LocalFileSystemTest.java Thu Jun 26 18:51:59 2008 +0200 @@ -57,13 +57,6 @@ public class LocalFileSystemTest extends super(test); } - - public static void main(String args[]) { - junit.textui.TestRunner.run(suite()); - } - - - public static Test suite() { NbTestSuite suite = new NbTestSuite(); diff -r c06fe6e89701 openide.filesystems/test/unit/src/org/openide/filesystems/TestBaseHid.java --- a/openide.filesystems/test/unit/src/org/openide/filesystems/TestBaseHid.java Tue Jun 24 15:23:08 2008 +0200 +++ b/openide.filesystems/test/unit/src/org/openide/filesystems/TestBaseHid.java Thu Jun 26 18:51:59 2008 +0200 @@ -97,7 +97,9 @@ public abstract class TestBaseHid extend clearWorkDir(); String[] resources = getResources (getName()); resourcePrefix = FileSystemFactoryHid.getResourcePrefix(this.getName(),this, resources); - allTestedFS = FileSystemFactoryHid.createFileSystem(getName(),resources,this); + if (allTestedFS == null) { + allTestedFS = FileSystemFactoryHid.createFileSystem(getName(),resources,this); + } if (allTestedFS != null) testedFS = allTestedFS[0]; // If not null, file accesses are counted through custom SecurityManager. if(accessMonitor != null) { diff -r c06fe6e89701 openide.filesystems/test/unit/src/org/openide/filesystems/XMLFileSystemTest.java --- a/openide.filesystems/test/unit/src/org/openide/filesystems/XMLFileSystemTest.java Tue Jun 24 15:23:08 2008 +0200 +++ b/openide.filesystems/test/unit/src/org/openide/filesystems/XMLFileSystemTest.java Thu Jun 26 18:51:59 2008 +0200 @@ -41,30 +41,24 @@ package org.openide.filesystems; +import java.beans.PropertyVetoException; +import java.net.URL; import junit.framework.*; import java.io.*; -import java.util.*; -import java.util.jar.*; -import java.util.zip.*; -import java.net.*; import org.netbeans.junit.*; - -//import org.openide.filesystems.hidden.*; +import org.openide.util.Exceptions; /** * * @author rm111737 * @version */ -public class XMLFileSystemTest extends FileSystemFactoryHid { +public class XMLFileSystemTest extends FileSystemFactoryHid +implements XMLFileSystemTestHid.Factory { /** Creates new XMLFileSystemTest */ public XMLFileSystemTest(Test test) { super(test); - } - - public static void main(String args[]) { - junit.textui.TestRunner.run(suite()); } public static Test suite() { @@ -75,11 +69,32 @@ public class XMLFileSystemTest extends F return new XMLFileSystemTest(suite); } + protected void destroyFileSystem(String testName) throws IOException {} protected FileSystem[] createFileSystem(String testName, String[] resources) throws IOException{ return new FileSystem[] {TestUtilHid.createXMLFileSystem(testName, resources)}; } + + public FileSystem createLayerSystem(String testName, URL[] layers) throws IOException { + XMLFileSystem xfs = new XMLFileSystem(); + try { + xfs.setXmlUrls(layers); + } catch (PropertyVetoException ex) { + throw (IOException)new IOException().initCause(ex); + } + return xfs; + } + + public boolean setXmlUrl(org.openide.filesystems.FileSystem fs, URL[] layers) throws IOException { + XMLFileSystem xfs = (XMLFileSystem)fs; + try { + xfs.setXmlUrls(layers); + } catch (PropertyVetoException ex) { + throw (IOException)new IOException().initCause(ex); + } + return true; + } diff -r c06fe6e89701 openide.filesystems/test/unit/src/org/openide/filesystems/XMLFileSystemTestHid.java --- a/openide.filesystems/test/unit/src/org/openide/filesystems/XMLFileSystemTestHid.java Tue Jun 24 15:23:08 2008 +0200 +++ b/openide.filesystems/test/unit/src/org/openide/filesystems/XMLFileSystemTestHid.java Thu Jun 26 18:51:59 2008 +0200 @@ -47,11 +47,31 @@ import java.net.URL; import java.net.URL; import java.util.ArrayList; import java.util.List; +import java.util.Map; public class XMLFileSystemTestHid extends TestBaseHid { + /** Factory for all filesystems that want to use TCK in this class. + */ + public static interface Factory { + /** Creates a filesystem representing XML files at given URLs + * + * @param testName name of the test + * @param layers URLs of layers to parse + * @return new filesystem that represents those layers + */ + public FileSystem createLayerSystem(String testName, URL[] layers) throws IOException; + + /** Assigns new URLs to existing filesystem. + * + * @param fs the filesystem produced by {@link #createLayerSystem(java.lang.String, java.net.URL[])} + * @param layers new URLs that the filesystem shall switch to + * @return true if successful, false if this operation is not supported + */ + public boolean setXmlUrl(FileSystem fs, URL[] layers) throws IOException; + } private String[] resources = new String[] {"a/b/c"}; - XMLFileSystem xfs = null; + FileSystem xfs = null; public XMLFileSystemTestHid(String testName) { super(testName); @@ -70,21 +90,25 @@ public class XMLFileSystemTestHid extend FileChangeAdapter fcl = new FileChangeAdapter(); a.addFileChangeListener(fcl); - resources = new String[] {"a/b/c","a/b1/c"}; - xfs.setXmlUrl(createXMLLayer().toURL()); + resources = new String[] {"a/b/c","a/b1/c"}; + + if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, createXMLLayer().toURL())) { + // OK, unsupported + return; + } FileObject b1 = xfs.findResource("a/b1"); assertNotNull(b1); assertTrue(b1.isFolder()); } + @Override protected void setUp() throws Exception { + File f = createXMLLayer(); + xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURL()); + this.testedFS = xfs; + this.allTestedFS = new FileSystem[] { xfs }; super.setUp(); - - File f = createXMLLayer(); - xfs = new XMLFileSystem (); - xfs.setXmlUrl(f.toURL()); - this.testedFS = xfs; } private File createXMLLayer() throws IOException { @@ -113,13 +137,16 @@ public class XMLFileSystemTestHid extend - xfs = new XMLFileSystem (f.toURL()); + xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURL()); FileObject fo = xfs.findResource ("TestModule/sample.txt"); assertEquals ("Four bytes there", 4, fo.getSize ()); registerDefaultListener (fo); - xfs.setXmlUrl (f2.toURL ()); + if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, f2.toURL())) { + // OK, unsupported + return; + } assertEquals ("Six bytes there", 6, fo.getSize ()); @@ -149,13 +176,16 @@ public class XMLFileSystemTestHid extend - xfs = new XMLFileSystem (f.toURL()); + xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURL()); FileObject fo = xfs.findResource ("TestModule/sample.txt"); assertEquals ("Four bytes there", 4, fo.getSize ()); registerDefaultListener (fo); - xfs.setXmlUrl (f2.toURL ()); + if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, f2.toURL())) { + // OK, unsupported + return; + } assertEquals ("Six bytes there", 6, fo.getSize ()); @@ -186,13 +216,16 @@ public class XMLFileSystemTestHid extend - xfs = new XMLFileSystem (f.toURL()); + xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURL()); FileObject fo = xfs.findResource ("TestModule/sample.txt"); assertEquals("Old value is in the attribute", "old", fo.getAttribute("value")); registerDefaultListener (fo); - xfs.setXmlUrl (f2.toURL ()); + if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, f2.toURL())) { + // OK, unsupported + return; + } assertEquals("New value is in the attribute", "new", fo.getAttribute("value")); fileAttributeChangedAssert("Change in the content", 1); @@ -217,13 +250,16 @@ public class XMLFileSystemTestHid extend - xfs = new XMLFileSystem(f.toURL()); + xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURL()); FileObject fo = xfs.findResource("TestModule/sample.txt"); assertEquals("Four bytes there", 4, fo.getSize()); registerDefaultListener(fo); - xfs.setXmlUrl(f2.toURL()); + if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, f2.toURL())) { + // OK, unsupported + return; + } assertFalse("Valid no more", fo.isValid()); assertEquals("Empty now", 0, fo.getSize()); @@ -246,7 +282,7 @@ public class XMLFileSystemTestHid extend Thread.sleep(3000); assertTrue(f2.createNewFile()); } - xfs = new XMLFileSystem(f.toURL()); + xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURL()); FileObject fo = xfs.findResource ("TestModule/sample.txt"); assertNotNull(fo); assertEquals(fo.lastModified().getTime(), f.lastModified()); @@ -268,6 +304,60 @@ public class XMLFileSystemTestHid extend return f; } + + public void testAttribute08 () throws Exception { + URL fsURLDef = this.getClass().getResource ("data/Attributes.xml"); + assertTrue ("Cannot create XML FS for testing purposes", fsURLDef != null); + FileSystem fs = FileSystemFactoryHid.createXMLSystem(getName(), this, fsURLDef); + FileObject fo = fs.findResource("testMethodValue"); + assertTrue ("Cannot acces FileObject named testMethodValue", fo != null); + + String testName = "test1"; + Object obj = fo.getAttribute(testName); + assertTrue ("methodValue failed", obj != null); + assertTrue ("methodValue doesn't keep order ", + obj.equals(getObjectViaMethodValue1 (fo, testName))); + + testName = "test2"; + obj = fo.getAttribute(testName); + assertTrue ("methodValue failed", obj != null); + assertTrue ("methodValue doesn't keep order ", + obj.equals(getObjectViaMethodValue2 (testName, fo))); + + testName = "test3"; + obj = fo.getAttribute(testName); + assertTrue ("methodValue failed", obj != null); + assertTrue ("methodValue doesn't keep order ", + obj.equals(getObjectViaMethodValue3 (fo))); + + testName = "test4"; + obj = fo.getAttribute(testName); + assertTrue ("methodValue failed", obj != null); + assertTrue ("methodValue doesn't keep order ", + obj.equals(getObjectViaMethodValue4 (testName))); + + testName = "test5"; + obj = fo.getAttribute(testName); + assertTrue ("methodValue failed", obj != null); + assertTrue ("methodValue doesn't keep order ", + obj.equals(getObjectViaMethodValue5 ())); + + testName = "test6"; + obj = fo.getAttribute(testName); + assertTrue ("methodValue failed", obj != null); + assertEquals("even works for java.util.Map", "Ahoj1", obj); + + testName = "test7"; + obj = fo.getAttribute(testName); + assertTrue ("methodValue failed", obj != null); + assertEquals("works for map and string", "Ahoj1test7", obj); + + testName = "testLoc"; + obj = fo.getAttribute(testName); + assertNotNull("Value returned", obj); + assertEquals("works for bundle key", "Hello World!", obj); + } + public void testChangeOfAnAttributeInLayerIsFiredIfThereIsRealChange() throws Exception { XMLFileSystem fs = new XMLFileSystem(); @@ -333,30 +423,131 @@ public class XMLFileSystemTestHid extend public List change = new ArrayList(); + @Override public void fileRenamed(FileRenameEvent fe) { events.add(fe); } + @Override public void fileAttributeChanged(FileAttributeEvent fe) { events.add(fe); } + @Override public void fileFolderCreated(FileEvent fe) { events.add(fe); } + @Override public void fileDeleted(FileEvent fe) { events.add(fe); } + @Override public void fileDataCreated(FileEvent fe) { events.add(fe); } + @Override public void fileChanged(FileEvent fe) { change.add(fe); } } + private static String getObjectViaMethodValue1 (FileObject fo, String testName) { + return fo.getPath()+testName; + } + + private static String getObjectViaMethodValue1 (String testName, FileObject fo) { + return testName+fo.getPath(); + } + + private static String getObjectViaMethodValue1 (FileObject fo) { + return fo.getPath(); + } + + private static String getObjectViaMethodValue1 (String testName) { + return testName; + } + + private static String getObjectViaMethodValue1 () { + return ""; + } +/// + private static String getObjectViaMethodValue2 (String testName, FileObject fo) { + return testName+fo.getPath(); + } + + private static String getObjectViaMethodValue2 (FileObject fo) { + return fo.getPath(); + } + + private static String getObjectViaMethodValue2 (String testName) { + return testName; + } + + private static String getObjectViaMethodValue2 () { + return ""; + } +/// + private static String getObjectViaMethodValue3 (FileObject fo) { + return fo.getPath(); + } + + private static String getObjectViaMethodValue3 (String testName) { + return testName; + } + + private static String getObjectViaMethodValue3 () { + return ""; + } +/// + private static String getObjectViaMethodValue4 (String testName) { + return testName; + } + + private static String getObjectViaMethodValue4 () { + return ""; + } +/// + private static String getObjectViaMethodValue5 () { + return ""; + } + + private static Object getObjectViaMethodValue6 (Map attrs) { + try { + attrs.keySet().iterator().remove(); + return "UnsupportedOperationException"; + } catch (UnsupportedOperationException ex) { + // ok + } + try { + attrs.put("value1", "nothing"); + return "UnsupportedOperationException"; + } catch (UnsupportedOperationException ex) { + // ok + } + try { + attrs.remove("value1"); + return "UnsupportedOperationException"; + } catch (UnsupportedOperationException ex) { + // ok + } + + + return attrs.get("value1"); + } + private static Object getObjectViaMethodValue7 (Map attrs, String attrName) { + assertEquals(9, attrs.keySet().size()); + try { + attrs.entrySet().remove(null); + return "UnsupportedOperationException"; + } catch (UnsupportedOperationException ex) { + // ok + } + + + return attrs.get("value1") + attrName; + } } diff -r c06fe6e89701 openide.filesystems/test/unit/src/org/openide/filesystems/data/Attributes.xml --- a/openide.filesystems/test/unit/src/org/openide/filesystems/data/Attributes.xml Tue Jun 24 15:23:08 2008 +0200 +++ b/openide.filesystems/test/unit/src/org/openide/filesystems/data/Attributes.xml Thu Jun 26 18:51:59 2008 +0200 @@ -11,14 +11,14 @@ - - - - - - - - + + + + + + + + diff -r c06fe6e89701 openide.filesystems/test/unit/src/org/openide/filesystems/data/TestBundle.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openide.filesystems/test/unit/src/org/openide/filesystems/data/TestBundle.properties Thu Jun 26 18:51:59 2008 +0200 @@ -0,0 +1,39 @@ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# +# The contents of this file are subject to the terms of either the GNU +# General Public License Version 2 only ("GPL") or the Common +# Development and Distribution License("CDDL") (collectively, the +# "License"). You may not use this file except in compliance with the +# License. You can obtain a copy of the License at +# http://www.netbeans.org/cddl-gplv2.html +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the +# specific language governing permissions and limitations under the +# License. When distributing the software, include this License Header +# Notice in each file and include the License file at +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this +# particular file as subject to the "Classpath" exception as provided +# by Sun in the GPL Version 2 section of the License file that +# accompanied this code. If applicable, add the following below the +# License Header, with the fields enclosed by brackets [] replaced by +# your own identifying information: +# "Portions Copyrighted [year] [name of copyright owner]" +# +# If you wish your version of this file to be governed by only the CDDL +# or only the GPL Version 2, indicate your decision by adding +# "[Contributor] elects to include this software in this distribution +# under the [CDDL or GPL Version 2] license." If you do not indicate a +# single choice of license, a recipient has the option to distribute +# your version of this file under either the CDDL, the GPL Version 2 or +# to extend the choice of license to its licensees as provided above. +# However, if you add GPL Version 2 code and therefore, elected the GPL +# Version 2 license, then the option applies only if the new code is +# made subject to such option by the copyright holder. +# +# Contributor(s): +# +# Portions Copyrighted 2008 Sun Microsystems, Inc. + +AHOJ=Hello World! +