Package java.util

Examples of java.util.UUID.version()


        uuid = new UUID(0x0000000000001000L, 0);
        assertEquals(1, uuid.version());
        uuid = new UUID(0x0000000000002000L, 0);
        assertEquals(2, uuid.version());
        uuid = new UUID(0x0000000000003000L, 0);
        assertEquals(3, uuid.version());
        uuid = new UUID(0x0000000000004000L, 0);
        assertEquals(4, uuid.version());
        uuid = new UUID(0x0000000000005000L, 0);
        assertEquals(5, uuid.version());
    }
View Full Code Here


        uuid = new UUID(0x0000000000002000L, 0);
        assertEquals(2, uuid.version());
        uuid = new UUID(0x0000000000003000L, 0);
        assertEquals(3, uuid.version());
        uuid = new UUID(0x0000000000004000L, 0);
        assertEquals(4, uuid.version());
        uuid = new UUID(0x0000000000005000L, 0);
        assertEquals(5, uuid.version());
    }

    /**
 
View Full Code Here

        uuid = new UUID(0x0000000000003000L, 0);
        assertEquals(3, uuid.version());
        uuid = new UUID(0x0000000000004000L, 0);
        assertEquals(4, uuid.version());
        uuid = new UUID(0x0000000000005000L, 0);
        assertEquals(5, uuid.version());
    }

    /**
     * @see UUID#variant()
     */
 
View Full Code Here

        if (bytes.length != 16)
        {
            throw new MarshalException("UUIDs must be exactly 16 bytes");
        }
        UUID uuid = LexicalUUIDType.getUUID(bytes);
        if (uuid.version() != 1)
        {
            throw new MarshalException("TimeUUID only makes sense with version 1 UUIDs");
        }
        return uuid.toString();
    }
View Full Code Here

    @Test
    public void verifyType1() throws UnknownHostException
    {
       
        UUID uuid = UUIDGen.makeType1UUIDFromHost(InetAddress.getByName("127.0.0.1"));
        assert uuid.version() == 1;
    }

    @Test
    public void verifyOrdering1() throws UnknownHostException
    {
View Full Code Here

            catch (IllegalArgumentException e)
            {
                throw new MarshalException(String.format("unable to make UUID from '%s'", source), e);
            }

            if (uuid.version() != 1)
                throw new MarshalException("TimeUUID supports only version 1 UUIDs");
        }
        else
        {
            idBytes = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes(TimestampSerializer.dateStringToTimestamp(source)));
View Full Code Here

            catch (IllegalArgumentException e)
            {
                throw new MarshalException(String.format("Unable to make UUID from '%s'", source), e);
            }

            if (uuid.version() != 1)
                throw new MarshalException("TimeUUID supports only version 1 UUIDs");
        } else
        {
            throw new MarshalException(String.format("Unknown timeuuid representation: %s", source));
        }
View Full Code Here

            catch (IllegalArgumentException e)
            {
                throw new MarshalException(String.format("unable to make UUID from '%s'", source), e);
            }

            if (uuid.version() != 1)
                throw new MarshalException("TimeUUID supports only version 1 UUIDs");
        }
        else if (source.toLowerCase().equals("now"))
        {
            idBytes = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.makeType1UUIDFromHost(FBUtilities.getBroadcastAddress())));
View Full Code Here

    @Test
    public void testValidTimeVersion()
    {
        UUID uuid1 = UUID.fromString("00000000-0000-1000-0000-000000000000");
        assert uuid1.version() == 1;
        timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid1)));
    }

    @Test(expected = MarshalException.class)
    public void testInvalidTimeVersion()
View Full Code Here

    @Test(expected = MarshalException.class)
    public void testInvalidTimeVersion()
    {
        UUID uuid2 = UUID.fromString("00000000-0000-2100-0000-000000000000");
        assert uuid2.version() == 2;
        timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid2)));
    }


}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.