Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 208564 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/core/tests/internal/preferences/PreferencesServiceTest.java (+52 lines)
Lines 1076-1081 Link Here
1076
		verifier.verify();
1076
		verifier.verify();
1077
	}
1077
	}
1078
1078
1079
	/*
1080
	 * See Bug 208564 - [Preferences] preferenceTransfer: Allow wildcards on keys
1081
	 * Since 3.6 preferenceTransfer allows to define common prefix for group of 
1082
	 * preferences 
1083
	 */
1084
	public void testExportWithTransfers4() {
1085
		final String VALID_QUALIFIER = getUniqueString();
1086
		final String COMMON_PREFIX = "PREFIX.";
1087
		IPreferenceFilter transfer = new IPreferenceFilter() {
1088
			Map result;
1089
1090
			public Map getMapping(String scope) {
1091
				if (result == null) {
1092
					result = new HashMap();
1093
					result.put(VALID_QUALIFIER, new PreferenceFilterEntry[] {new PreferenceFilterEntry(COMMON_PREFIX, true)});
1094
				}
1095
				return result;
1096
			}
1097
1098
			public String[] getScopes() {
1099
				return new String[] {InstanceScope.SCOPE};
1100
			}
1101
		};
1102
		IPreferenceFilter[] matching = null;
1103
		IPreferencesService service = Platform.getPreferencesService();
1104
1105
		IEclipsePreferences node = new InstanceScope().getNode(VALID_QUALIFIER);
1106
		String VALID_KEY_1 = COMMON_PREFIX + "key1";
1107
		String VALID_KEY_2 = COMMON_PREFIX + "key2";
1108
		String VALID_KEY_3 = "key3";
1109
		String VALID_KEY_4 = "key4";
1110
		node.put(VALID_KEY_1, "value1");
1111
		node.put(VALID_KEY_2, "value2");
1112
		node.put(VALID_KEY_3, "value3");
1113
		node.put(VALID_KEY_4, "value4");
1114
1115
		try {
1116
			matching = service.matches(service.getRootNode(), new IPreferenceFilter[] {transfer});
1117
		} catch (CoreException e) {
1118
			fail("1.00", e);
1119
		}
1120
		assertEquals("2.00", 1, matching.length);
1121
1122
		ExportVerifier verifier = new ExportVerifier(service.getRootNode(), matching);
1123
		verifier.addVersion();
1124
		verifier.addExportRoot(service.getRootNode());
1125
		verifier.addExpected(node.absolutePath(), VALID_KEY_1);
1126
		verifier.addExpected(node.absolutePath(), VALID_KEY_2);
1127
1128
		verifier.verify();
1129
	}
1130
1079
	public void testApplyWithTransfers() {
1131
	public void testApplyWithTransfers() {
1080
		// todo
1132
		// todo
1081
	}
1133
	}

Return to bug 208564