Search in sources :

Example 91 with MapConfig

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);
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) MapConfig(org.apache.samza.config.MapConfig) GuavaCacheTableDescriptor(org.apache.samza.table.descriptors.GuavaCacheTableDescriptor) Test(org.junit.Test)

Example 92 with MapConfig

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"));
}
Also used : StringSerde(org.apache.samza.serializers.StringSerde) Config(org.apache.samza.config.Config) JavaTableConfig(org.apache.samza.config.JavaTableConfig) MapConfig(org.apache.samza.config.MapConfig) JavaTableConfig(org.apache.samza.config.JavaTableConfig) MapConfig(org.apache.samza.config.MapConfig) TableDescriptor(org.apache.samza.table.descriptors.TableDescriptor) LocalTableDescriptor(org.apache.samza.table.descriptors.LocalTableDescriptor) IntegerSerde(org.apache.samza.serializers.IntegerSerde) Test(org.junit.Test)

Example 93 with MapConfig

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);
}
Also used : JobConfig(org.apache.samza.config.JobConfig) Config(org.apache.samza.config.Config) MapConfig(org.apache.samza.config.MapConfig) MapConfig(org.apache.samza.config.MapConfig) Test(org.junit.Test)

Example 94 with MapConfig

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));
}
Also used : HashMap(java.util.HashMap) MapConfig(org.apache.samza.config.MapConfig) Test(org.junit.Test)

Example 95 with MapConfig

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);
}
Also used : JobConfig(org.apache.samza.config.JobConfig) Config(org.apache.samza.config.Config) MapConfig(org.apache.samza.config.MapConfig) MapConfig(org.apache.samza.config.MapConfig) Test(org.junit.Test)

Aggregations

MapConfig (org.apache.samza.config.MapConfig)496 Test (org.junit.Test)402 Config (org.apache.samza.config.Config)294 HashMap (java.util.HashMap)216 SamzaSqlTestConfig (org.apache.samza.sql.util.SamzaSqlTestConfig)98 SamzaSqlApplicationConfig (org.apache.samza.sql.runner.SamzaSqlApplicationConfig)97 JobConfig (org.apache.samza.config.JobConfig)91 Map (java.util.Map)75 ApplicationConfig (org.apache.samza.config.ApplicationConfig)65 SystemStreamPartition (org.apache.samza.system.SystemStreamPartition)57 SamzaSqlValidator (org.apache.samza.sql.planner.SamzaSqlValidator)55 TaskName (org.apache.samza.container.TaskName)52 HashSet (java.util.HashSet)51 List (java.util.List)51 Set (java.util.Set)49 Partition (org.apache.samza.Partition)49 ArrayList (java.util.ArrayList)48 StreamApplicationDescriptorImpl (org.apache.samza.application.descriptors.StreamApplicationDescriptorImpl)48 TaskConfig (org.apache.samza.config.TaskConfig)45 StreamConfig (org.apache.samza.config.StreamConfig)43