Search in sources :

Example 81 with MapConfig

use of org.apache.samza.config.MapConfig in project samza by apache.

the class TestBaseTableDescriptor method testCustomConfig.

@Test
public void testCustomConfig() {
    Map tableConfig = createTableDescriptor(TABLE_ID).withConfig("abc", "xyz").toConfig(new MapConfig());
    Assert.assertEquals(2, tableConfig.size());
    Assert.assertEquals("xyz", tableConfig.get("abc"));
}
Also used : MapConfig(org.apache.samza.config.MapConfig) Map(java.util.Map) Test(org.junit.Test)

Example 82 with MapConfig

use of org.apache.samza.config.MapConfig in project samza by apache.

the class TestBaseTableDescriptor method testProviderFactoryConfig.

@Test
public void testProviderFactoryConfig() {
    Map tableConfig = createTableDescriptor(TABLE_ID).toConfig(new MapConfig());
    Assert.assertEquals(1, tableConfig.size());
    assertEquals("my.factory", "provider.factory", TABLE_ID, tableConfig);
}
Also used : MapConfig(org.apache.samza.config.MapConfig) Map(java.util.Map) Test(org.junit.Test)

Example 83 with MapConfig

use of org.apache.samza.config.MapConfig in project samza by apache.

the class TestRemoteTableDescriptor method testReadWriteRateLimitToConfig.

@Test
public void testReadWriteRateLimitToConfig() {
    Map<String, String> tableConfig = new RemoteTableDescriptor("1").withReadFunction(createMockTableReadFunction()).withReadRetryPolicy(new TableRetryPolicy()).withWriteRateLimit(1000).withReadRateLimit(2000).toConfig(new MapConfig());
    Assert.assertEquals(String.valueOf(2000), tableConfig.get("tables.1.io.read.credits"));
    Assert.assertEquals(String.valueOf(1000), tableConfig.get("tables.1.io.write.credits"));
}
Also used : TableRetryPolicy(org.apache.samza.table.retry.TableRetryPolicy) RemoteTableDescriptor(org.apache.samza.table.descriptors.RemoteTableDescriptor) Mockito.anyString(org.mockito.Mockito.anyString) MapConfig(org.apache.samza.config.MapConfig) Test(org.junit.Test)

Example 84 with MapConfig

use of org.apache.samza.config.MapConfig in project samza by apache.

the class TestRemoteTableDescriptor method testSerializeNullReadFunction.

@Test(expected = IllegalArgumentException.class)
public void testSerializeNullReadFunction() {
    RemoteTableDescriptor desc = new RemoteTableDescriptor("1");
    Map<String, String> tableConfig = desc.toConfig(new MapConfig());
    Assert.assertTrue(tableConfig.containsKey(RemoteTableDescriptor.READ_FN));
}
Also used : RemoteTableDescriptor(org.apache.samza.table.descriptors.RemoteTableDescriptor) Mockito.anyString(org.mockito.Mockito.anyString) MapConfig(org.apache.samza.config.MapConfig) Test(org.junit.Test)

Example 85 with MapConfig

use of org.apache.samza.config.MapConfig in project samza by apache.

the class TestRemoteTableDescriptor method testTablePartToConfigDefault.

@Test
public void testTablePartToConfigDefault() {
    TableReadFunction readFn = createMockTableReadFunction();
    when(readFn.toConfig(any(), any())).thenReturn(createConfigPair(1));
    Map<String, String> tableConfig = new RemoteTableDescriptor("1").withReadFunction(readFn).withReadRateLimit(100).toConfig(new MapConfig());
    verify(readFn, times(1)).toConfig(any(), any());
    Assert.assertEquals("v1", tableConfig.get("tables.1.io.read.func.k1"));
}
Also used : TableReadFunction(org.apache.samza.table.remote.TableReadFunction) RemoteTableDescriptor(org.apache.samza.table.descriptors.RemoteTableDescriptor) Mockito.anyString(org.mockito.Mockito.anyString) 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