Search in sources :

Example 26 with StreamConfig

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

the class TestStreamUtil method testGetStreamStreamIdNull.

// Null is not allowed for streamId.
@Test(expected = IllegalArgumentException.class)
public void testGetStreamStreamIdNull() {
    Config config = buildStreamConfig(null, StreamConfig.SYSTEM, TEST_SYSTEM);
    StreamUtil.getStreamSpec(null, new StreamConfig(config));
}
Also used : JobConfig(org.apache.samza.config.JobConfig) Config(org.apache.samza.config.Config) MapConfig(org.apache.samza.config.MapConfig) StreamConfig(org.apache.samza.config.StreamConfig) StreamConfig(org.apache.samza.config.StreamConfig) Test(org.junit.Test)

Example 27 with StreamConfig

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

the class TestStreamUtil method testGetStreamWithSystemAtStreamScopeInConfig.

// If the system is specified at the stream scope, use it
@Test
public void testGetStreamWithSystemAtStreamScopeInConfig() {
    Config config = buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME, TEST_PHYSICAL_NAME, StreamConfig.SYSTEM, TEST_SYSTEM);
    StreamSpec spec = StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config));
    assertEquals(TEST_SYSTEM, spec.getSystemName());
}
Also used : StreamSpec(org.apache.samza.system.StreamSpec) JobConfig(org.apache.samza.config.JobConfig) Config(org.apache.samza.config.Config) MapConfig(org.apache.samza.config.MapConfig) StreamConfig(org.apache.samza.config.StreamConfig) StreamConfig(org.apache.samza.config.StreamConfig) Test(org.junit.Test)

Example 28 with StreamConfig

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

the class TestStreamUtil method testGetStreamWithoutPhysicalNameInConfig.

// The streamId should be used as the physicalName when the physical name is not specified.
// NOTE: its either this, set to null, or exception. This seems better for backward compatibility and API brevity.
@Test
public void testGetStreamWithoutPhysicalNameInConfig() {
    Config config = buildStreamConfig(STREAM_ID, StreamConfig.SYSTEM, TEST_SYSTEM);
    StreamSpec spec = StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config));
    assertEquals(STREAM_ID, spec.getPhysicalName());
}
Also used : StreamSpec(org.apache.samza.system.StreamSpec) JobConfig(org.apache.samza.config.JobConfig) Config(org.apache.samza.config.Config) MapConfig(org.apache.samza.config.MapConfig) StreamConfig(org.apache.samza.config.StreamConfig) StreamConfig(org.apache.samza.config.StreamConfig) Test(org.junit.Test)

Example 29 with StreamConfig

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

the class TestStreamUtil method testGetStreamSystemNameArgNull.

// Null is not allowed IllegalArgumentException system name.
@Test(expected = IllegalArgumentException.class)
public void testGetStreamSystemNameArgNull() {
    Config config = buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME, TEST_PHYSICAL_NAME, StreamConfig.SYSTEM, null);
    StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config));
}
Also used : JobConfig(org.apache.samza.config.JobConfig) Config(org.apache.samza.config.Config) MapConfig(org.apache.samza.config.MapConfig) StreamConfig(org.apache.samza.config.StreamConfig) StreamConfig(org.apache.samza.config.StreamConfig) Test(org.junit.Test)

Example 30 with StreamConfig

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

the class TestStreamUtil method testGetStreamPhysicalNameArgSimple.

// When the physicalName argument is passed explicitly it should be used, regardless of whether it is also in the config
@Test
public void testGetStreamPhysicalNameArgSimple() {
    Config config = buildStreamConfig(STREAM_ID, // This should be ignored because of the explicit arg
    StreamConfig.PHYSICAL_NAME, // This should be ignored because of the explicit arg
    TEST_PHYSICAL_NAME2, StreamConfig.SYSTEM, TEST_SYSTEM);
    StreamSpec spec = StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config));
    assertEquals(STREAM_ID, spec.getId());
    assertEquals(TEST_PHYSICAL_NAME2, spec.getPhysicalName());
    assertEquals(TEST_SYSTEM, spec.getSystemName());
}
Also used : StreamSpec(org.apache.samza.system.StreamSpec) JobConfig(org.apache.samza.config.JobConfig) Config(org.apache.samza.config.Config) MapConfig(org.apache.samza.config.MapConfig) StreamConfig(org.apache.samza.config.StreamConfig) StreamConfig(org.apache.samza.config.StreamConfig) Test(org.junit.Test)

Aggregations

StreamConfig (org.apache.samza.config.StreamConfig)39 Config (org.apache.samza.config.Config)33 MapConfig (org.apache.samza.config.MapConfig)32 Test (org.junit.Test)31 JobConfig (org.apache.samza.config.JobConfig)23 StreamSpec (org.apache.samza.system.StreamSpec)17 Collection (java.util.Collection)11 StreamApplicationDescriptorImpl (org.apache.samza.application.descriptors.StreamApplicationDescriptorImpl)10 OperatorSpecGraph (org.apache.samza.operators.OperatorSpecGraph)10 SamzaSqlApplicationConfig (org.apache.samza.sql.runner.SamzaSqlApplicationConfig)9 SamzaSqlQueryParser (org.apache.samza.sql.util.SamzaSqlQueryParser)9 SamzaSqlTestConfig (org.apache.samza.sql.util.SamzaSqlTestConfig)9 SystemStream (org.apache.samza.system.SystemStream)6 HashMap (java.util.HashMap)3 ApplicationConfig (org.apache.samza.config.ApplicationConfig)3 HashMultimap (com.google.common.collect.HashMultimap)2 Multimap (com.google.common.collect.Multimap)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2