* - initial layout has a reader for an empty record
* - layout update adds a writer schema with a compatible record with one optional integer.
*/
@Test
public void testValidLayoutUpdate() throws IOException {
final Kiji kiji = getKiji();
final TableLayoutDesc desc = KijiTableLayouts.getLayout(KijiTableLayouts.SCHEMA_REG_TEST);
desc.setVersion("layout-1.3.0");
final Schema emptyRecordSchema = Schema.createRecord("Record", null, "org.ns", false);
emptyRecordSchema.setFields(Lists.<Field>newArrayList());
final Schema optIntRecordSchema = Schema.createRecord("Record", null, "org.ns", false);
optIntRecordSchema.setFields(Lists.newArrayList(
new Field("a", INT_SCHEMA, null, IntNode.valueOf(0))));
final TableLayoutDesc originalDesc = new TableLayoutBuilder(desc, kiji)
.withAvroValidationPolicy(
KijiColumnName.create("info:fullname"), AvroValidationPolicy.STRICT)
.withReader(KijiColumnName.create("info:fullname"), emptyRecordSchema)
.build();
kiji.createTable(originalDesc);
final TableLayoutDesc newDesc = new TableLayoutBuilder(originalDesc, kiji)
.withWriter(KijiColumnName.create("info:fullname"), optIntRecordSchema)
.build();
kiji.modifyTableLayout(newDesc);
}