Fixed Bug 52014 - automated tests for registry cache reader/writer
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/AllTests.java
index 5ecc4c3..855bb6a 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/AllTests.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/AllTests.java
@@ -22,6 +22,7 @@
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(RegistryCacheTest.suite());
+ suite.addTest(LazyRegistryCacheTest.suite());
return suite;
}
}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/LazyRegistryCacheTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/LazyRegistryCacheTest.java
new file mode 100644
index 0000000..a1ba9cf
--- /dev/null
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/LazyRegistryCacheTest.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.tests.internal.registrycache;
+
+import java.io.File;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.core.internal.registry.Factory;
+import org.eclipse.core.internal.registry.RegistryCacheReader;
+import org.eclipse.core.runtime.IPlatform;
+import org.eclipse.core.runtime.MultiStatus;
+
+public class LazyRegistryCacheTest extends RegistryCacheTest {
+ public LazyRegistryCacheTest(String name) {
+ super(name);
+ }
+ protected RegistryCacheReader createRegistryReader(File cacheFile) {
+ return new RegistryCacheReader(cacheFile, new Factory(new MultiStatus(IPlatform.PI_RUNTIME, 0, "", null)), true);
+ }
+ public static Test suite() {
+ return new TestSuite(LazyRegistryCacheTest.class);
+ }
+}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/RegistryCacheTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/RegistryCacheTest.java
index d7a7e0f..e923657 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/RegistryCacheTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registrycache/RegistryCacheTest.java
@@ -23,7 +23,7 @@
private static final String BUNDLE_B_WITH_EXTENSION = "<plugin id=\"bundleB\"><extension point=\"bundleA.xp1\"><cfg1 property=\"value\"><cfg11/></cfg1><cfg2/></extension></plugin>";
private static final String BUNDLE_A_WITH_EXTENSION_POINT = "<plugin id=\"bundleA\"><extension-point id=\"xp1\"/></plugin>";
private static final String BUNDLE_A_WITH_EXTENSION_AND_EXTENSION_POINT = "<plugin id=\"bundleA\"><extension-point id=\"xp1\"/><extension point=\"bundleA.xp1\"><cfg1 property=\"value\"><cfg11/></cfg1><cfg2/></extension></plugin>";
- private ExtensionRegistry registry;
+ protected ExtensionRegistry registry;
public RegistryCacheTest(String name) {
super(name);
}
@@ -41,12 +41,15 @@
try {
new RegistryCacheWriter(cacheFile).saveCache(registry);
assertTrue("file not created", cacheFile.isFile());
- ExtensionRegistry cached = new RegistryCacheReader(cacheFile, new Factory(new MultiStatus(IPlatform.PI_RUNTIME, 0, "", null)), false).loadCache();
+ ExtensionRegistry cached = createRegistryReader(cacheFile).loadCache();
assertEquals(registry, cached);
} finally {
ensureDoesNotExistInFileSystem(cacheFile);
}
}
+ protected RegistryCacheReader createRegistryReader(File cacheFile) {
+ return new RegistryCacheReader(cacheFile, new Factory(new MultiStatus(IPlatform.PI_RUNTIME, 0, "", null)), false);
+ }
/**
* Two plugins, one declaring an extension point and the other, an extension.
*/
@@ -61,7 +64,7 @@
try {
new RegistryCacheWriter(cacheFile).saveCache(registry);
assertTrue("file not created", cacheFile.isFile());
- ExtensionRegistry cached = new RegistryCacheReader(cacheFile, new Factory(new MultiStatus(IPlatform.PI_RUNTIME, 0, "", null)), false).loadCache();
+ ExtensionRegistry cached = createRegistryReader(cacheFile).loadCache();
assertEquals(registry, cached);
} finally {
ensureDoesNotExistInFileSystem(cacheFile);