@Test public void testTableProviderFactoryConfig() { Map<String, String> tableConfig = createTableDescriptor() .toConfig(createJobConfig()); Assert.assertEquals(1, tableConfig.size()); Assert.assertEquals(MockTableProviderFactory.class.getName(), tableConfig.get(String.format(JavaTableConfig.TABLE_PROVIDER_FACTORY, TABLE_ID))); }
@Test public void testChangelogDisabled() { Map<String, String> tableConfig = createTableDescriptor() .toConfig(createJobConfig()); Assert.assertEquals(1, tableConfig.size()); Assert.assertFalse(tableConfig.containsKey(String.format(StorageConfig.CHANGELOG_STREAM(), TABLE_ID))); }
@Test public void testChangelogEnabledWithCustomParameters() { Map<String, String> tableConfig = createTableDescriptor() .withChangelogStream("my-stream") .withChangelogReplicationFactor(100) .toConfig(createJobConfig()); Assert.assertEquals(3, tableConfig.size()); Assert.assertEquals("my-stream", String.format( tableConfig.get(String.format(StorageConfig.CHANGELOG_STREAM(), TABLE_ID)))); Assert.assertEquals("100", String.format( tableConfig.get(String.format(StorageConfig.CHANGELOG_REPLICATION_FACTOR(), TABLE_ID)))); }
@Test public void testStoreConfig() { Map<String, String> tableConfig = createTableDescriptor() .toConfig(createJobConfig()); Assert.assertEquals(1, tableConfig.size()); }
@Test public void testMinimal() { Config jobConfig = createJobConfig(); Assert.assertEquals(2, jobConfig.size()); Map<String, String> tableConfig = createTableDescriptor().toConfig(jobConfig); Assert.assertNotNull(tableConfig); Assert.assertEquals(1, tableConfig.size()); }
@Test public void testChangelogEnabled() { Map<String, String> tableConfig = createTableDescriptor() .withChangelogEnabled() .toConfig(createJobConfig()); Assert.assertEquals(2, tableConfig.size()); Assert.assertEquals("test-job-10-table-t1", String.format( tableConfig.get(String.format(StorageConfig.CHANGELOG_STREAM(), TABLE_ID)))); }
@Test(expected = NullPointerException.class) public void testChangelogWithoutJobId() { Map<String, String> jobConfig = new HashMap<>(); jobConfig.put("job.name", JOB_NAME); createTableDescriptor() .withChangelogEnabled() .toConfig(new MapConfig(jobConfig)); }
@Test(expected = NullPointerException.class) public void testChangelogWithoutJobName() { Map<String, String> jobConfig = new HashMap<>(); jobConfig.put("job.id", JOB_ID); createTableDescriptor() .withChangelogEnabled() .toConfig(new MapConfig(jobConfig)); }