Package org.lilyproject.repository.api

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


        RecordId variantRecordId = idGenerator.newRecordId(masterRecordId, variantProperties);

        // Test string representation is what it is supposed to be
        String variantRecordIdString = masterRecordId.toString() + ".dim1=dimvalue1,dim2=dimvalue2";
        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()));
    }
View Full Code Here


        String variantRecordIdString = masterRecordId.toString() + ".dim1=dimvalue1,dim2=dimvalue2";
        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() {
View Full Code Here

        // 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

    @Test
    public void testNullCharacterNotAllowedInUserId() {
        IdGenerator idGenerator = new IdGeneratorImpl();
        try {
            idGenerator.fromString("USER.hello\u0000world");
            fail("Expected an exception when using zero byte in string.");
        } catch (IllegalArgumentException e) {
            // expected
        }
        try {
View Full Code Here

    @Test
    public void testReservedCharacterUnEscapingInUserId() {
        IdGenerator idGenerator = new IdGeneratorImpl();
        String idString = "USER.special\\.characters\\,are\\=fun\\\\.key=hoeba\\=hoep";
        RecordId recordId = idGenerator.fromString(idString);
        String encodedString = recordId.toString();

        assertEquals(idString, encodedString);
    }
View Full Code Here

    }

    private void testNotAllowedChar(char c) {
        IdGenerator idGenerator = new IdGeneratorImpl();
        try {
            idGenerator.fromString("USER.hello" + c + "world");
            fail("Expected an exception when using character " + c);
        } catch (IllegalArgumentException e) {
            // expected
        }
    }
View Full Code Here

    private void testEscapedNotAllowedChar(char c) {
        IdGenerator idGenerator = new IdGeneratorImpl();
        String idString = "USER.hello\\" + c + "world";
        try {
            RecordId recordId = idGenerator.fromString(idString);
            assertEquals(idString, recordId.toString());
        } catch (IllegalArgumentException e) {
            // expected
        }
    }
View Full Code Here

    }

    @Test
    public void testMap() throws Exception {
        IdGenerator idGenerator = new IdGeneratorImpl();
        System.out.println(Bytes.toString(idGenerator.fromString("USER.batch-index-custom").toBytes()));
        LTable table = repository.getDefaultTable();
        Record record = table.recordBuilder()
                .assignNewUuid()
                .recordType(new QName(NS1, "rt1"))
                .field(new QName(NS1, "a_string"), "myvalue")
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.