Examples of fromBytes()


Examples of org.lilyproject.repository.api.IdGenerator.fromBytes()

        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,
                /* uuid bytes */-46, 124, -37, 110, -82, 109, 17, -49, -106, -72, 68, 69, 83, 84, 0, 0 };
View Full Code Here

Examples of org.lilyproject.repository.api.IdGenerator.fromBytes()

                /* length of key (vint) */, 1
                /* the key (letter X) */, 88
                /* length of value (vint) */, 3
                /* the value (ABC) */, 65, 66, 67 };

        RecordId variantId = idGenerator.newRecordId(idGenerator.fromBytes(masterIdBytes),
                Collections.singletonMap("X", "ABC"));
        assertArrayEquals(variantIdBytes, variantId.toBytes());
    }

    @Test
View Full Code Here

Examples of org.lilyproject.repository.api.IdGenerator.fromBytes()

        assertEquals(variantRecordIdString, variantRecordId.toString());
        assertEquals(variantRecordId, idGenerator.fromString(variantRecordIdString));

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

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

Examples of org.lilyproject.repository.api.IdGenerator.fromBytes()

        // Test it is recognized as variant
        assertFalse(variantId.isMaster());

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

        // Test string representation is what it is supposed to be
        String expectedString = "USER.marvellous.a=x,aa=xx";
        assertEquals(expectedString, variantId.toString());
View Full Code Here

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

    @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() {
View Full Code Here

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

        // 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());

        assertEquals(uuidRecordIDString, idGenerator.fromBytes(uuidRecordIdBytes).toString());

    }
View Full Code Here

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

        // 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());

        assertEquals(uuidRecordIDString, idGenerator.fromBytes(uuidRecordIdBytes).toString());

    }

    @Test
    public void testUSER() {
View Full Code Here

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

        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());

        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};
View Full Code Here

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

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

        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());
View Full Code Here

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

        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,
                /* uuid bytes */-46, 124, -37, 110, -82, 109, 17, -49, -106, -72, 68, 69, 83, 84, 0, 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.