@Override public int hashCode() { return valueSchema().hashCode(); }
@Override public boolean equals(Object obj) { if ( obj == this ) return true; if ( obj instanceof TableSchema ) { TableSchema that = (TableSchema)obj; return Objects.equals(this.keySchema(),that.keySchema()) && Objects.equals(this.valueSchema(),that.valueSchema()); } return false; }
@Override public String toString() { return "{ key : " + SchemaUtil.asString(keySchema()) + ", value : " + SchemaUtil.asString(valueSchema()) + " }"; } }
protected void assertTableSchema(String fullyQualifiedTableName, String fields, Schema... types) { TableSchema tableSchema = schemaFor(fullyQualifiedTableName); Schema keySchema = tableSchema.valueSchema(); assertSchemaContent(fields.split(","), types, keySchema); }
protected void assertColumnsExcluded(String...columnNames) { Arrays.stream(columnNames).forEach(fqColumnName -> { int lastDotIdx = fqColumnName.lastIndexOf("."); String fullyQualifiedTableName = fqColumnName.substring(0, lastDotIdx); String columnName = lastDotIdx > 0 ? fqColumnName.substring(lastDotIdx + 1) : fqColumnName; TableSchema tableSchema = schemaFor(fullyQualifiedTableName); assertNotNull(fullyQualifiedTableName + " not included", tableSchema); Schema valueSchema = tableSchema.valueSchema(); assertNotNull(fullyQualifiedTableName + ".Value schema not included", valueSchema); assertNull(columnName + " not excluded;", valueSchema.field(columnName)); }); }
protected void assertTablesIncluded(String... fullyQualifiedTableNames) { Arrays.stream(fullyQualifiedTableNames).forEach(fullyQualifiedTableName -> { TableSchema tableSchema = schemaFor(fullyQualifiedTableName); assertNotNull(fullyQualifiedTableName + " not included", tableSchema); assertThat(tableSchema.keySchema().name()).isEqualTo(validFullName(fullyQualifiedTableName, ".Key")); assertThat(tableSchema.valueSchema().name()).isEqualTo(validFullName(fullyQualifiedTableName, ".Value")); }); }
protected void assertTableIncluded(String fullyQualifiedTableName) { TableId tableId = TableId.parse(fullyQualifiedTableName); TableSchema tableSchema = mysql.schemaFor(tableId); assertThat(tableSchema).isNotNull(); assertThat(tableSchema.keySchema().name()).isEqualTo(SchemaNameAdjuster.validFullname(SERVER_NAME + "." + fullyQualifiedTableName + ".Key")); assertThat(tableSchema.valueSchema().name()).isEqualTo(SchemaNameAdjuster.validFullname(SERVER_NAME + "." + fullyQualifiedTableName + ".Value")); }
assertThat(schema).isNotNull(); assertThat(schema.keySchema().name()).isEqualTo("schema.table.Key"); assertThat(schema.valueSchema().name()).isEqualTo("schema.table.Value"); assertThat(schema.valueSchema().name()).isEqualTo("testDb.testTable.Value"); assertThat(schema.valueSchema().name()).isEqualTo("testSchema.testTable.Value"); assertThat(schema.valueSchema().name()).isEqualTo("testTable.Value");
assertThat(schema.keyFromColumnData(data)).isNull(); Schema values = schema.valueSchema(); assertThat(values).isNotNull(); assertThat(values.field("C1").name()).isEqualTo("C1");
@Override public int hashCode() { return valueSchema().hashCode(); }
assertThat(tableSchema.valueSchema().field("lt")).isNull();
@Override public boolean equals(Object obj) { if ( obj == this ) return true; if ( obj instanceof TableSchema ) { TableSchema that = (TableSchema)obj; return Objects.equals(this.keySchema(),that.keySchema()) && Objects.equals(this.valueSchema(),that.valueSchema()); } return false; }
@Override public String toString() { return "{ key : " + SchemaUtil.asString(keySchema()) + ", value : " + SchemaUtil.asString(valueSchema()) + " }"; } }
protected void assertTableSchema(String fullyQualifiedTableName, String fields, Schema... types) { TableSchema tableSchema = schemaFor(fullyQualifiedTableName); Schema keySchema = tableSchema.valueSchema(); assertSchemaContent(fields.split(","), types, keySchema); }
protected void assertColumnsExcluded(String...columnNames) { Arrays.stream(columnNames).forEach(fqColumnName -> { int lastDotIdx = fqColumnName.lastIndexOf("."); String fullyQualifiedTableName = fqColumnName.substring(0, lastDotIdx); String columnName = lastDotIdx > 0 ? fqColumnName.substring(lastDotIdx + 1) : fqColumnName; TableSchema tableSchema = schemaFor(fullyQualifiedTableName); assertNotNull(fullyQualifiedTableName + " not included", tableSchema); Schema valueSchema = tableSchema.valueSchema(); assertNotNull(fullyQualifiedTableName + ".Value schema not included", valueSchema); assertNull(columnName + " not excluded;", valueSchema.field(columnName)); }); }
protected void assertTablesIncluded(String... fullyQualifiedTableNames) { Arrays.stream(fullyQualifiedTableNames).forEach(fullyQualifiedTableName -> { TableSchema tableSchema = schemaFor(fullyQualifiedTableName); assertNotNull(fullyQualifiedTableName + " not included", tableSchema); assertThat(tableSchema.keySchema().name()).isEqualTo(validFullName(fullyQualifiedTableName, ".Key")); assertThat(tableSchema.valueSchema().name()).isEqualTo(validFullName(fullyQualifiedTableName, ".Value")); }); }
protected void assertTableIncluded(String fullyQualifiedTableName) { TableId tableId = TableId.parse(fullyQualifiedTableName); TableSchema tableSchema = mysql.schemaFor(tableId); assertThat(tableSchema).isNotNull(); assertThat(tableSchema.keySchema().name()).isEqualTo(SchemaNameAdjuster.validFullname(SERVER_NAME + "." + fullyQualifiedTableName + ".Key")); assertThat(tableSchema.valueSchema().name()).isEqualTo(SchemaNameAdjuster.validFullname(SERVER_NAME + "." + fullyQualifiedTableName + ".Value")); }
assertThat(tableSchema.valueSchema().field("lt")).isNull();