commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davide Ling (JIRA)" <j...@apache.org>
Subject [jira] Created: (SANDBOX-307) UUID URN version 5 generation
Date Thu, 26 Mar 2009 13:06:54 GMT
UUID URN version 5 generation
-----------------------------

                 Key: SANDBOX-307
                 URL: https://issues.apache.org/jira/browse/SANDBOX-307
             Project: Commons Sandbox
          Issue Type: Bug
          Components: Id
    Affects Versions: Nightly Builds
         Environment: Linux Ubuntu 8.10
JDK 1.6.10
            Reporter: Davide Ling


The following test fail with the message:
org.junit.ComparisonFailure:
      expected:<...:uuid:be6a1b75-9a58-[5]4a8-972e-791dfdd8815...> but was:<...:uuid:be6a1b75-9a58-[3]4a8-972e-791dfdd8815...>
	at org.junit.Assert.assertEquals(Assert.java:123)
	at org.junit.Assert.assertEquals(Assert.java:145)
	at org.davideling.provauuid.ProvaUUIDTest.testUUID(ProvaUUIDTest.java:25)

public class UUIDVersion5Test {

	// Linux generated URN using the uuid command:
	//		davide@mydebian:~$ uuid -v 5 6ba7b811-9dad-11d1-80b4-00c04fd430c8 http://davideling.org/miaApp/2
	//		davide@mydebian:~$ be6a1b75-9a58-54a8-972e-791dfdd8815b
	private static final String LINUX_GENERATED_URN = "urn:uuid:be6a1b75-9a58-54a8-972e-791dfdd8815b";
	
	// URL UUID namespace
	private static final UUID NAMESPACE = new UUID("6ba7b811-9dad-11d1-80b4-00c04fd430c8");
	
	// Name
	private static final String NAME = "http://davideling.org/miaApp/2";
	
	@Test
	public void testUUID() throws Exception {
		
		UUID uuid = UUID.nameUUIDFromString(NAME, NAMESPACE, UUID.SHA1_ENCODING);
		
		assertEquals(LINUX_GENERATED_URN, uuid.toUrn() );
	}
	
}

When using the SHA1 algorithm with UUID.nameUUIDFromString the version field have to be 5
(?) as the
Linux uuid generated URN?



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message