use of org.apache.samza.config.MapConfig in project samza by apache.
the class TestCachingTable method testSerializeWithCacheInstance.
@Test
public void testSerializeWithCacheInstance() {
String tableId = "guavaCacheId";
GuavaCacheTableDescriptor guavaTableDesc = new GuavaCacheTableDescriptor(tableId).withCache(CacheBuilder.newBuilder().build());
Map<String, String> tableConfig = guavaTableDesc.toConfig(new MapConfig());
assertExists(GuavaCacheTableDescriptor.GUAVA_CACHE, tableId, tableConfig);
doTestSerialize(guavaTableDesc);
}
use of org.apache.samza.config.MapConfig in project samza by apache.
the class TestTableConfigGenerator method testWithSerdes.
@Test
public void testWithSerdes() {
List<TableDescriptor> descriptors = Arrays.asList(new MockLocalTableDescriptor("t1", KVSerde.of(new StringSerde(), new IntegerSerde())), new MockLocalTableDescriptor("t2", KVSerde.of(new StringSerde(), new IntegerSerde())));
Config jobConfig = new MapConfig(TableConfigGenerator.generateSerdeConfig(descriptors));
JavaTableConfig javaTableConfig = new JavaTableConfig(jobConfig);
assertNotNull(javaTableConfig.getKeySerde("t1"));
assertNotNull(javaTableConfig.getMsgSerde("t1"));
assertNotNull(javaTableConfig.getKeySerde("t2"));
assertNotNull(javaTableConfig.getMsgSerde("t2"));
MapConfig tableConfig = new MapConfig(TableConfigGenerator.generate(jobConfig, descriptors));
javaTableConfig = new JavaTableConfig(tableConfig);
assertNotNull(javaTableConfig.getTableProviderFactory("t1"));
assertNotNull(javaTableConfig.getTableProviderFactory("t2"));
}
use of org.apache.samza.config.MapConfig in project samza by apache.
the class TestConfigUtil method testRewriteConfigRewriterClassDoesNotExist.
@Test(expected = SamzaException.class)
public void testRewriteConfigRewriterClassDoesNotExist() {
Config config = new MapConfig(ImmutableMap.of(CONFIG_KEY, CONFIG_VALUE, JobConfig.CONFIG_REWRITERS, REWRITER_NAME, String.format(JobConfig.CONFIG_REWRITER_CLASS, REWRITER_NAME), "not_a_class"));
ConfigUtil.rewriteConfig(config);
}
use of org.apache.samza.config.MapConfig in project samza by apache.
the class TestConfigUtil method testLoadConfigWithoutLoader.
@Test(expected = ConfigException.class)
public void testLoadConfigWithoutLoader() {
Map<String, String> config = new HashMap<>();
config.put(JobConfig.JOB_NAME, "new-test-job");
ConfigUtil.loadConfig(new MapConfig(config));
}
use of org.apache.samza.config.MapConfig in project samza by apache.
the class TestConfigUtil method testRewriteConfigNoClassForConfigRewriterName.
@Test(expected = SamzaException.class)
public void testRewriteConfigNoClassForConfigRewriterName() {
Config config = new MapConfig(ImmutableMap.of(CONFIG_KEY, CONFIG_VALUE, JobConfig.CONFIG_REWRITERS, "unknownRewriter"));
ConfigUtil.rewriteConfig(config);
}
Aggregations