Author: anil.saldhana(a)jboss.com
Date: 2008-09-11 16:51:52 -0400 (Thu, 11 Sep 2008)
New Revision: 80
Added:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/UUIDPseudonymGenerator.java
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/PseudonymGeneratorUnitTestCase.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/PseudonymGenerator.java
Log:
JBID-30: pseudonym gen
Added:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/UUIDPseudonymGenerator.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/UUIDPseudonymGenerator.java
(rev 0)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/UUIDPseudonymGenerator.java 2008-09-11
20:51:52 UTC (rev 80)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.identity.impl.fedid;
+
+import org.jboss.identity.spi.fedid.PseudonymGenerator;
+
+/**
+ * Pseudonym generator that is
+ * based on the JDK5+s UUID Generator
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Sep 11, 2008
+ */
+public class UUIDPseudonymGenerator implements PseudonymGenerator
+{
+ /**
+ * @see PseudonymGenerator#generatePseudonym()
+ */
+ public String generatePseudonym()
+ {
+ return java.util.UUID.randomUUID().toString();
+ }
+}
\ No newline at end of file
Added:
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/PseudonymGeneratorUnitTestCase.java
===================================================================
---
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/PseudonymGeneratorUnitTestCase.java
(rev 0)
+++
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/PseudonymGeneratorUnitTestCase.java 2008-09-11
20:51:52 UTC (rev 80)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.identity.impl.test.fedid;
+
+import org.jboss.identity.impl.fedid.UUIDPseudonymGenerator;
+import org.jboss.identity.spi.fedid.PseudonymGenerator;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit Test the pseudonym generator
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Sep 11, 2008
+ */
+public class PseudonymGeneratorUnitTestCase extends TestCase
+{
+ public void testUUID()
+ {
+ PseudonymGenerator pseudoGen = new UUIDPseudonymGenerator();
+ String first = pseudoGen.generatePseudonym();
+ String second = pseudoGen.generatePseudonym();
+ String third = pseudoGen.generatePseudonym();
+
+ assertFalse(first.equals(second));
+ assertFalse(third.equals(second));
+ assertFalse(first.equals(third));
+ }
+}
\ No newline at end of file
Added:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/PseudonymGenerator.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/PseudonymGenerator.java
(rev 0)
+++
trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/PseudonymGenerator.java 2008-09-11
20:51:52 UTC (rev 80)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.identity.spi.fedid;
+
+/**
+ * Generator for Pseudonyms
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Sep 11, 2008
+ */
+public interface PseudonymGenerator
+{
+ /**
+ * Generate a pseudonym
+ * @return
+ */
+ String generatePseudonym();
+}
\ No newline at end of file