Package java.util

Examples of java.util.UUID.version()


{
    public void testU5_1()
    {
        JenaUUID u1 = JenaUUID.generate() ;
        UUID u2 = UUID.fromString(u1.asString()) ;
        assertEquals(u1.getVersion(), u2.version()) ;
        assertEquals(u1.getVariant(), u2.variant()) ;
    }

    public void testU5_2()
    {
View Full Code Here


        UUID u2 = UUID.fromString(u1.asString()) ;
        assertEquals(u1.getClockSequence(), u2.clockSequence()) ;
        assertEquals(u1.getTimestamp(), u2.timestamp()) ;
        assertEquals(u1.getNode(), u2.node()) ;
        assertEquals(u1.getVariant(), u2.variant()) ;
        assertEquals(u1.getVersion(), u2.version()) ;
        assertEquals(u1.getMostSignificantBits(), u2.getMostSignificantBits()) ;
        assertEquals(u1.getLeastSignificantBits(), u2.getLeastSignificantBits()) ;
    }

    public void testU5_3()
View Full Code Here

    public void testU5_3()
    {
        UUID_V4 u1 = factory4.generateV4() ;
        UUID u2 = UUID.fromString(u1.asString()) ;
        assertEquals(u1.getVariant(), u2.variant()) ;
        assertEquals(u1.getVersion(), u2.version()) ;
        assertEquals(u1.getMostSignificantBits(), u2.getMostSignificantBits()) ;
        assertEquals(u1.getLeastSignificantBits(), u2.getLeastSignificantBits()) ;
    }

    public void testU5_4()
View Full Code Here

    public void testU5_4()
    {
        UUID u1 = UUID.randomUUID() ;
        JenaUUID u2 = JenaUUID.parse(u1.toString()) ;
        assertEquals(u1.version(), u2.getVersion()) ;
        assertEquals(u1.variant(), u2.getVariant()) ;
        assertEquals(u1.getMostSignificantBits(), u2.getMostSignificantBits()) ;
        assertEquals(u1.getLeastSignificantBits(), u2.getLeastSignificantBits()) ;
        assertEquals(u1.toString(), u2.toString()) ;
    }
View Full Code Here

    public void testU5_5()
    {
        JenaUUID u1 = factory1.generate() ;
        UUID u2 = new UUID(u1.getMostSignificantBits(), u1.getLeastSignificantBits()) ;

        assertEquals(u1.getVersion(), u2.version()) ;
        assertEquals(u1.getVariant(), u2.variant()) ;
        assertEquals(u1.getMostSignificantBits(), u2.getMostSignificantBits()) ;
        assertEquals(u1.getLeastSignificantBits(), u2.getLeastSignificantBits()) ;
        assertEquals(u1.toString(), u2.toString()) ;
    }
View Full Code Here

    public void testU5_6()
    {
        JenaUUID u1 = factory4.generate() ;
        UUID u2 = new UUID(u1.getMostSignificantBits(), u1.getLeastSignificantBits()) ;

        assertEquals(u1.getVersion(), u2.version()) ;
        assertEquals(u1.getVariant(), u2.variant()) ;
        assertEquals(u1.getMostSignificantBits(), u2.getMostSignificantBits()) ;
        assertEquals(u1.getLeastSignificantBits(), u2.getLeastSignificantBits()) ;
        assertEquals(u1.toString(), u2.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

        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

    public ByteBuffer fromString(String source)
    {
        UUID uuid = UUID.fromString(source);

        if (uuid.version() != 1)
            throw new IllegalArgumentException("TimeUUID supports only version 1 UUIDs");

        return ByteBuffer.wrap(UUIDGen.decompose(uuid));
    }
View Full Code Here


      UUID uuid = new UUID( strategy.mostSignificantBits, leastSignificantBits );
      System.out.println( "  uuid : " + uuid.toString() );
      System.out.println( "  variant : " + uuid.variant() );
      System.out.println( "  version : " + uuid.version() );
      if ( uuid.variant() != 2 ) {
        throw new RuntimeException( "bad variant" );
      }
      System.out.println( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
    }
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.