Package java.util

Examples of java.util.UUID.version()


    @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


        if (bytes.remaining() != 16)
        {
            throw new MarshalException("UUIDs must be exactly 16 bytes");
        }
        UUID uuid = UUIDGen.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

     * @see UUID#randomUUID()
     */
    public void test_randomUUID() {
        UUID uuid = UUID.randomUUID();
        assertEquals(2, uuid.variant());
        assertEquals(4, uuid.version());
    }

    /**
     * @see UUID#nameUUIDFromBytes(byte[])
     */
 
View Full Code Here

                (byte) 0x4f, (byte) 0xd4, (byte) 0x30, (byte) 0xc8 };

        UUID uuid = UUID.nameUUIDFromBytes(name);

        assertEquals(2, uuid.variant());
        assertEquals(3, uuid.version());

        assertEquals(0xaff565bc2f771745L, uuid.getLeastSignificantBits());
        assertEquals(0x14cdb9b4de013faaL, uuid.getMostSignificantBits());

        uuid = UUID.nameUUIDFromBytes(new byte[0]);
View Full Code Here

        assertEquals(0xaff565bc2f771745L, uuid.getLeastSignificantBits());
        assertEquals(0x14cdb9b4de013faaL, uuid.getMostSignificantBits());

        uuid = UUID.nameUUIDFromBytes(new byte[0]);
        assertEquals(2, uuid.variant());
        assertEquals(3, uuid.version());

        assertEquals(0xa9800998ecf8427eL, uuid.getLeastSignificantBits());
        assertEquals(0xd41d8cd98f003204L, uuid.getMostSignificantBits());

        try {
View Full Code Here

     * @see UUID#UUID(long, long)
     */
    public void test_ConstructurJJ() {
        UUID uuid = new UUID(0xf81d4fae7dec11d0L, 0xa76500a0c91e6bf6L);
        assertEquals(2, uuid.variant());
        assertEquals(1, uuid.version());
        assertEquals(0x1d07decf81d4faeL, uuid.timestamp());
        assertEquals(130742845922168750L, uuid.timestamp());
        assertEquals(0x2765, uuid.clockSequence());
        assertEquals(0xA0C91E6BF6L, uuid.node());
    }
View Full Code Here

    /**
     * @see UUID#version()
     */
    public void test_version() {
        UUID uuid = new UUID(0, 0);
        assertEquals(0, 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);
View Full Code Here

     */
    public void test_version() {
        UUID uuid = new UUID(0, 0);
        assertEquals(0, 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);
View Full Code Here

        UUID uuid = new UUID(0, 0);
        assertEquals(0, 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);
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.