Package io.crate.metadata

Examples of io.crate.metadata.ColumnIdent


            new BytesRef("0"),
            new BytesRef("/tmp/blobs_path"));

    @Test
    public void testGetColumnInfo() throws Exception {
        ReferenceInfo foobar = info.getReferenceInfo(new ColumnIdent("digest"));
        assertNotNull(foobar);
        assertEquals(DataTypes.STRING, foobar.type());

        DynamicReference reference = info.getDynamic(new ColumnIdent("foobar"));
        assertNull(reference);
    }
View Full Code Here


    }

    @Test
    public void testPrimaryKey() throws Exception {
        assertEquals(Arrays.asList(new ColumnIdent[]{
                new ColumnIdent("digest")
        }), info.primaryKey());
    }
View Full Code Here

        }), info.primaryKey());
    }

    @Test
    public void testClusteredBy() throws Exception {
        assertEquals(new ColumnIdent("digest"), info.clusteredBy());
    }
View Full Code Here

public class IdTest {

    @Test
    public void testAutoGenerated() throws Exception {
        Id id = new Id(ImmutableList.of(new ColumnIdent("_id")), ImmutableList.<BytesRef>of(), new ColumnIdent("_id"));

        assertThat(id.values().size(), is(1));
        assertThat(id.stringValue(), is(id.values().get(0).utf8ToString()));
    }
View Full Code Here

        assertThat(id.stringValue(), is(id.values().get(0).utf8ToString()));
    }

    @Test
    public void testAutoGeneratedWithRouting() throws Exception {
        Id id = new Id(ImmutableList.of(new ColumnIdent("_id")), ImmutableList.<BytesRef>of(), new ColumnIdent("foo"));

        assertThat(id.values().size(), is(1));
        assertThat(id.stringValue(), is(id.values().get(0).utf8ToString()));
    }
View Full Code Here

        assertThat(id.stringValue(), is(id.values().get(0).utf8ToString()));
    }

    @Test
    public void testSinglePrimaryKey() throws Exception {
        Id id = new Id(ImmutableList.of(new ColumnIdent("id")), ImmutableList.of(new BytesRef("1")), new ColumnIdent("id"));

        assertThat(id.values().size(), is(1));
        assertThat(id.stringValue(), is(id.values().get(0).utf8ToString()));
    }
View Full Code Here

        assertThat(id.stringValue(), is(id.values().get(0).utf8ToString()));
    }

    @Test (expected = UnsupportedOperationException.class)
    public void testSinglePrimaryKeyWithoutValue() throws Exception {
        Id id = new Id(ImmutableList.of(new ColumnIdent("id")), ImmutableList.<BytesRef>of(), new ColumnIdent("id"));
    }
View Full Code Here

        Id id = new Id(ImmutableList.of(new ColumnIdent("id")), ImmutableList.<BytesRef>of(), new ColumnIdent("id"));
    }

    @Test
    public void testMultiplePrimaryKey() throws Exception {
        Id id = new Id(ImmutableList.of(new ColumnIdent("id"), new ColumnIdent("name")), ImmutableList.of(new BytesRef("1"), new BytesRef("foo")), null);

        assertThat(id.values().size(), is(2));
        assertEquals(ImmutableList.of(new BytesRef("1"), new BytesRef("foo")), id.values());

        Id id1 = Id.fromString(id.stringValue());
View Full Code Here

        assertEquals(id.values(), id1.values());
    }

    @Test
    public void testMultiplePrimaryKeyWithClusteredBy() throws Exception {
        Id id = new Id(ImmutableList.of(new ColumnIdent("id"), new ColumnIdent("name")), ImmutableList.of(new BytesRef("1"), new BytesRef("foo")), new ColumnIdent("name"));

        assertThat(id.values().size(), is(2));
        assertEquals(ImmutableList.of(new BytesRef("foo"), new BytesRef("1")), id.values());

        Id id1 = Id.fromString(id.stringValue());
View Full Code Here

        assertEquals(id.values(), id1.values());
    }

    @Test
    public void testNull() throws Exception {
        Id id = new Id(ImmutableList.of(new ColumnIdent("id")), new ArrayList<BytesRef>(){{add(null);}}, new ColumnIdent("id"));

        assertThat(id.values().size(), is(0));
        assertEquals(null, id.stringValue());
    }
View Full Code Here

TOP

Related Classes of io.crate.metadata.ColumnIdent

Copyright © 2018 www.massapicom. 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.