private Input createInput(TableMetadata table, Optional<TableLayoutHandle> layout, Set<Column> columns) { SchemaTableName schemaTable = table.getTable(); Optional<Object> inputMetadata = layout.flatMap(tableLayout -> metadata.getInfo(session, tableLayout)); return new Input(table.getConnectorId(), schemaTable.getSchemaName(), schemaTable.getTableName(), inputMetadata, ImmutableList.copyOf(columns)); }
private Input createInput(TableMetadata table, Optional<TableLayoutHandle> layout, Set<Column> columns) { SchemaTableName schemaTable = table.getTable(); Optional<Object> inputMetadata = layout.flatMap(tableLayout -> metadata.getInfo(session, tableLayout)); return new Input(table.getConnectorId(), schemaTable.getSchemaName(), schemaTable.getTableName(), inputMetadata, ImmutableList.copyOf(columns)); }
@Test public void testRoundTrip() { Input expected = new Input(new ConnectorId("connectorId"), "schema", "table", Optional.empty(), ImmutableList.of( new Column("column1", "string"), new Column("column2", "string"), new Column("column3", "string"))); String json = codec.toJson(expected); Input actual = codec.fromJson(json); assertEquals(actual, expected); } }
@Test public void testRoundTrip() { Input expected = new Input(new ConnectorId("connectorId"), "schema", "table", Optional.empty(), ImmutableList.of( new Column("column1", "string"), new Column("column2", "string"), new Column("column3", "string"))); String json = codec.toJson(expected); Input actual = codec.fromJson(json); assertEquals(actual, expected); } }