Package com.fasterxml.uuid.impl

Examples of com.fasterxml.uuid.impl.NameBasedGenerator


    {
        // this test will attempt to check for reasonable behavior of the
        // generateNameBasedUUID method
       
        // we need a instance to use
        NameBasedGenerator uuid_gen = Generators.nameBasedGenerator(NameBasedGenerator.NAMESPACE_URL);
       
        UUID uuid_array[] = new UUID[SIZE_OF_TEST_ARRAY];
       
        // now create the array of uuids
        for (int i = 0; i < uuid_array.length; i++) {
            uuid_array[i] = uuid_gen.generate("test name" + i);
        }
       
        // check that none of the UUIDs are null
        checkUUIDArrayForNonNullUUIDs(uuid_array);
       
        // check that all the uuids were correct variant and version
        checkUUIDArrayForCorrectVariantAndVersion(uuid_array, UUIDType.NAME_BASED_SHA1);
       
        // check that all uuids were unique
        checkUUIDArrayForUniqueness(uuid_array);
       
        // now create the array of uuids
        for (int i = 0; i < uuid_array.length; i++) {
            uuid_array[i] = uuid_gen.generate("test name" + i);
        }
       
        // check that none of the UUIDs are null
        checkUUIDArrayForNonNullUUIDs(uuid_array);
       
        // check that all the uuids were correct variant and version
        checkUUIDArrayForCorrectVariantAndVersion(uuid_array, UUIDType.NAME_BASED_SHA1);
       
        // check that all uuids were unique
        checkUUIDArrayForUniqueness(uuid_array);
       
        // now, lets make sure generating two sets of name based uuid with the
        // same args always gives the same result
        uuid_array = new UUID[SIZE_OF_TEST_ARRAY];

        uuid_gen = Generators.nameBasedGenerator(NameBasedGenerator.NAMESPACE_URL);
        // now create the array of uuids
        for (int i = 0; i < uuid_array.length; i++) {
            uuid_array[i] = uuid_gen.generate("test name" + i);
        }
       
        UUID uuid_array2[] = new UUID[SIZE_OF_TEST_ARRAY];
        uuid_gen = Generators.nameBasedGenerator(NameBasedGenerator.NAMESPACE_URL);
       
        // now create the array of uuids
        for (int i = 0; i < uuid_array2.length; i++) {
            uuid_array2[i] = uuid_gen.generate("test name" + i);
        }
       
        // check that none of the UUIDs are null
        checkUUIDArrayForNonNullUUIDs(uuid_array);
        checkUUIDArrayForNonNullUUIDs(uuid_array2);
View Full Code Here


        }
       
        // this test will attempt to check for reasonable behavior of the
        // generateNameBasedUUID method

        NameBasedGenerator uuid_gen = Generators.nameBasedGenerator(NameBasedGenerator.NAMESPACE_URL, MESSAGE_DIGEST);
        UUID uuid_array[] = new UUID[SIZE_OF_TEST_ARRAY];
       
        // now create the array of uuids
        for (int i = 0; i < uuid_array.length; i++)
        {
            uuid_array[i] = uuid_gen.generate("test name"+i);
        }
       
        // check that none of the UUIDs are null
        checkUUIDArrayForNonNullUUIDs(uuid_array);
       
        // check that all the uuids were correct variant and version
        checkUUIDArrayForCorrectVariantAndVersion(uuid_array, UUIDType.NAME_BASED_MD5);
       
        // check that all uuids were unique
        checkUUIDArrayForUniqueness(uuid_array);
       
        // now create the array of uuids
        for (int i = 0; i < uuid_array.length; i++)
        {
            uuid_array[i] = uuid_gen.generate("test name" + i);
        }
       
        // check that none of the UUIDs are null
        checkUUIDArrayForNonNullUUIDs(uuid_array);
       
        // check that all the uuids were correct variant and version
        checkUUIDArrayForCorrectVariantAndVersion(uuid_array, UUIDType.NAME_BASED_MD5);
       
        // check that all uuids were unique
        checkUUIDArrayForUniqueness(uuid_array);
       
        // now, lets make sure generating two sets of name based uuid with the
        // same args always gives the same result
        uuid_array = new UUID[SIZE_OF_TEST_ARRAY];
       
        // now create the array of uuids
        for (int i = 0; i < uuid_array.length; i++) {
            uuid_array[i] = uuid_gen.generate("test name" + i);
        }
       
        UUID uuid_array2[] = new UUID[SIZE_OF_TEST_ARRAY];
       
        // now create the array of uuids
        for (int i = 0; i < uuid_array2.length; i++) {
            uuid_array2[i] = uuid_gen.generate("test name" + i);
        }
       
        // check that none of the UUIDs are null
        checkUUIDArrayForNonNullUUIDs(uuid_array);
        checkUUIDArrayForNonNullUUIDs(uuid_array2);
View Full Code Here

                type = UUIDType.NAME_BASED_SHA1;
            } catch (NoSuchAlgorithmException nex) {
                throw new IllegalArgumentException("Couldn't instantiate SHA-1 MessageDigest instance: "+nex.toString());
            }
        }
        return new NameBasedGenerator(namespace, digester, type);
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.uuid.impl.NameBasedGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.