### Question:
Marshaller { public void marshall(String configLocation, CircusTrainConfig config) { try (FileObject target = fsManager.resolveFile(configLocation); Writer writer = new OutputStreamWriter(target.getContent().getOutputStream(), Charsets.UTF_8)) { yaml.dump(config, writer); } catch (IOException e) { throw new RuntimeException("Unable to write Circus Train config to '" + configLocation + "'", e); } } Marshaller(); void marshall(String configLocation, CircusTrainConfig config);  }### Answer:
@Test public void typical() throws Exception { CircusTrainConfig config = CircusTrainConfig .builder() .sourceName("sourceName") .sourceMetaStoreUri("sourceMetaStoreUri") .replicaName("replicaName") .replicaMetaStoreUri("replicaMetaStoreUri") .copierOption("p1", "val1") .copierOption("p2", "val2") .replication(ReplicationMode.FULL, "databaseName", "tableName", "replicaDatabaseName", "replicaTableName", "replicaTableLocation", Arrays.asList("part"), Arrays.asList(Arrays.asList("partval")), OrphanedDataStrategy.NONE) .build(); File file = tmp.newFile("conif.yml"); marshaller.marshall(file.getAbsolutePath(), config); assertThat(Files.readLines(file, StandardCharsets.UTF_8)) .contains("source-catalog:") .contains(" disable-snapshots: false") .contains(" name: sourceName") .contains(" hive-metastore-uris: sourceMetaStoreUri") .contains("replica-catalog:") .contains(" name: replicaName") .contains(" hive-metastore-uris: replicaMetaStoreUri") .contains("copier-options:") .contains(" p1: val1") .contains(" p2: val2") .contains("table-replications:") .contains("- orphaned-data-strategy: NONE") .contains(" replication-mode: FULL") .contains(" source-table:") .contains(" database-name: databaseName") .contains(" table-name: tableName") .contains(" partition-filter: (part='partval')") .contains(" partition-limit: 32767") .contains(" replica-table:") .contains(" database-name: replicaDatabaseName") .contains(" table-name: replicaTableName") .contains(" table-location: replicaTableLocation"); }
@Test public void generatePartitionFilter() throws Exception { CircusTrainConfig config = CircusTrainConfig .builder() .sourceName("sourceName") .sourceMetaStoreUri("sourceMetaStoreUri") .replicaName("replicaName") .replicaMetaStoreUri("replicaMetaStoreUri") .copierOption("p1", "val1") .copierOption("p2", "val2") .replication(ReplicationMode.FULL, "databaseName", "tableName", "replicaDatabaseName", "replicaTableName", "replicaTableLocation", OrphanedDataStrategy.HOUSEKEEPING) .build(); File file = tmp.newFile("conif.yml"); marshaller.marshall(file.getAbsolutePath(), config); assertThat(Files.readLines(file, StandardCharsets.UTF_8)) .contains("source-catalog:") .contains(" disable-snapshots: false") .contains(" name: sourceName") .contains(" hive-metastore-uris: sourceMetaStoreUri") .contains("replica-catalog:") .contains(" name: replicaName") .contains(" hive-metastore-uris: replicaMetaStoreUri") .contains("copier-options:") .contains(" p1: val1") .contains(" p2: val2") .contains("table-replications:") .contains("- orphaned-data-strategy: HOUSEKEEPING") .contains(" replication-mode: FULL") .contains(" source-table:") .contains(" database-name: databaseName") .contains(" table-name: tableName") .contains(" generate-partition-filter: true") .contains(" partition-limit: 32767") .contains(" replica-table:") .contains(" database-name: replicaDatabaseName") .contains(" table-name: replicaTableName") .contains(" table-location: replicaTableLocation"); }