aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2012-01-19 15:10:15 (EST)
committerDJ Houghton2012-01-19 15:10:15 (EST)
commit4765b1509deb6d118fd74bb6634664759cba551e (patch)
treea71bf917abca5c7a76c9398f5db1c83f3f46c8cc
parent063eb29d39375fd183440d6c1e629c2d581d8e2d (diff)
downloadeclipse.platform.runtime-4765b1509deb6d118fd74bb6634664759cba551e.zip
eclipse.platform.runtime-4765b1509deb6d118fd74bb6634664759cba551e.tar.gz
eclipse.platform.runtime-4765b1509deb6d118fd74bb6634664759cba551e.tar.bz2
Bug 172096 - [prefs] Ensure pluggability of backing storev20120119-2010I20120119-2200
-rw-r--r--tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF1
-rw-r--r--tests/org.eclipse.core.tests.runtime/build.properties7
-rw-r--r--tests/org.eclipse.core.tests.runtime/plugin.xml12
-rw-r--r--tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/EclipsePreferencesTest.java141
-rw-r--r--tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java80
-rw-r--r--tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestNodeStorage.java36
-rw-r--r--tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestNodeStorage3.java104
-rw-r--r--tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope.java73
-rw-r--r--tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope2.java102
-rw-r--r--tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTestsPlugin.java123
-rw-r--r--tests/org.eclipse.core.tests.runtime/testData/preferences/test3/bar2
-rw-r--r--tests/org.eclipse.core.tests.runtime/testData/preferences/test3/foo3
12 files changed, 535 insertions, 149 deletions
diff --git a/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
index a5289ff..5ce415d 100644
--- a/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
@@ -21,3 +21,4 @@ Require-Bundle: org.eclipse.core.tests.harness;bundle-version="3.4.0",
org.eclipse.core.runtime.compatibility
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Plugin-Class: org.eclipse.core.tests.runtime.RuntimeTestsPlugin
diff --git a/tests/org.eclipse.core.tests.runtime/build.properties b/tests/org.eclipse.core.tests.runtime/build.properties
index d21f5f9..c8d46f9 100644
--- a/tests/org.eclipse.core.tests.runtime/build.properties
+++ b/tests/org.eclipse.core.tests.runtime/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2008 IBM Corporation and others.
+# Copyright (c) 2000, 2012 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@ bin.includes = plugin.xml,\
Plugin_Testing/,\
about.html,\
META-INF/,\
- test.xml
+ test.xml,\
+ testData/
src.includes = about.html
-javacWarnings.runtimetests.jar=-unchecked,-raw \ No newline at end of file
+javacWarnings.runtimetests.jar=-unchecked,-raw
diff --git a/tests/org.eclipse.core.tests.runtime/plugin.xml b/tests/org.eclipse.core.tests.runtime/plugin.xml
index 0fba70e..c01b9ff 100644
--- a/tests/org.eclipse.core.tests.runtime/plugin.xml
+++ b/tests/org.eclipse.core.tests.runtime/plugin.xml
@@ -6,12 +6,20 @@
id="test-preferences"
name="test-preferences"
point="org.eclipse.core.runtime.preferences">
+ <!-- TestScope2 is used to test the actual file formats on disk. -->
<scope
- name="test"
- class="org.eclipse.core.tests.internal.preferences.TestScope"/>
+ name="test2"
+ class="org.eclipse.core.tests.internal.preferences.TestScope2"/>
+ <!-- -->
<scope
name="badtest"
class="org.eclipse.core.tests.internal.preferences.BadTestScope"/>
+ <scope
+ name="test"
+ storage="org.eclipse.core.tests.internal.preferences.TestNodeStorage"/>
+ <scope
+ name="test3"
+ storage="org.eclipse.core.tests.internal.preferences.TestNodeStorage3"/>
</extension>
<extension
point="org.eclipse.core.runtime.adapters">
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/EclipsePreferencesTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/EclipsePreferencesTest.java
index 03a484e..70d5595 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/EclipsePreferencesTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/EclipsePreferencesTest.java
@@ -15,10 +15,12 @@ import java.util.*;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.core.internal.preferences.EclipsePreferences;
+import org.eclipse.core.internal.preferences.TestHelper;
import org.eclipse.core.internal.runtime.InternalPlatform;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.preferences.*;
import org.eclipse.core.tests.runtime.RuntimeTest;
+import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
import org.osgi.framework.Bundle;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
@@ -317,14 +319,14 @@ public class EclipsePreferencesTest extends RuntimeTest {
}
private byte[][] getByteValues() {
- ArrayList result = new ArrayList();
+ ArrayList<byte[]> result = new ArrayList<byte[]>();
result.add(new byte[0]);
result.add(new byte[] {127});
result.add(new byte[] {-128});
result.add(new byte[] {0});
result.add(new byte[] {5});
result.add(new byte[] {-23});
- return (byte[][]) result.toArray(new byte[result.size()][]);
+ return result.toArray(new byte[result.size()][]);
}
public void testBytes() {
@@ -582,13 +584,13 @@ public class EclipsePreferencesTest extends RuntimeTest {
public void testRemoveNode() {
Preferences root = getScopeRoot();
- ArrayList list = new ArrayList();
+ ArrayList<Preferences> list = new ArrayList<Preferences>();
for (int i = 0; i < 5; i++)
list.add(root.node(getUniqueString()));
// all exist
- for (Iterator i = list.iterator(); i.hasNext();) {
- Preferences node = (Preferences) i.next();
+ for (Iterator<Preferences> i = list.iterator(); i.hasNext();) {
+ Preferences node = i.next();
try {
assertTrue("1." + i, node.nodeExists(""));
} catch (BackingStoreException e) {
@@ -597,8 +599,8 @@ public class EclipsePreferencesTest extends RuntimeTest {
}
// remove each
- for (Iterator i = list.iterator(); i.hasNext();) {
- Preferences node = (Preferences) i.next();
+ for (Iterator<Preferences> i = list.iterator(); i.hasNext();) {
+ Preferences node = i.next();
try {
node.removeNode();
assertTrue("2." + i, !node.nodeExists(""));
@@ -608,6 +610,37 @@ public class EclipsePreferencesTest extends RuntimeTest {
}
}
+ /*
+ * Test for bug 367366.
+ * TODO re-enable when the bug is fixed
+ */
+ public void _testRemoveDeletesFile() {
+ Preferences node = InstanceScope.INSTANCE.getNode("foo");
+ Preferences parent = node.parent();
+ node.put("a", "b");
+ try {
+ node.flush();
+ } catch (BackingStoreException e) {
+ fail("0.99", e);
+ }
+ File file = null;
+ // TODO
+ //file = TestHelper.getInstanceBaseLocation().append(".settings").append("foo.prefs").toFile();
+ assertTrue("1.0", file.exists());
+ try {
+ node.removeNode();
+ } catch (BackingStoreException e) {
+ fail("1.99", e);
+ }
+ try {
+ parent.flush();
+ } catch (BackingStoreException e) {
+ fail("2.99", e);
+ }
+ // ensure file was deleted
+ assertFalse("3.0", file.exists());
+ }
+
public void testName() {
Preferences node = Platform.getPreferencesService().getRootNode();
@@ -842,8 +875,8 @@ public class EclipsePreferencesTest extends RuntimeTest {
public void testAccept() {
IEclipsePreferences scopeRoot = getScopeRoot();
- ArrayList expected = new ArrayList();
- final ArrayList actual = new ArrayList();
+ ArrayList<String> expected = new ArrayList<String>();
+ final ArrayList<String> actual = new ArrayList<String>();
IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() {
public boolean visit(IEclipsePreferences node) {
@@ -861,7 +894,7 @@ public class EclipsePreferencesTest extends RuntimeTest {
expected.add(scopeRoot.absolutePath());
assertEquals("0.1", expected.toArray(new String[0]), actual.toArray(new String[0]), false);
- Set children = new HashSet();
+ Set<String> children = new HashSet<String>();
children.add(getUniqueString());
children.add(getUniqueString());
children.add(getUniqueString());
@@ -870,8 +903,8 @@ public class EclipsePreferencesTest extends RuntimeTest {
actual.clear();
expected.clear();
expected.add(scopeRoot.absolutePath());
- for (Iterator i = children.iterator(); i.hasNext();) {
- String s = (String) i.next();
+ for (Iterator<String> i = children.iterator(); i.hasNext();) {
+ String s = i.next();
expected.add(scopeRoot.absolutePath() + '/' + s);
scopeRoot.node(s);
}
@@ -1048,8 +1081,8 @@ public class EclipsePreferencesTest extends RuntimeTest {
node.put(key, value);
Preferences current = node;
int count = 0;
- while (current != null && current instanceof TestScope) {
- assertTrue("1.0." + current.absolutePath(), ((TestScope) current).isDirty());
+ while (current != null && current instanceof EclipsePreferences && current.parent() != null && new Path(current.absolutePath()).segment(0).equals(TestScope.SCOPE)) {
+ assertTrue("1.0." + current.absolutePath(), ((EclipsePreferences) current).isDirty());
count++;
current = current.parent();
}
@@ -1067,7 +1100,7 @@ public class EclipsePreferencesTest extends RuntimeTest {
String three = getUniqueString();
String key = "key";
String value = "value";
- Preferences node = root.node(TestScope.SCOPE).node(one).node(two).node(three);
+ Preferences node = root.node(TestScope2.SCOPE).node(one).node(two).node(three);
node.put(key, value);
// save the prefs to disk
@@ -1077,10 +1110,10 @@ public class EclipsePreferencesTest extends RuntimeTest {
fail("1.99", e);
}
- assertTrue("2.0", node instanceof TestScope);
+ assertTrue("2.0", node instanceof TestScope2);
// read the file outside of the pref mechanism
- IPath location = ((TestScope) node).getLocation();
+ IPath location = ((TestScope2) node).getLocation();
Collection<String> lines = null;
try {
lines = read(location);
@@ -1147,7 +1180,7 @@ public class EclipsePreferencesTest extends RuntimeTest {
}
}
- ArrayList list = new ArrayList();
+ List<Info> list = new ArrayList<Info>();
list.add(new Info("", "a", "a"));
list.add(new Info("", "/a", "///a"));
list.add(new Info("a", "b", "a/b"));
@@ -1158,25 +1191,24 @@ public class EclipsePreferencesTest extends RuntimeTest {
Preferences node = new TestScope().getNode(getUniqueString());
for (int i = 0; i < list.size(); i++) {
- Info info = (Info) list.get(i);
+ Info info = list.get(i);
node.node(info.path).put(info.key, Integer.toString(i));
}
- if (!(node instanceof TestScope))
- return;
+ assertTrue("0.8", node instanceof EclipsePreferences);
Properties properties = null;
try {
- properties = ((TestScope) node).toProperties();
+ properties = TestHelper.convertToProperties((EclipsePreferences) node, "");
} catch (BackingStoreException e) {
fail("1.0", e);
}
- for (Iterator i = properties.keySet().iterator(); i.hasNext();) {
+ for (Iterator<Object> i = properties.keySet().iterator(); i.hasNext();) {
String key = (String) i.next();
String value = properties.getProperty(key);
try {
- Info info = (Info) list.get(Integer.parseInt(value));
+ Info info = list.get(Integer.parseInt(value));
assertNotNull("2.0", info);
assertEquals("2.1." + key, info.encoded, key);
} catch (NumberFormatException e) {
@@ -1218,7 +1250,7 @@ public class EclipsePreferencesTest extends RuntimeTest {
}
}
- ArrayList list = new ArrayList();
+ ArrayList<Item> list = new ArrayList<Item>();
list.add(new Item(null, "a", "a"));
list.add(new Item(null, "/a", "///a"));
list.add(new Item("a", "b", "a/b"));
@@ -1227,8 +1259,8 @@ public class EclipsePreferencesTest extends RuntimeTest {
list.add(new Item("repositories", "cvs://dev.eclipse.org:25/cvsroot", "repositories//cvs://dev.eclipse.org:25/cvsroot"));
list.add(new Item("repositories:cvs", "dev.eclipse.org:25", "repositories:cvs/dev.eclipse.org:25"));
- for (Iterator i = list.iterator(); i.hasNext();) {
- Item item = (Item) i.next();
+ for (Iterator<Item> i = list.iterator(); i.hasNext();) {
+ Item item = i.next();
assertEquals("a" + i + item.expected, item.expected, EclipsePreferences.encodePath(item.path, item.key));
String[] result = EclipsePreferences.decodePath(item.expected);
assertEquals("b" + i + item.path, item.path, result[0]);
@@ -1311,11 +1343,64 @@ public class EclipsePreferencesTest extends RuntimeTest {
public void testGetByteArray() {
final byte[] testArray = new byte[] {10, 13, 15, 20};
- DefaultScope defaultScope = new DefaultScope();
+ IScopeContext defaultScope = DefaultScope.INSTANCE;
defaultScope.getNode(TEST_NODE_PATH).putByteArray(TEST_PREF_KEY, testArray);
final byte[] returnArray = Platform.getPreferencesService().getByteArray(TEST_NODE_PATH, TEST_PREF_KEY, new byte[] {}, null);
assertEquals("1.0 Wrong size", testArray.length, returnArray.length);
for (int i = 0; i < testArray.length; i++)
assertEquals("2.0 Wrong value at: " + i, testArray[i], returnArray[i]);
}
+
+ /*
+ * Some tests to handle user-defined node storage.
+ */
+ public void testNode3() {
+ IPreferencesService service = Platform.getPreferencesService();
+ IEclipsePreferences rootPreferences = service.getRootNode();
+ Preferences node = rootPreferences.node("test3");
+
+ // check that we have the expected children
+ try {
+ File file = RuntimeTestsPlugin.getTestData("testData/preferences/test3");
+ Collection<String> expectedChildren = Arrays.asList(file.list());
+ String[] children = node.childrenNames();
+ for (String child : children)
+ assertTrue("1.1." + child, expectedChildren.contains(child));
+ } catch (BackingStoreException e) {
+ fail("1.99", e);
+ }
+
+ // check the child has the expected values
+ Preferences child = node.node("foo");
+ try {
+ assertEquals("2.0", 2, child.keys().length);
+ } catch (BackingStoreException e) {
+ fail("2.09", e);
+ }
+ assertEquals("2.1", "value1", child.get("key1", null));
+ assertEquals("2.2", "value2", child.get("key2", null));
+
+ // set a new value, flush (which saves the file) and check the file contents
+ child.put("key8", "value8");
+ try {
+ child.flush();
+ } catch (BackingStoreException e) {
+ fail("3.99", e);
+ }
+ String prop = System.getProperty("equinox.preference.test.TestNodeStorage3,root");
+ assertNotNull("3.1", prop);
+ File rootFile = new File(prop);
+ File childFile = new File(rootFile, "foo");
+ assertTrue("3.2", childFile.exists());
+ Properties contents = loadProperties(new Path(childFile.getAbsolutePath()));
+ assertEquals("3.3", "value8", contents.getProperty("key8", null));
+
+ // delete the node (which should remove the file)
+ try {
+ child.removeNode();
+ } catch (BackingStoreException e) {
+ fail("4.99", e);
+ }
+ assertFalse("4.1", childFile.exists());
+ }
}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java
index 79e908f..0f93e25 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,7 +31,7 @@ public class PreferencesServiceTest extends RuntimeTest {
private IEclipsePreferences node;
private ByteArrayOutputStream output;
- private Set expected;
+ private Set<String> expected;
private String[] excludes;
private IPreferenceFilter[] transfers;
private boolean useTransfers;
@@ -40,14 +40,14 @@ public class PreferencesServiceTest extends RuntimeTest {
super();
this.node = node;
this.excludes = excludes;
- this.expected = new HashSet();
+ this.expected = new HashSet<String>();
}
public ExportVerifier(IEclipsePreferences node, IPreferenceFilter[] transfers) {
super();
this.node = node;
this.transfers = transfers;
- this.expected = new HashSet();
+ this.expected = new HashSet<String>();
this.useTransfers = true;
}
@@ -97,8 +97,8 @@ public class PreferencesServiceTest extends RuntimeTest {
return;
}
assertEquals("3.0", expected.size(), properties.size());
- for (Iterator i = expected.iterator(); i.hasNext();) {
- String key = (String) i.next();
+ for (Iterator<String> i = expected.iterator(); i.hasNext();) {
+ String key = i.next();
assertNotNull("4.0." + key, properties.get(key));
}
}
@@ -186,8 +186,8 @@ public class PreferencesServiceTest extends RuntimeTest {
actual = test.get(newKey, null);
assertNull("5.2", actual);
// ensure that the node isn't dirty (has been saved after the import)
- assertTrue("5.3", test instanceof TestScope);
- assertTrue("5.4", !((TestScope) test).isDirty());
+ assertTrue("5.3", test instanceof EclipsePreferences);
+ assertTrue("5.4", !((EclipsePreferences) test).isDirty());
// clear all
try {
@@ -403,15 +403,15 @@ public class PreferencesServiceTest extends RuntimeTest {
String defaultValue = getUniqueString() + '1';
String actual = null;
- ArrayList list = new ArrayList();
+ List<IScopeContext[]> list = new ArrayList<IScopeContext[]>();
list.add(null);
list.add(new IScopeContext[] {});
list.add(new IScopeContext[] {null});
list.add(new IScopeContext[] {new TestScope()});
- list.add(new IScopeContext[] {new TestScope(), new DefaultScope()});
- list.add(new IScopeContext[] {new DefaultScope(), new TestScope()});
- list.add(new IScopeContext[] {new DefaultScope()});
- IScopeContext[][] contexts = (IScopeContext[][]) list.toArray(new IScopeContext[list.size()][]);
+ list.add(new IScopeContext[] {new TestScope(), DefaultScope.INSTANCE});
+ list.add(new IScopeContext[] {DefaultScope.INSTANCE, new TestScope()});
+ list.add(new IScopeContext[] {DefaultScope.INSTANCE});
+ IScopeContext[][] contexts = list.toArray(new IScopeContext[list.size()][]);
// nothing is set
for (int i = 0; i < contexts.length; i++) {
@@ -715,7 +715,7 @@ public class PreferencesServiceTest extends RuntimeTest {
*/
public void testExportDefaults() {
String qualifier = getUniqueString();
- IEclipsePreferences node = new DefaultScope().getNode(qualifier);
+ IEclipsePreferences node = DefaultScope.INSTANCE.getNode(qualifier);
for (int i = 0; i < 10; i++)
node.put(Integer.toString(i), getUniqueString());
@@ -809,7 +809,7 @@ public class PreferencesServiceTest extends RuntimeTest {
}
}
// change all version numbers to "0" so the validation will fail
- for (Enumeration e = properties.keys(); e.hasMoreElements();) {
+ for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
if (key.charAt(0) == BUNDLE_VERSION_PREFIX)
properties.put(key, "0");
@@ -848,8 +848,8 @@ public class PreferencesServiceTest extends RuntimeTest {
// don't match this filter
IPreferenceFilter filter = new IPreferenceFilter() {
- public Map getMapping(String scope) {
- Map result = new HashMap();
+ public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
+ Map<String, PreferenceFilterEntry[]> result = new HashMap<String, PreferenceFilterEntry[]>();
result.put(QUALIFIER, null);
return result;
}
@@ -874,7 +874,7 @@ public class PreferencesServiceTest extends RuntimeTest {
assertEquals("3.0", 0, matching.length);
// add some values so it does match
- new InstanceScope().getNode(QUALIFIER).put("key", "value");
+ InstanceScope.INSTANCE.getNode(QUALIFIER).put("key", "value");
try {
matching = service.matches(service.getRootNode(), new IPreferenceFilter[] {filter});
} catch (CoreException e) {
@@ -884,7 +884,7 @@ public class PreferencesServiceTest extends RuntimeTest {
// should match on the exact node too
try {
- matching = service.matches(new InstanceScope().getNode(QUALIFIER), new IPreferenceFilter[] {filter});
+ matching = service.matches(InstanceScope.INSTANCE.getNode(QUALIFIER), new IPreferenceFilter[] {filter});
} catch (CoreException e) {
fail("4.00", e);
}
@@ -892,7 +892,7 @@ public class PreferencesServiceTest extends RuntimeTest {
// shouldn't match a different scope
try {
- matching = service.matches(new ConfigurationScope().getNode(QUALIFIER), new IPreferenceFilter[] {filter});
+ matching = service.matches(ConfigurationScope.INSTANCE.getNode(QUALIFIER), new IPreferenceFilter[] {filter});
} catch (CoreException e) {
fail("5.00", e);
}
@@ -900,7 +900,7 @@ public class PreferencesServiceTest extends RuntimeTest {
// try matching on the root node for a filter which matches all nodes in the scope
filter = new IPreferenceFilter() {
- public Map getMapping(String scope) {
+ public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
return null;
}
@@ -909,7 +909,7 @@ public class PreferencesServiceTest extends RuntimeTest {
}
};
try {
- matching = service.matches(new InstanceScope().getNode(QUALIFIER), new IPreferenceFilter[] {filter});
+ matching = service.matches(InstanceScope.INSTANCE.getNode(QUALIFIER), new IPreferenceFilter[] {filter});
} catch (CoreException e) {
fail("6.0", e);
}
@@ -917,7 +917,7 @@ public class PreferencesServiceTest extends RuntimeTest {
// shouldn't match
try {
- matching = service.matches(new ConfigurationScope().getNode(QUALIFIER), new IPreferenceFilter[] {filter});
+ matching = service.matches(ConfigurationScope.INSTANCE.getNode(QUALIFIER), new IPreferenceFilter[] {filter});
} catch (CoreException e) {
fail("7.0", e);
}
@@ -933,10 +933,10 @@ public class PreferencesServiceTest extends RuntimeTest {
final String QUALIFIER = getUniqueString();
// setup - create a child node with a key/value pair
- new InstanceScope().getNode(QUALIFIER).node("child").put("key", "value");
+ InstanceScope.INSTANCE.getNode(QUALIFIER).node("child").put("key", "value");
IPreferenceFilter[] filters = new IPreferenceFilter[] {new IPreferenceFilter() {
- public Map getMapping(String scope) {
- Map result = new HashMap();
+ public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
+ Map<String, PreferenceFilterEntry[]> result = new HashMap<String, PreferenceFilterEntry[]>();
result.put(QUALIFIER, null);
return result;
}
@@ -956,8 +956,8 @@ public class PreferencesServiceTest extends RuntimeTest {
final String VALID_QUALIFIER = getUniqueString();
IPreferenceFilter transfer = new IPreferenceFilter() {
- public Map getMapping(String scope) {
- Map result = new HashMap();
+ public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
+ Map<String, PreferenceFilterEntry[]> result = new HashMap<String, PreferenceFilterEntry[]>();
result.put(VALID_QUALIFIER, null);
return result;
}
@@ -970,7 +970,7 @@ public class PreferencesServiceTest extends RuntimeTest {
IPreferencesService service = Platform.getPreferencesService();
ExportVerifier verifier = new ExportVerifier(service.getRootNode(), new IPreferenceFilter[] {transfer});
- IEclipsePreferences node = new InstanceScope().getNode(VALID_QUALIFIER);
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(VALID_QUALIFIER);
String VALID_KEY_1 = "key1";
String VALID_KEY_2 = "key2";
node.put(VALID_KEY_1, "value1");
@@ -981,7 +981,7 @@ public class PreferencesServiceTest extends RuntimeTest {
verifier.addExpected(node.absolutePath(), VALID_KEY_1);
verifier.addExpected(node.absolutePath(), VALID_KEY_2);
- node = new InstanceScope().getNode(getUniqueString());
+ node = InstanceScope.INSTANCE.getNode(getUniqueString());
node.put("invalidkey1", "value1");
node.put("invalidkey2", "value2");
@@ -995,7 +995,7 @@ public class PreferencesServiceTest extends RuntimeTest {
public void testExportWithTransfers2() {
final String VALID_QUALIFIER = getUniqueString();
IPreferenceFilter transfer = new IPreferenceFilter() {
- public Map getMapping(String scope) {
+ public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
return null;
}
@@ -1029,7 +1029,7 @@ public class PreferencesServiceTest extends RuntimeTest {
verifier.addVersion();
verifier.addExportRoot(service.getRootNode());
- testNode = new InstanceScope().getNode(getUniqueString());
+ testNode = InstanceScope.INSTANCE.getNode(getUniqueString());
testNode.put("invalidkey1", "value1");
testNode.put("invalidkey2", "value2");
@@ -1045,8 +1045,8 @@ public class PreferencesServiceTest extends RuntimeTest {
final String QUALIFIER = getUniqueString();
IPreferenceFilter transfer = new IPreferenceFilter() {
- public Map getMapping(String scope) {
- Map result = new HashMap();
+ public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
+ Map<String, PreferenceFilterEntry[]> result = new HashMap<String, PreferenceFilterEntry[]>();
result.put(QUALIFIER, null);
return result;
}
@@ -1059,7 +1059,7 @@ public class PreferencesServiceTest extends RuntimeTest {
IPreferencesService service = Platform.getPreferencesService();
ExportVerifier verifier = new ExportVerifier(service.getRootNode(), new IPreferenceFilter[] {transfer});
- Preferences node = new InstanceScope().getNode(QUALIFIER).node("child");
+ Preferences node = InstanceScope.INSTANCE.getNode(QUALIFIER).node("child");
String VALID_KEY_1 = "key1";
String VALID_KEY_2 = "key2";
node.put(VALID_KEY_1, "value1");
@@ -1070,7 +1070,7 @@ public class PreferencesServiceTest extends RuntimeTest {
verifier.addExpected(node.absolutePath(), VALID_KEY_1);
verifier.addExpected(node.absolutePath(), VALID_KEY_2);
- node = new InstanceScope().getNode(getUniqueString());
+ node = InstanceScope.INSTANCE.getNode(getUniqueString());
node.put("invalidkey1", "value1");
node.put("invalidkey2", "value2");
@@ -1086,11 +1086,11 @@ public class PreferencesServiceTest extends RuntimeTest {
final String VALID_QUALIFIER = getUniqueString();
final String COMMON_PREFIX = "PREFIX.";
IPreferenceFilter transfer = new IPreferenceFilter() {
- Map result;
+ Map<String, PreferenceFilterEntry[]> result;
- public Map getMapping(String scope) {
+ public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
if (result == null) {
- result = new HashMap();
+ result = new HashMap<String, PreferenceFilterEntry[]>();
result.put(VALID_QUALIFIER, new PreferenceFilterEntry[] {new PreferenceFilterEntry(COMMON_PREFIX, "prefix")});
}
return result;
@@ -1103,7 +1103,7 @@ public class PreferencesServiceTest extends RuntimeTest {
IPreferenceFilter[] matching = null;
IPreferencesService service = Platform.getPreferencesService();
- IEclipsePreferences node = new InstanceScope().getNode(VALID_QUALIFIER);
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(VALID_QUALIFIER);
String VALID_KEY_1 = COMMON_PREFIX + "key1";
String VALID_KEY_2 = COMMON_PREFIX + "key2";
String VALID_KEY_3 = "key3";
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestNodeStorage.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestNodeStorage.java
new file mode 100644
index 0000000..efd5e8b
--- /dev/null
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestNodeStorage.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.tests.internal.preferences;
+
+import java.util.*;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceStorage;
+
+public class TestNodeStorage extends AbstractPreferenceStorage {
+
+ private Map<String, Properties> storage = new HashMap<String, Properties>();
+
+ public Properties load(String nodePath) {
+ return storage.get(nodePath);
+ }
+
+ public void save(String nodePath, Properties properties) {
+ storage.put(nodePath, properties);
+ }
+
+ public String[] childrenNames(String nodePath) {
+ return null;
+ }
+
+ public void removed(String nodePath) {
+ storage.remove(nodePath);
+ }
+
+}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestNodeStorage3.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestNodeStorage3.java
new file mode 100644
index 0000000..0c66448
--- /dev/null
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestNodeStorage3.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.core.tests.internal.preferences;
+
+import java.io.*;
+import java.util.Properties;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceStorage;
+import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * Test class for scope "test3" which will test file formats, etc.
+ */
+public class TestNodeStorage3 extends AbstractPreferenceStorage {
+
+ private static File root;
+
+ static {
+ File source = RuntimeTestsPlugin.getTestData("/testData/preferences/test3");
+ root = RuntimeTestsPlugin.getTempFolder();
+ try {
+ RuntimeTestsPlugin.copy(source, root);
+ } catch (IOException e) {
+ //TODO
+ }
+ System.setProperty("equinox.preference.test.TestNodeStorage3,root", root.getAbsolutePath());
+ }
+
+ // made package private to use during testing
+ /* package */File getLocation(String nodePath) throws BackingStoreException {
+ if (root == null)
+ throw new BackingStoreException("Problems getting preference location.");
+ IPath path = new Path(nodePath);
+ return new File(root, path.lastSegment());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceStorage#load(java.lang.String)
+ */
+ @Override
+ public Properties load(String nodePath) throws BackingStoreException {
+ File file = getLocation(nodePath);
+ if (!file.exists())
+ return null;
+ InputStream input;
+ try {
+ input = new BufferedInputStream(new FileInputStream(file));
+ return loadProperties(input);
+ } catch (FileNotFoundException e) {
+ throw new BackingStoreException("Exception while trying to open preference file: " + file.getAbsolutePath(), e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceStorage#save(java.lang.String, java.util.Properties)
+ */
+ @Override
+ public void save(String nodePath, Properties properties) throws BackingStoreException {
+ File file = getLocation(nodePath);
+ if (file == null)
+ return;
+ OutputStream output;
+ try {
+ output = new BufferedOutputStream(new FileOutputStream(file));
+ saveProperties(output, properties);
+ } catch (FileNotFoundException e) {
+ throw new BackingStoreException("Error occurred while saving preference file: " + file.getAbsolutePath(), e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceStorage#childrenNames(java.lang.String)
+ */
+ @Override
+ public String[] childrenNames(String nodePath) {
+ // Until we expose load-levels to the user, we will only be called for root children here
+ return root == null ? new String[0] : root.list();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceStorage#removed(java.lang.String)
+ */
+ @Override
+ public void removed(String nodePath) {
+ try {
+ File file = getLocation(nodePath);
+ if (file.exists())
+ file.delete();
+ } catch (BackingStoreException e) {
+ // fall through
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope.java
index d96f0ed..746e99d 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope.java
@@ -10,73 +10,24 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.preferences;
-import java.util.Properties;
-import org.eclipse.core.internal.preferences.EclipsePreferences;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.core.tests.harness.CoreTest;
-import org.osgi.service.prefs.BackingStoreException;
/**
* @since 3.0
*/
-public class TestScope extends EclipsePreferences implements IScopeContext {
+public class TestScope implements IScopeContext {
public static final String SCOPE = "test"; //$NON-NLS-1$
- private String qualifier;
- private int segmentCount;
- private IEclipsePreferences loadLevel;
-
- public static IPath baseLocation;
- private IPath location;
-
- static {
- baseLocation = new CoreTest().getRandomLocation();
- }
public TestScope() {
- this(null, null);
- }
-
- private TestScope(EclipsePreferences parent, String key) {
- super(parent, key);
- // cache the segment count
- IPath path = new Path(absolutePath());
- segmentCount = path.segmentCount();
- if (segmentCount < 2)
- return;
-
- // cache the qualifier
- String scope = path.segment(0);
- if (TestScope.SCOPE.equals(scope))
- qualifier = path.segment(1);
-
- // cache the location
- if (qualifier == null)
- return;
- }
-
- protected IEclipsePreferences getLoadLevel() {
- if (loadLevel == null) {
- if (qualifier == null)
- return null;
- // Make it relative to this node rather than navigating to it from the root.
- // Walk backwards up the tree starting at this node.
- // This is important to avoid a chicken/egg thing on startup.
- IEclipsePreferences node = this;
- for (int i = 2; i < segmentCount; i++)
- node = (IEclipsePreferences) node.parent();
- loadLevel = node;
- }
- return loadLevel;
+ super();
}
public IPath getLocation() {
- if (location == null) {
- location = computeLocation(baseLocation, qualifier);
- }
- return location;
+ return null;
}
public String getName() {
@@ -86,16 +37,4 @@ public class TestScope extends EclipsePreferences implements IScopeContext {
public IEclipsePreferences getNode(String qualifier) {
return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(SCOPE).node(qualifier);
}
-
- protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Object context) {
- return new TestScope(nodeParent, nodeName);
- }
-
- void setDirty(boolean value) {
- dirty = value;
- }
-
- Properties toProperties() throws BackingStoreException {
- return convertToProperties(new Properties(), "");
- }
-}
+} \ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope2.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope2.java
new file mode 100644
index 0000000..71cffc4
--- /dev/null
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestScope2.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.tests.internal.preferences;
+
+import java.util.Properties;
+import org.eclipse.core.internal.preferences.EclipsePreferences;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.tests.harness.CoreTest;
+import org.osgi.service.prefs.BackingStoreException;
+
+/*
+ * Test scope used for testing the file format on disk.
+ * Specifically in EclipsePreferencesTest.test_342709.
+ */
+public class TestScope2 extends EclipsePreferences implements IScopeContext {
+
+ public static final String SCOPE = "test2"; //$NON-NLS-1$
+ private String qualifier;
+ private int segmentCount;
+ private IEclipsePreferences loadLevel;
+
+ public static IPath baseLocation;
+ private IPath location;
+
+ static {
+ baseLocation = new CoreTest().getRandomLocation();
+ }
+
+ public TestScope2() {
+ this(null, null);
+ }
+
+ private TestScope2(EclipsePreferences parent, String key) {
+ super(parent, key);
+ // cache the segment count
+ IPath path = new Path(absolutePath());
+ segmentCount = path.segmentCount();
+ if (segmentCount < 2)
+ return;
+
+ // cache the qualifier
+ String scope = path.segment(0);
+ if (TestScope2.SCOPE.equals(scope))
+ qualifier = path.segment(1);
+
+ // cache the location
+ if (qualifier == null)
+ return;
+ }
+
+ protected IEclipsePreferences getLoadLevel() {
+ if (loadLevel == null) {
+ if (qualifier == null)
+ return null;
+ // Make it relative to this node rather than navigating to it from the root.
+ // Walk backwards up the tree starting at this node.
+ // This is important to avoid a chicken/egg thing on startup.
+ IEclipsePreferences node = this;
+ for (int i = 2; i < segmentCount; i++)
+ node = (IEclipsePreferences) node.parent();
+ loadLevel = node;
+ }
+ return loadLevel;
+ }
+
+ public IPath getLocation() {
+ if (location == null) {
+ location = computeLocation(baseLocation, qualifier);
+ }
+ return location;
+ }
+
+ public String getName() {
+ return SCOPE;
+ }
+
+ public IEclipsePreferences getNode(String qualifier) {
+ return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(SCOPE).node(qualifier);
+ }
+
+ protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Object context) {
+ return new TestScope2(nodeParent, nodeName);
+ }
+
+ void setDirty(boolean value) {
+ dirty = value;
+ }
+
+ Properties toProperties() throws BackingStoreException {
+ return convertToProperties(new Properties(), "");
+ }
+}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTestsPlugin.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTestsPlugin.java
index 158a14e..ae841d3 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTestsPlugin.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/RuntimeTestsPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,17 +10,17 @@
*******************************************************************************/
package org.eclipse.core.tests.runtime;
-import org.eclipse.core.runtime.Plugin;
+import java.io.*;
+import java.net.URL;
+import org.eclipse.core.runtime.*;
import org.osgi.framework.BundleContext;
-public class RuntimeTestsPlugin extends Plugin {
+public class RuntimeTestsPlugin extends Plugin {
public static final String PI_RUNTIME_TESTS = "org.eclipse.core.tests.runtime"; //$NON-NLS-1$
-
- private static RuntimeTestsPlugin plugin;
- private BundleContext context;
-
public static final String TEST_FILES_ROOT = "Plugin_Testing/";
+ private static RuntimeTestsPlugin plugin;
+ private BundleContext bundleContext;
public RuntimeTestsPlugin() {
plugin = this;
@@ -28,7 +28,7 @@ public class RuntimeTestsPlugin extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
- this.context = context;
+ this.bundleContext = context;
}
public void stop(BundleContext context) throws Exception {
@@ -36,11 +36,116 @@ public class RuntimeTestsPlugin extends Plugin {
}
public static BundleContext getContext() {
- return plugin != null ? plugin.context : null;
+ return plugin != null ? plugin.bundleContext : null;
}
public static Plugin getPlugin() {
return plugin;
}
+ public static boolean delete(File file) {
+ if (!file.exists())
+ return true;
+ if (file.isDirectory()) {
+ File[] children = file.listFiles();
+ for (int i = 0; i < children.length; i++)
+ delete(children[i]);
+ }
+ return file.delete();
+ }
+
+ public static String getUniqueString() {
+ return System.currentTimeMillis() + "-" + Math.random();
+ }
+
+ /*
+ * Copied (kinda) from AbstractProvisioningTest.
+ */
+ public static File getTempFolder() {
+ String name = getUniqueString();
+ String tempDir = System.getProperty("java.io.tmpdir");
+ File testFolder = new File(tempDir, name);
+ if (testFolder.exists())
+ delete(testFolder);
+ testFolder.mkdirs();
+ return testFolder;
+ }
+
+ /*
+ * Look up and return a file handle to the given entry in the bundle.
+ *
+ * Code copied from AbstractProvisioningTest in the p2 tests.
+ */
+ public static File getTestData(String entry) {
+ if (entry == null)
+ return null;
+ URL base = RuntimeTestsPlugin.getContext().getBundle().getEntry(entry);
+ if (base == null)
+ return null;
+ try {
+ String osPath = new Path(FileLocator.toFileURL(base).getPath()).toOSString();
+ File result = new File(osPath);
+ return result.getCanonicalPath().equals(result.getPath()) ? result : null;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ /*
+ * Copied from AbstractProvisioningTest.
+ */
+ public static void copy(File source, File target) throws IOException {
+ copy(source, target, null);
+ }
+
+ /*
+ * Copy
+ * - if we have a file, then copy the file
+ * - if we have a directory then merge
+ *
+ * Copied from AbstractProvisioningTest.
+ */
+ public static void copy(File source, File target, FileFilter filter) throws IOException {
+ if (!source.exists())
+ return;
+ if (source.isDirectory()) {
+ if (target.exists() && target.isFile())
+ target.delete();
+ if (!target.exists())
+ target.mkdirs();
+ File[] children = source.listFiles(filter);
+ for (int i = 0; i < children.length; i++)
+ copy(children[i], new File(target, children[i].getName()));
+ return;
+ }
+ InputStream input = null;
+ OutputStream output = null;
+ try {
+ input = new BufferedInputStream(new FileInputStream(source));
+ output = new BufferedOutputStream(new FileOutputStream(target));
+
+ byte[] buffer = new byte[8192];
+ int bytesRead = 0;
+ while ((bytesRead = input.read(buffer)) != -1)
+ output.write(buffer, 0, bytesRead);
+ } finally {
+ if (input != null) {
+ try {
+ input.close();
+ } catch (IOException e) {
+ System.err.println("Exception while trying to close input stream on: " + source.getAbsolutePath());
+ e.printStackTrace();
+ }
+ }
+ if (output != null) {
+ try {
+ output.close();
+ } catch (IOException e) {
+ System.err.println("Exception while trying to close output stream on: " + target.getAbsolutePath());
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
}
diff --git a/tests/org.eclipse.core.tests.runtime/testData/preferences/test3/bar b/tests/org.eclipse.core.tests.runtime/testData/preferences/test3/bar
new file mode 100644
index 0000000..88e2581
--- /dev/null
+++ b/tests/org.eclipse.core.tests.runtime/testData/preferences/test3/bar
@@ -0,0 +1,2 @@
+key4=value4
+sub2/key5=value5 \ No newline at end of file
diff --git a/tests/org.eclipse.core.tests.runtime/testData/preferences/test3/foo b/tests/org.eclipse.core.tests.runtime/testData/preferences/test3/foo
new file mode 100644
index 0000000..766054c
--- /dev/null
+++ b/tests/org.eclipse.core.tests.runtime/testData/preferences/test3/foo
@@ -0,0 +1,3 @@
+key1=value1
+key2=value2
+sub1/key3=value3 \ No newline at end of file