Search in sources :

Example 21 with Row

use of com.airbnb.spinaltap.mysql.mutation.schema.Row in project SpinalTap by airbnb.

the class MutationSchemaValidatorTest method testIncorrectColumnDataType.

@Test(expected = IllegalStateException.class)
public void testIncorrectColumnDataType() throws Exception {
    Row row = new Row(TABLE, ImmutableMap.of(ID_COLUMN, createColumn(ID_COLUMN, ColumnDataType.LONGLONG, true, 1L, 0), NAME_COLUMN, createColumn(NAME_COLUMN, ColumnDataType.VARCHAR, false, "bob", 1), AGE_COLUMN, createColumn(AGE_COLUMN, ColumnDataType.LONGLONG, false, 25, 2)));
    validator.validate(createMutation(row));
}
Also used : Row(com.airbnb.spinaltap.mysql.mutation.schema.Row) Test(org.junit.Test)

Example 22 with Row

use of com.airbnb.spinaltap.mysql.mutation.schema.Row in project SpinalTap by airbnb.

the class MutationSchemaValidatorTest method testValidSchema.

@Test
public void testValidSchema() throws Exception {
    Row row = new Row(TABLE, ImmutableMap.of(ID_COLUMN, createColumn(ID_COLUMN, ColumnDataType.LONGLONG, true, 1L, 0), NAME_COLUMN, createColumn(NAME_COLUMN, ColumnDataType.VARCHAR, false, "bob", 1), AGE_COLUMN, createColumn(AGE_COLUMN, ColumnDataType.INT24, false, 25, 2)));
    validator.validate(createMutation(row));
}
Also used : Row(com.airbnb.spinaltap.mysql.mutation.schema.Row) Test(org.junit.Test)

Aggregations

Row (com.airbnb.spinaltap.mysql.mutation.schema.Row)22 Test (org.junit.Test)17 ColumnMetadata (com.airbnb.spinaltap.mysql.mutation.schema.ColumnMetadata)9 Column (com.airbnb.spinaltap.mysql.mutation.schema.Column)8 Table (com.airbnb.spinaltap.mysql.mutation.schema.Table)7 MysqlInsertMutation (com.airbnb.spinaltap.mysql.mutation.MysqlInsertMutation)6 Serializable (java.io.Serializable)6 BinlogEvent (com.airbnb.spinaltap.mysql.event.BinlogEvent)5 MysqlDeleteMutation (com.airbnb.spinaltap.mysql.mutation.MysqlDeleteMutation)5 MysqlUpdateMutation (com.airbnb.spinaltap.mysql.mutation.MysqlUpdateMutation)4 UpdateEvent (com.airbnb.spinaltap.mysql.event.UpdateEvent)3 MysqlMutation (com.airbnb.spinaltap.mysql.mutation.MysqlMutation)3 MysqlMutationMetadata (com.airbnb.spinaltap.mysql.mutation.MysqlMutationMetadata)3 AbstractMap (java.util.AbstractMap)3 Map (java.util.Map)3 ArrayList (java.util.ArrayList)2 Mutation (com.airbnb.jitney.event.spinaltap.v1.Mutation)1 SourceState (com.airbnb.spinaltap.common.source.SourceState)1 BinlogFilePos (com.airbnb.spinaltap.mysql.BinlogFilePos)1 DataSource (com.airbnb.spinaltap.mysql.DataSource)1