Package org.lilyproject.repository.impl.id

Examples of org.lilyproject.repository.impl.id.IdGeneratorImpl.fromString()


        } else {
            tableName = Table.RECORD.name;
        }

        IdGenerator idGenerator = new IdGeneratorImpl();
        RecordId recordId = idGenerator.fromString(recordIdString);

        recordRow = new RecordRow();
        recordRow.recordId = recordId;

View Full Code Here


    @Test
    public void testIdGeneratorDefault() {
        IdGenerator idGenerator = new IdGeneratorImpl();
        RecordId recordId = idGenerator.newRecordId();
        assertEquals(recordId, idGenerator.fromBytes(recordId.toBytes()));
        assertEquals(recordId, idGenerator.fromString(recordId.toString()));
    }

    @Test
    public void testUUID() {
        IdGenerator idGenerator = new IdGeneratorImpl();
View Full Code Here

    public void testUUID() {
        IdGenerator idGenerator = new IdGeneratorImpl();

        // Test string representation
        String uuidRecordIDString = "UUID.d27cdb6e-ae6d-11cf-96b8-444553540000";
        assertEquals(uuidRecordIDString, idGenerator.fromString(uuidRecordIDString).toString());

        // Check it's not recognized as a variant
        assertTrue(idGenerator.fromString(uuidRecordIDString).isMaster());

        // Test bytes representation
View Full Code Here

        // Test string representation
        String uuidRecordIDString = "UUID.d27cdb6e-ae6d-11cf-96b8-444553540000";
        assertEquals(uuidRecordIDString, idGenerator.fromString(uuidRecordIDString).toString());

        // Check it's not recognized as a variant
        assertTrue(idGenerator.fromString(uuidRecordIDString).isMaster());

        // Test bytes representation
        byte[] uuidRecordIdBytes = new byte[] {1, -46, 124, -37, 110, -82, 109, 17, -49, -106, -72, 68, 69, 83, 84, 0, 0};
        assertArrayEquals(uuidRecordIdBytes, idGenerator.fromBytes(uuidRecordIdBytes).toBytes());
View Full Code Here

        // Check it's not recognized as a variant
        assertTrue(newRecordId.isMaster());

        // Test string representation
        assertEquals(newRecordId, idGenerator.fromString(userRecordIDString));
        assertEquals(userRecordIDString, idGenerator.fromString(userRecordIDString).toString());

        // Test bytes representation cycle
        byte[] userRecordIdBytes = newRecordId.toBytes();
        assertArrayEquals(userRecordIdBytes, idGenerator.fromBytes(userRecordIdBytes).toBytes());
View Full Code Here

        // Check it's not recognized as a variant
        assertTrue(newRecordId.isMaster());

        // Test string representation
        assertEquals(newRecordId, idGenerator.fromString(userRecordIDString));
        assertEquals(userRecordIDString, idGenerator.fromString(userRecordIDString).toString());

        // Test bytes representation cycle
        byte[] userRecordIdBytes = newRecordId.toBytes();
        assertArrayEquals(userRecordIdBytes, idGenerator.fromBytes(userRecordIdBytes).toBytes());
View Full Code Here

        assertEquals(userRecordIDString, idGenerator.fromBytes(userRecordIdBytes).toString());

        // Test the bytes representation is really what we expect it to be
        byte[] idBytes = new byte[] {0, 65, 66, 67};
        String idString = "USER.ABC";
        assertArrayEquals(idBytes, idGenerator.fromString(idString).toBytes());


        byte[] withDotsBytes = new byte[] { 0, 65, 66, ':', 67, 68, '.', 69, 70 };
        String withDots = "USER.AB:CD\\.EF";
        assertArrayEquals(withDotsBytes, idGenerator.fromString(withDots).toBytes());
View Full Code Here

        assertArrayEquals(idBytes, idGenerator.fromString(idString).toBytes());


        byte[] withDotsBytes = new byte[] { 0, 65, 66, ':', 67, 68, '.', 69, 70 };
        String withDots = "USER.AB:CD\\.EF";
        assertArrayEquals(withDotsBytes, idGenerator.fromString(withDots).toBytes());
    }

    @Test
    public void testUUIDWithVariantSingleProperty() {
        IdGenerator idGenerator = new IdGeneratorImpl();
View Full Code Here

        assertFalse(variantRecordId.isMaster());

        // Test string representation is what it is supposed to be
        String variantRecordIdString = masterRecordId.toString() + ".dim1=dimvalue1";
        assertEquals(variantRecordIdString, variantRecordId.toString());
        assertEquals(variantRecordId, idGenerator.fromString(variantRecordIdString));

        // Test round-trip string & bytes conversion
        assertEquals(variantRecordId, idGenerator.fromString(variantRecordId.toString()));
        assertEquals(variantRecordId, idGenerator.fromBytes(variantRecordId.toBytes()));
View Full Code Here

        String variantRecordIdString = masterRecordId.toString() + ".dim1=dimvalue1";
        assertEquals(variantRecordIdString, variantRecordId.toString());
        assertEquals(variantRecordId, idGenerator.fromString(variantRecordIdString));

        // Test round-trip string & bytes conversion
        assertEquals(variantRecordId, idGenerator.fromString(variantRecordId.toString()));
        assertEquals(variantRecordId, idGenerator.fromBytes(variantRecordId.toBytes()));

        // Test bytes representation is really what we expect it to be
        byte[] masterIdBytes = new byte[] {
                /* uuid type marker */1,
 
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.