[324927] Do not serialize configurations that are contributed by Eclipse plug-ins.

Signed-off-by: Florian Thienel <florian@thienel.org>
diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/META-INF/MANIFEST.MF b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/META-INF/MANIFEST.MF
index f1fe955..b92aa6f 100644
--- a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/META-INF/MANIFEST.MF
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.wst.xml.vex.ui.tests
+Bundle-SymbolicName: org.eclipse.wst.xml.vex.ui.tests;singleton:=true
 Bundle-Version: 0.5.0.qualifier
 Bundle-Vendor: %providerName
 Require-Bundle: org.eclipse.ui,
diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/build.properties b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/build.properties
index aa1a008..8cc14a1 100644
--- a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/build.properties
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/build.properties
@@ -2,4 +2,6 @@
 output.. = bin/
 bin.includes = META-INF/,\
                .,\
-               plugin.properties
+               plugin.properties,\
+               plugin.xml,\
+               testdata/
diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.xml b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.xml
new file mode 100644
index 0000000..4528bd3
--- /dev/null
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<?eclipse version="3.4"?>

+<plugin>

+   <extension

+         id="test"

+         name="test doctype"

+         point="org.eclipse.wst.xml.vex.ui.doctypes">

+      <doctype

+            systemId="test.dtd"

+            dtd="testdata/test.dtd"

+            publicId="-//Vex//DTD Test//EN">

+      </doctype>

+   </extension>

+   <extension

+         id="test"

+         name="test style"

+         point="org.eclipse.wst.xml.vex.ui.styles">

+      <style

+            css="testdata/test.css">

+         <doctypeRef

+               publicId="-//Vex//DTD Test//EN">

+         </doctypeRef>

+      </style>

+   </extension>

+

+</plugin>

diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigLoaderJobTest.java b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigLoaderJobTest.java
new file mode 100644
index 0000000..5262ef3
--- /dev/null
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigLoaderJobTest.java
@@ -0,0 +1,51 @@
+package org.eclipse.wst.xml.vex.ui.internal.config.tests;

+

+import static org.junit.Assert.assertNotNull;

+import static org.junit.Assert.assertTrue;

+import static org.junit.Assert.fail;

+

+import java.util.HashSet;

+import java.util.List;

+

+import org.eclipse.wst.xml.vex.ui.internal.config.ConfigLoaderJob;

+import org.eclipse.wst.xml.vex.ui.internal.config.ConfigRegistry;

+import org.eclipse.wst.xml.vex.ui.internal.config.ConfigSource;

+import org.junit.Before;

+import org.junit.Test;

+

+@SuppressWarnings("restriction")

+public class ConfigLoaderJobTest {

+

+	@Before

+	public void setUp() throws Exception {

+		ConfigRegistry.getInstance().clear();

+	}

+	

+	@Test

+	public void loadUiTestsPlugin() throws Exception {

+		assertTrue(ConfigRegistry.getInstance().getAllConfigSources().isEmpty());

+		final ConfigLoaderJob job = new ConfigLoaderJob();

+		job.schedule();

+		job.join();

+		List<ConfigSource> allConfigSources = ConfigRegistry.getInstance().getAllConfigSources();

+		assertContainsTestsPlugin(allConfigSources);

+		assertContainsEachPluginOnlyOnce(allConfigSources);

+	}

+	

+	private static void assertContainsTestsPlugin(final List<ConfigSource> configSources) {

+		for (ConfigSource configSource : configSources)

+			if ("org.eclipse.wst.xml.vex.ui.tests".equals(configSource.getUniqueIdentifer())) {

+				assertNotNull(configSource.getItemForResource("testdata/test.dtd"));

+				assertNotNull(configSource.getItemForResource("testdata/test.css"));

+				return;

+			}

+		fail("Cannot find extension from plug-in org.eclipse.wst.xml.vex.ui.tests.");

+	}

+	

+	private static void assertContainsEachPluginOnlyOnce(final List<ConfigSource> configSources) {

+		final HashSet<String> configSourceIds = new HashSet<String>();

+		for (ConfigSource configSource : configSources)

+			assertTrue("ConfigRegistry contains " + configSource.getUniqueIdentifer() + " twice.", configSourceIds.add(configSource.getUniqueIdentifer()));

+	}

+

+}

diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/tests/VexUiTestSuite.java b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/tests/VexUiTestSuite.java
index 0ffd033..5c5be93 100644
--- a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/tests/VexUiTestSuite.java
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/tests/VexUiTestSuite.java
@@ -10,9 +10,11 @@
  *******************************************************************************/
 package org.eclipse.wst.xml.vex.ui.tests;
 
+import junit.framework.JUnit4TestAdapter;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.eclipse.wst.xml.vex.ui.internal.config.tests.ConfigLoaderJobTest;
 import org.eclipse.wst.xml.vex.ui.internal.editor.tests.FindReplaceTargetTest;
 import org.eclipse.wst.xml.vex.ui.internal.tests.ResourceTrackerTest;
 
@@ -24,6 +26,7 @@
 
 	public VexUiTestSuite() {
 		super("Vex UI Tests"); //$NON-NLS-1$
+		addTest(new JUnit4TestAdapter(ConfigLoaderJobTest.class));
 		addTestSuite(IconTest.class);
 		addTestSuite(FindReplaceTargetTest.class);
 		addTestSuite(ResourceTrackerTest.class);
diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/testdata/test.css b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/testdata/test.css
new file mode 100644
index 0000000..9a83031
--- /dev/null
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/testdata/test.css
@@ -0,0 +1,53 @@
+
+html {
+  display: block;
+}
+
+body {
+  display: block;
+}
+
+p {
+  display: block;
+}
+
+block {
+  display: block;
+}
+
+pre {
+  display: block;
+  white-space: pre;
+}
+
+
+/* Styles for positioning tests */
+root {
+  border: 3px 7px 11px 13px;
+  padding: 17px 19px 23px 29px;
+}
+
+small {
+  border-width: 1px 2px 3px 4px;
+  border-style: solid;
+  margin: 100px 200px 300px 400px;
+  padding: 10px 20px 30px 40px;
+  display: block;
+}
+
+medium {
+  border-width: 2px 4px 6px 8px;
+  border-style: solid;
+  margin: 200px 400px 600px 800px;
+  padding: 20px 40px 60px 80px;
+  display: block;
+}
+
+large {
+  border-width: 3px 6px 9px 12px;
+  border-style: solid;
+  margin: 300px 600px 900px 1200px;
+  padding: 30px 60px 90px 120px;
+  display: block;
+}
+
diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/testdata/test.dtd b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/testdata/test.dtd
new file mode 100644
index 0000000..f246a88
--- /dev/null
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/testdata/test.dtd
@@ -0,0 +1,10 @@
+<!ELEMENT any ANY>
+<!ELEMENT empty EMPTY>
+<!ELEMENT section (title?, para+)>
+<!ELEMENT para (#PCDATA | emphasis)*>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT emphasis (#PCDATA)>
+
+<!-- a dummy attribute, just to make sure attribute def serialization is OK -->
+<!ATTLIST section
+	name	CDATA	#IMPLIED>
\ No newline at end of file