Examples of AISBuilder


Examples of com.foundationdb.ais.model.AISBuilder

        builder.pk("test", "t1");
    }
   
    @Test (expected=InvalidOperationException.class)
    public void testDuplicateGroup() {
        builder = new AISBuilder();
        builder.createGroup("test", "test");
        builder.createGroup("test", "test");
    }
View Full Code Here

Examples of com.foundationdb.ais.model.AISBuilder

        builder.createGroup("test", "test");
    }

    @Test (expected=DuplicateIndexColumnException.class)
    public void testDuplicateColumnsTableIndex() {
        builder = new AISBuilder();
        builder.table("test", "t1");
        builder.column("test", "t1", "c1", 0, intType, false, null, null);
        builder.index("test", "t1", "c1_index");
        builder.indexColumn("test", "t1", "c1_index", "c1", 0, true, null);
        builder.indexColumn("test", "t1", "c1_index", "c1", 1, true, null);
View Full Code Here

Examples of com.foundationdb.ais.model.AISBuilder

        builder.groupIndexColumn("t1", "y_y", "test", "t2", "y", 0);
        builder.groupIndexColumn("t1", "y_y", "test", "t1", "y", 1);
    }

    private AISBuilder createSimpleValidGroup() {
        AISBuilder builder = new AISBuilder();
        builder.table("test", "t1");
        builder.column("test", "t1", "c1", 0, intType, false, null, null);
        builder.column("test", "t1", "x", 1, intType, false, null, null);
        builder.column("test", "t1", "y", 2, intType, false, null, null);
        builder.pk("test", "t1");
        builder.indexColumn("test", "t1", Index.PRIMARY, "c1", 0, true, null);
        builder.table("test", "t2");
        builder.column("test", "t2", "c1", 0, intType, false, null, null);
        builder.column("test", "t2", "c2", 1, intType, false, null, null);
        builder.column("test", "t2", "y", 2, intType, false, null, null);
        builder.basicSchemaIsComplete();

        builder.createGroup("t1", "test");
        builder.addTableToGroup("t1", "test", "t1");
        builder.joinTables("t2/t1", "test", "t1", "test", "t2");
        builder.joinColumns("t2/t1", "test", "t2", "c1", "test", "t2", "c2");
        builder.addJoinToGroup("t1", "t2/t1", 0);
        builder.groupingIsComplete();
        return builder;
    }
View Full Code Here

Examples of com.foundationdb.ais.model.AISBuilder

    // bug971833
    @Test
    public void tableWithNoDeclaredPK() {
        // CREATE TABLE t1(valid BOOLEAN, state CHAR(2))
        final String TABLE = "t1";
        AISBuilder builder = new AISBuilder();
        builder.table(SCHEMA, TABLE);
        builder.column(SCHEMA, TABLE, "valid", 0, typesRegistry().getTypeClass("MCOMPAT", "TINYINT").instance(true), false, null, null);
        builder.column(SCHEMA, TABLE, "state", 1, typesRegistry().getTypeClass("MCOMPAT", "CHAR").instance(2, true), false, null, null);
        builder.createGroup(TABLE, SCHEMA);
        builder.addTableToGroup(TABLE, SCHEMA, TABLE);
        builder.basicSchemaIsComplete();
        builder.groupingIsComplete();

        // AIS does not have to be validate-able to be serialized (this is how it comes from adapter)
        final AkibanInformationSchema inAIS = builder.akibanInformationSchema();
        final Table t1_1 = inAIS.getTable(SCHEMA, TABLE);
        assertNull("Source table should not have declared PK", t1_1.getPrimaryKey());
        assertNotNull("Source table should have internal PK", t1_1.getPrimaryKeyIncludingInternal());

        // Serialized AIS did not create an internal column, PK
        AkibanInformationSchema outAIS = writeAndRead(inAIS);
        Table t1_2 = outAIS.getTable(SCHEMA, TABLE);
        assertNull("Deserialized should not have declared PK", t1_2.getPrimaryKey());
        assertNotNull("Deserialized should have internal PK", t1_2.getPrimaryKeyIncludingInternal());

        compareAndAssert(inAIS, outAIS, false);

        // Now add an internal PK and run through again
        t1_1.endTable(builder.getNameGenerator());
        assertNull("Source table should not have declared PK", t1_1.getPrimaryKey());
        assertNotNull("Source table should have internal PK", t1_1.getPrimaryKeyIncludingInternal());

        outAIS = writeAndRead(inAIS);
        t1_2 = outAIS.getTable(SCHEMA, TABLE);
View Full Code Here

Examples of com.foundationdb.ais.model.AISBuilder

    @Test
    public void indexColumnIndexedLength() {
        final String TABLE = "t";
        final Integer INDEXED_LENGTH = 16;
        AISBuilder builder = new AISBuilder();
        builder.table(SCHEMA, TABLE);
        builder.column(SCHEMA, TABLE, "v", 0, typesRegistry().getTypeClass("MCOMPAT", "VARCHAR").instance(32, false), false, null, null);
        builder.index(SCHEMA, TABLE, "v");
        builder.indexColumn(SCHEMA, TABLE, "v", "v", 0, true, INDEXED_LENGTH);
        builder.createGroup(TABLE, SCHEMA);
        builder.addTableToGroup(TABLE, SCHEMA, TABLE);
        builder.basicSchemaIsComplete();
        builder.groupingIsComplete();

        AkibanInformationSchema outAIS = writeAndRead(builder.akibanInformationSchema());
        Table table = outAIS.getTable(SCHEMA, TABLE);
        assertNotNull("found table", table);
        assertNotNull("has v index", table.getIndex("v"));
        assertEquals("v indexed length", INDEXED_LENGTH, table.getIndex("v").getKeyColumns().get(0).getIndexedLength());
    }
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.