use of com.nearinfinity.honeycomb.mysql.schema.ColumnSchema in project honeycomb by altamiracorp.
the class MySqlBugIT method getTableSchema.
/**
* Provides the {@link com.nearinfinity.honeycomb.mysql.schema.TableSchema} to use for a test case
*
* @return The schema used for testing
*/
@Override
protected TableSchema getTableSchema() {
final List<ColumnSchema> columns = Lists.newArrayList();
final List<IndexSchema> indices = Lists.newArrayList();
// Add nullable, non-autoincrementing columns
columns.add(ColumnSchema.builder(TestConstants.COLUMN1, ColumnType.LONG).build());
columns.add(ColumnSchema.builder(TestConstants.COLUMN2, ColumnType.LONG).build());
// Add non-unique index on one column
indices.add(new IndexSchema(TestConstants.INDEX1, Lists.newArrayList(TestConstants.COLUMN1), false));
// Add non-unique compound index on (c1, c2)
indices.add(new IndexSchema(TestConstants.INDEX2, Lists.newArrayList(TestConstants.COLUMN1, TestConstants.COLUMN2), false));
// Add unique index on one column
indices.add(new IndexSchema(TestConstants.INDEX3, Lists.newArrayList(TestConstants.COLUMN1), true));
return new TableSchema(columns, indices);
}
use of com.nearinfinity.honeycomb.mysql.schema.ColumnSchema in project honeycomb by altamiracorp.
the class HBaseMetadataTest method testLookupTableSchemaValidTableId.
@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);
}
}));
}
use of com.nearinfinity.honeycomb.mysql.schema.ColumnSchema in project honeycomb by altamiracorp.
the class FieldParserTest method testParseValidDateFormats.
@Test
public void testParseValidDateFormats() throws ParseException {
ColumnSchema schema = ColumnSchema.builder(COLUMN_NAME, ColumnType.DATE).build();
final String expectedParsedDate = "1989-05-13";
final List<String> formats = ImmutableList.of(expectedParsedDate, "1989.05.13", "1989/05/13", "19890513");
for (final String format : formats) {
assertEquals(ByteBuffer.wrap(expectedParsedDate.getBytes()), FieldParser.parse(format, schema));
}
}
use of com.nearinfinity.honeycomb.mysql.schema.ColumnSchema in project honeycomb by altamiracorp.
the class FieldParserTest method testParseInvalidDateFormat.
@Test(expected = ParseException.class)
public void testParseInvalidDateFormat() throws ParseException {
ColumnSchema schema = ColumnSchema.builder(COLUMN_NAME, ColumnType.DATE).build();
FieldParser.parse("1989_05_13", schema);
}
use of com.nearinfinity.honeycomb.mysql.schema.ColumnSchema in project honeycomb by altamiracorp.
the class FieldParserTest method testParseInvalidDateTimeFormat.
@Test(expected = ParseException.class)
public void testParseInvalidDateTimeFormat() throws ParseException {
ColumnSchema schema = ColumnSchema.builder(COLUMN_NAME, ColumnType.DATETIME).build();
FieldParser.parse("1989_05_13_07_32_15", schema);
}
Aggregations