Examples of TableSchema


Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

        }

        final Generator<List<IndexSchema>> indexGen = CombinedGenerators.lists(
                new IndexSchemaGenerator(columns.build()), numIndicesGen);

        return new TableSchema(columnSchemas, indexGen.next());
    }
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

    @Test
    public void testIsValidTableSchemaValidSchema() {
        final List<ColumnSchema> columns = ImmutableList.<ColumnSchema>of(
                ColumnSchema.builder(COLUMN_B, ColumnType.LONG).setIsAutoIncrement(true).build());

        Verify.isValidTableSchema(new TableSchema(columns, ImmutableList.<IndexSchema>of()));
    }
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

    @Test
    public void testHasAutoIncrementColumn() {
        final List<ColumnSchema> columns = ImmutableList.<ColumnSchema>of(
                ColumnSchema.builder(COLUMN_B, ColumnType.LONG).setIsAutoIncrement(true).build());
        final TableSchema tableSchema = new TableSchema(columns, ImmutableList.<IndexSchema>of());

        Verify.hasAutoIncrementColumn(tableSchema);
    }
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

    @Test
    public void testHasAutoIncrementColumnNotAutoInc() {
        final List<ColumnSchema> columns = ImmutableList.<ColumnSchema>of(
                ColumnSchema.builder(COLUMN_B, ColumnType.LONG).setIsAutoIncrement(false).build());
        final TableSchema tableSchema = new TableSchema(columns, ImmutableList.<IndexSchema>of());

        Verify.hasAutoIncrementColumn(tableSchema);
    }
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

        hbaseMetadata.getTableId(TABLE_NAME);
    }

    @Test
    public void testLookupTableIdValidTableName() {
        final TableSchema schema = TABLE_SCHEMA_GEN.next();
        final String tableName = TableSchemaGenerator.MYSQL_NAME_GEN.next();

        hbaseMetadata.createTable(tableName, schema);
        assertEquals(1, hbaseMetadata.getTableId(tableName));
    }
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

        hbaseMetadata.getIndexIds(132);
    }

    @Test
    public void testLookupIndexIdsValidTableId() {
        final TableSchema tableSchema = new TableSchema(
                COLUMN_SCHEMAS,
                ImmutableList.of(new IndexSchema(INDEX_NAME, Lists.newArrayList(COLUMN_NAME), false))
        );

        hbaseMetadata.createTable(TABLE_NAME, tableSchema);
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

        hbaseMetadata.getColumnIds(132);
    }

    @Test
    public void testLookupColumnIdsValidTableId() {
        final TableSchema tableSchema = new TableSchema(COLUMN_SCHEMAS, ImmutableList.<IndexSchema>of());

        hbaseMetadata.createTable(TABLE_NAME, tableSchema);
        final long tableId = hbaseMetadata.getTableId(TABLE_NAME);

        final Map<String, Long> tableColumns = hbaseMetadata.getColumnIds(tableId);
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

        hbaseMetadata.getSchema(unknownTableId);
    }

    @Test
    public void testLookupTableSchemaValidTableId() {
        final TableSchema tableSchema = new TableSchema(COLUMN_SCHEMAS, ImmutableList.<IndexSchema>of());

        hbaseMetadata.createTable(TABLE_NAME, tableSchema);
        final long tableId = hbaseMetadata.getTableId(TABLE_NAME);

        final TableSchema schemaTwo = hbaseMetadata.getSchema(tableId);
        assertEquals(1, schemaTwo.getColumns().size());
        assertTrue(Iterables.any(schemaTwo.getColumns(), new Predicate<ColumnSchema>() {
            @Override
            public boolean apply(ColumnSchema input) {
                return input.getColumnName().equals(COLUMN_NAME);
            }
        }));
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

        }));
    }

    @Test
    public void testSchemaDeleteRemovesAllRowIds() throws Exception {
        TableSchema schema = TABLE_SCHEMA_GEN.next();
        final String tableName = TableSchemaGenerator.MYSQL_NAME_GEN.next();

        hbaseMetadata.createTable(tableName, schema);

        long tableId = hbaseMetadata.getTableId(tableName);
        TableSchema expected = hbaseMetadata.getSchema(tableId);
        assertEquals(schema, expected);

        hbaseMetadata.deleteTable(tableName);
        ResultScanner results = table.getScanner(new Scan());
        assertTrue(results.next().getNoVersionMap().size() == 1); // Table id counter
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.TableSchema

    @Test(expected = TableNotFoundException.class)
    public void testRenameExistingTableNoAutoFlush() throws Exception {
        String originalName = "OriginalName";
        String newName = "NewName";

        TableSchema origSchema = TABLE_SCHEMA_GEN.next();

        // Configure the table to disable auto flush
        HTableInterface hTableSpy = PowerMockito.spy(MockHTable.create());
        Mockito.when(hTableSpy.isAutoFlush()).thenReturn(false);

        hbaseMetadata.createTable(originalName, origSchema);

        long origId = hbaseMetadata.getTableId(originalName);
        hbaseMetadata.renameExistingTable(originalName, newName);

        long newId = hbaseMetadata.getTableId(newName);

        assertEquals(origId, newId);
        Collection<ColumnSchema> origSchemaColumns = origSchema.getColumns();
        TableSchema newSchema = hbaseMetadata.getSchema(newId);
        for (ColumnSchema columnSchema : newSchema.getColumns()) {
            assertTrue(origSchemaColumns.contains(columnSchema));
        }

        // Trying to access the id of the old table name will result in an exception
        hbaseMetadata.getTableId(originalName);
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.