Added UuIDTest to org.eclipse.ecf.tests.core for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=464819

Change-Id: I7105df882be22fe9317e412e978fddc434f29229
diff --git a/tests/bundles/org.eclipse.ecf.tests.core/.classpath b/tests/bundles/org.eclipse.ecf.tests.core/.classpath
index 2fbb7a2..64c5e31 100644
--- a/tests/bundles/org.eclipse.ecf.tests.core/.classpath
+++ b/tests/bundles/org.eclipse.ecf.tests.core/.classpath
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="output" path="bin"/>
diff --git a/tests/bundles/org.eclipse.ecf.tests.core/.settings/org.eclipse.jdt.core.prefs b/tests/bundles/org.eclipse.ecf.tests.core/.settings/org.eclipse.jdt.core.prefs
index 3568415..416f4fb 100644
--- a/tests/bundles/org.eclipse.ecf.tests.core/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/bundles/org.eclipse.ecf.tests.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,11 +1,11 @@
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/bundles/org.eclipse.ecf.tests.core/META-INF/MANIFEST.MF b/tests/bundles/org.eclipse.ecf.tests.core/META-INF/MANIFEST.MF
index 11d8334..d57135d 100644
--- a/tests/bundles/org.eclipse.ecf.tests.core/META-INF/MANIFEST.MF
+++ b/tests/bundles/org.eclipse.ecf.tests.core/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@
 Bundle-Version: 1.0.0.qualifier
 Bundle-Activator: org.eclipse.ecf.internal.tests.core.Activator
 Bundle-Vendor: Eclipse.org - ECF
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Import-Package: org.osgi.framework;version="1.3.0",
  org.osgi.util.tracker;version="1.5.1"
 Bundle-ActivationPolicy: lazy
diff --git a/tests/bundles/org.eclipse.ecf.tests.core/src/org/eclipse/ecf/tests/core/identity/UuIDTest.java b/tests/bundles/org.eclipse.ecf.tests.core/src/org/eclipse/ecf/tests/core/identity/UuIDTest.java
new file mode 100644
index 0000000..b644725
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.core/src/org/eclipse/ecf/tests/core/identity/UuIDTest.java
@@ -0,0 +1,135 @@
+/****************************************************************************
+ * Copyright (c) 2004 Composent, Inc. 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:
+ *    Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.tests.core.identity;
+
+import java.io.ByteArrayOutputStream;
+import java.io.NotSerializableException;
+import java.io.ObjectOutputStream;
+import java.net.URI;
+import java.util.UUID;
+
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.identity.IDCreateException;
+import org.eclipse.ecf.core.identity.IDFactory;
+import org.eclipse.ecf.core.identity.Namespace;
+
+public class UuIDTest extends IDAbstractTestCase {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ecf.tests.IDTestCase#createID()
+	 */
+
+	public ID createID() {
+		return IDFactory.getDefault().createUuID();
+	}
+	
+	public void testCreateRandom() throws Exception {
+		final ID newID = createID();
+		assertNotNull(newID);
+	}
+
+	public void testCreateUUID() throws Exception {
+		final ID newID = IDFactory.getDefault().createUuID(UUID.randomUUID());
+		assertNotNull(newID);
+	}
+
+	public void testCreateString() throws Exception {
+		final ID newID = IDFactory.getDefault().createUuID(UUID.randomUUID().toString());
+		assertNotNull(newID);
+	}
+
+	public void testCreateURI() throws Exception {
+		final ID newID = IDFactory.getDefault().createUuID(new URI("uuid:"+UUID.randomUUID()));
+		assertNotNull(newID);
+	}
+
+	public void testGetName() throws Exception {
+		UUID uuid = UUID.randomUUID();
+		final ID id1 = IDFactory.getDefault().createUuID(uuid);
+		final ID id2 = IDFactory.getDefault().createUuID(uuid);
+		assertTrue(id1.getName().equals(id2.getName()));
+	}
+
+	public void testToExternalForm() throws Exception {
+		final ID id = createID();
+		assertNotNull(id.toExternalForm());
+	}
+
+	public void testToString() throws Exception {
+		final ID id = IDFactory.getDefault().createUuID();
+		assertNotNull(id.toString());
+	}
+
+	public void testIsEqual() throws Exception {
+		UUID uuid = UUID.randomUUID();
+		final ID id1 = IDFactory.getDefault().createUuID(uuid);
+		final ID id2 = IDFactory.getDefault().createUuID(uuid);
+		assertTrue(id1.equals(id2));
+	}
+
+	public void testHashCode() throws Exception {
+		UUID uuid = UUID.randomUUID();
+		final ID id1 = IDFactory.getDefault().createUuID(uuid);
+		final ID id2 = IDFactory.getDefault().createUuID(uuid);
+		assertTrue(id1.hashCode() == id2.hashCode());
+	}
+
+	public void testCompareToEqual() throws Exception {
+		UUID uuid = UUID.randomUUID();
+		final ID id1 = IDFactory.getDefault().createUuID(uuid);
+		final ID id2 = IDFactory.getDefault().createUuID(uuid);
+		assertTrue(id1.compareTo(id2) == 0);
+		assertTrue(id2.compareTo(id1) == 0);
+	}
+
+	public void testCompareToNotEqual() throws Exception {
+		final ID id1 = createID();
+		final ID id2 = createID();
+		assertTrue(id1.compareTo(id2) != 0);
+	}
+
+	public void testGetNamespace() throws Exception {
+		final ID id = createID();
+		final Namespace ns = id.getNamespace();
+		assertNotNull(ns);
+	}
+
+	public void testEqualNamespaces() throws Exception {
+		final ID id1 = createID();
+		final ID id2 = createID();
+		final Namespace ns1 = id1.getNamespace();
+		final Namespace ns2 = id2.getNamespace();
+		assertTrue(ns1.equals(ns2));
+		assertTrue(ns2.equals(ns2));
+	}
+
+	public void testSerializable() throws Exception {
+		final ByteArrayOutputStream buf = new ByteArrayOutputStream();
+		final ObjectOutputStream out = new ObjectOutputStream(buf);
+		try {
+			out.writeObject(createID());
+		} catch (final NotSerializableException ex) {
+			fail(ex.getLocalizedMessage());
+		} finally {
+			out.close();
+		}
+	}
+
+	public void testCreateFromExternalForm() throws Exception {
+		final ID id1 = createID();
+		final String externalForm = id1.toExternalForm();
+		final ID id2 = IDFactory.getDefault().createID(id1.getNamespace(),
+				externalForm);
+		assertTrue(id1.equals(id2));
+	}
+}