Package com.foundationdb.ais.model.aisb2

Examples of com.foundationdb.ais.model.aisb2.NewAISGroupIndexBuilder


        assertEquals("Table with version", VERSION, outAIS.getTable(SCHEMA, TABLE).getVersion());
    }

    @Test
    public void sameRootTableNameTwoSchemas() {
        NewAISBuilder builder = AISBBasedBuilder.create(typesTranslator());
        builder.table(SCHEMA+"1", "t").colInt("id", false).pk("id");
        builder.table(SCHEMA+"2", "t").colInt("id", false).pk("id");
        AkibanInformationSchema inAIS = builder.ais();
        writeAndRead(inAIS);
    }
View Full Code Here


    }
   
    @Test
    public void sequenceSimple () {
        TableName seqName = new TableName (SCHEMA, "Sequence-1");
        NewAISBuilder builder = AISBBasedBuilder.create(typesTranslator());
        builder.defaultSchema(SCHEMA);
        builder.sequence(seqName.getTableName());
        AkibanInformationSchema inAIS = builder.ais();
        AkibanInformationSchema outAIS = writeAndRead(inAIS);
        assertNotNull(outAIS.getSequence(new TableName(SCHEMA, "Sequence-1")));
        Sequence sequence = outAIS.getSequence(new TableName(SCHEMA, "Sequence-1"));
        assertEquals(1, sequence.getStartsWith());
        assertEquals(1, sequence.getIncrement());
View Full Code Here

        assertTrue(!sequence.isCycle());
    }
   
    @Test
    public void sequenceComplex() {
        NewAISBuilder builder = AISBBasedBuilder.create(typesTranslator());
        builder.defaultSchema(SCHEMA);
        builder.sequence("sequence-2", 42, -2, true);
        AkibanInformationSchema inAIS = builder.ais();
        AkibanInformationSchema outAIS = writeAndRead(inAIS);
        assertNotNull(outAIS.getSequence(new TableName(SCHEMA, "sequence-2")));
        Sequence sequence = outAIS.getSequence(new TableName(SCHEMA, "sequence-2"));
        assertEquals(42, sequence.getStartsWith());
        assertEquals(-2, sequence.getIncrement());
View Full Code Here

        assertTrue(sequence.isCycle());
    }
   
    @Test
    public void sequenceTree() {
        NewAISBuilder builder = AISBBasedBuilder.create(typesTranslator());
        TableName seqName = new TableName (SCHEMA, "sequence-3");
        builder.defaultSchema(SCHEMA);
        builder.sequence("sequence-3", 42, -2, true);
        AkibanInformationSchema inAIS = builder.ais();
        Sequence inSeq = inAIS.getSequence(seqName);
        inSeq.setStorageDescription(new TestStorageDescription(inSeq, "sequence-3.tree", identifier));
       
        AkibanInformationSchema outAIS = writeAndRead(inAIS);
        assertNotNull(outAIS.getSequence(seqName));
View Full Code Here

        assertEquals ("sequence-3.tree", sequence.getStorageUniqueKey());
    }
   
    @Test
    public void columnSequence() {
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, typesTranslator());
        TableName sequenceName = new TableName (SCHEMA, "sequence-4");
        builder.sequence(sequenceName.getTableName());
        builder.table("customers").
            colBigInt("customer_id", false).
            colString("customer_name", 100, false).
            pk("customer_id");
        AkibanInformationSchema inAIS = builder.unvalidatedAIS();
        Column idColumn = inAIS.getTable(new TableName (SCHEMA, "customers")).getColumn(0);
        idColumn.setDefaultIdentity(true);
        idColumn.setIdentityGenerator(inAIS.getSequence(sequenceName));
       
        AkibanInformationSchema outAIS = writeAndRead(builder.ais());
       
        assertNotNull(outAIS.getSequence(sequenceName));
        Column outColumn = outAIS.getTable(new TableName(SCHEMA, "customers")).getColumn(0);
        assertNotNull (outColumn.getDefaultIdentity());
        assertTrue (outColumn.getDefaultIdentity());
View Full Code Here

    }

    @Test
    public void maxStorageSizeAndPrefixSize() {
        final String TABLE = "t";
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, typesTranslator());
        builder.table(TABLE).colBigInt("id");
        AkibanInformationSchema inAIS = builder.unvalidatedAIS();

        // Note: If storage* methods go away, or are non-null by default, that is *good* and these can go away
        Column inCol = inAIS.getTable(SCHEMA, TABLE).getColumn(0);
        assertNull("storedMaxStorageSize null by default", inCol.getMaxStorageSizeWithoutComputing());
        assertNull("storedPrefixSize null by default", inCol.getPrefixSizeWithoutComputing());
View Full Code Here

    }

    @Test
    public void columnDefaultValue() {
        final String TABLE = "t";
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, typesTranslator());
        builder.table(TABLE).colBigInt("id");

        AkibanInformationSchema inAIS = builder.unvalidatedAIS();
        Column inCol = inAIS.getTable(SCHEMA, TABLE).getColumn("id");

        AkibanInformationSchema outAIS = writeAndRead(inAIS);
        Column outCol = outAIS.getTable(SCHEMA, TABLE).getColumn("id");
        assertEquals("default defaultValue null", inCol.getDefaultValue(), outCol.getDefaultValue());
View Full Code Here

        assertEquals("defaultValue", inCol.getDefaultValue(), outCol.getDefaultValue());
    }

    @Test
    public void procedureJava() {
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, typesTranslator());
        builder.sqljJar("myjar")
            // A file URL would vary by testing system. But don't check exists.
            .url("http://example.com/procs.jar", false);
        builder.procedure("PROC1")
            .language("java", Routine.CallingConvention.JAVA)
            .paramLongIn("x1")
            .paramLongIn("x2")
            .paramDoubleOut("d")
            .externalName("myjar", "com.acme.Procs", "proc1")
            .sqlAllowed(Routine.SQLAllowed.READS_SQL_DATA)
            .dynamicResultSets(2);
       
        AkibanInformationSchema inAIS = builder.ais();
        AkibanInformationSchema outAIS = writeAndRead(inAIS);

        Routine proc = outAIS.getRoutine(SCHEMA, "PROC1");
        assertNotNull(proc);
       
View Full Code Here

        assertEquals(2, proc.getDynamicResultSets());
    }

    @Test
    public void procedureLoadablePlan() {
        NewAISBuilder builder = AISBBasedBuilder.create(SCHEMA, typesTranslator());
        builder.procedure("PROC2")
            .language("java", Routine.CallingConvention.LOADABLE_PLAN)
            .externalName("com.acme.Procs", "proc1");
       
        AkibanInformationSchema inAIS = builder.ais();
        AkibanInformationSchema outAIS = writeAndRead(inAIS);

        Routine proc = outAIS.getRoutine(SCHEMA, "PROC2");
       
        assertEquals("java", proc.getLanguage());
View Full Code Here

        createAndCheck(rowData);
    }

    public RowDataFormatTest(TableMaker tableMaker, Object[] fields, String bytesString) {
        TypesTranslator typesTranslator = MTypesTranslator.INSTANCE;
        NewAISBuilder aisBuilder = AISBBasedBuilder.create(SCHEMA, typesTranslator);
        NewTableBuilder tableBuilder = aisBuilder.table(TABLE).colInt("pkid");
        tableMaker.make(tableBuilder);
        tableBuilder.pk("pkid");
        AkibanInformationSchema ais = aisBuilder.ais();
        Table table = ais.getTable(SCHEMA, TABLE);
        table.setTableId(1);
        new SchemaFactory().buildRowDefs(ais);
        rowDef = ais.getTable(SCHEMA, TABLE).rowDef();
        this.fields = Arrays.copyOf(fields, fields.length);
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.model.aisb2.NewAISGroupIndexBuilder

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.