public ExecutionPlanner(Config config, StreamManager streamManager) { this.config = config; this.streamManager = streamManager; this.streamConfig = new StreamConfig(config); }
public EventHubConfig(Config config) { super(config); // Build reverse index for streamName -> streamId StreamConfig streamConfig = new StreamConfig(config); LOG.info("Building mappings from physicalName to streamId"); JavaConversions.asJavaCollection(streamConfig.getStreamIds()) .forEach((streamId) -> { String physicalName = streamConfig.getPhysicalName(streamId); LOG.info("Obtained physicalName: {} for streamId: {} ", physicalName, streamId); physcialToId.put(physicalName, streamId); }); }
public String getStreamSerdeName(String systemName, String streamName) { StreamConfig streamConfig = new StreamConfig(this); scala.Option<String> option = streamConfig.getStreamMsgSerde(new SystemStream(systemName, streamName)); return option.isEmpty() ? null : option.get(); } }
public String getStreamSerdeName(String systemName, String streamName) { StreamConfig streamConfig = new StreamConfig(this); scala.Option<String> option = streamConfig.getStreamMsgSerde(new SystemStream(systemName, streamName)); return option.isEmpty() ? null : option.get(); } }
private StreamConfig buildConfig(String... kvs) { if (kvs.length % 2 != 0) { throw new IllegalArgumentException("There must be parity between the keys and values"); } Map<String, String> configMap = new HashMap<>(); for (int i = 0; i < kvs.length - 1; i += 2) { configMap.put(kvs[i], kvs[i + 1]); } return new StreamConfig(new MapConfig(configMap)); }
StreamEdge(StreamSpec streamSpec, boolean isIntermediate, boolean isBroadcast, Config config) { this.streamSpec = streamSpec; this.isIntermediate = isIntermediate; // broadcast can be configured either by an operator or via the configs this.isBroadcast = isBroadcast || new StreamConfig(config).getBroadcastEnabled(streamSpec.toSystemStream()); this.config = config; if (isBroadcast && isIntermediate) { partitions = 1; } this.name = StreamUtil.getNameFromSystemStream(getSystemStream()); }
@Test(expected = IllegalArgumentException.class) public void testGetStreamStreamIdNull() { Config config = buildStreamConfig(null, StreamConfig.SYSTEM(), TEST_SYSTEM); StreamUtil.getStreamSpec(null, new StreamConfig(config)); }
@Test(expected = IllegalArgumentException.class) public void testGetStreamStreamIdInvalid() { Config config = buildStreamConfig(STREAM_ID_INVALID, StreamConfig.SYSTEM(), TEST_SYSTEM); StreamUtil.getStreamSpec(STREAM_ID_INVALID, new StreamConfig(config)); }
@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)); }
@Test(expected = IllegalArgumentException.class) public void testGetStreamSystemNameArgInvalid() { Config config = buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME(), TEST_PHYSICAL_NAME, StreamConfig.SYSTEM(), TEST_SYSTEM_INVALID); StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config)); }
@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()); }
@Test(expected = IllegalArgumentException.class) public void testGetStreamWithOutSystemInConfig() { Config config = buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME(), TEST_PHYSICAL_NAME); StreamSpec spec = StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config)); assertEquals(TEST_SYSTEM, spec.getSystemName()); }
@Test public void testGetStreamWithPhysicalNameInConfig() { 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_PHYSICAL_NAME, spec.getPhysicalName()); }
@Test public void testGetStreamPhysicalNameArgSpecialCharacters() { Config config = buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME(), TEST_PHYSICAL_NAME_SPECIAL_CHARS, StreamConfig.SYSTEM(), TEST_SYSTEM); StreamSpec spec = StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config)); assertEquals(TEST_PHYSICAL_NAME_SPECIAL_CHARS, spec.getPhysicalName()); }
@Test public void testGetStreamPhysicalNameArgNull() { Config config = buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME(), null, StreamConfig.SYSTEM(), TEST_SYSTEM); StreamSpec spec = StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config)); assertNull(spec.getPhysicalName()); }
@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()); }
@Test public void testGetStreamWithSystemAtDefaultScopeInConfig() { Config config = addConfigs(buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME(), TEST_PHYSICAL_NAME), JobConfig.JOB_DEFAULT_SYSTEM(), TEST_DEFAULT_SYSTEM); StreamSpec spec = StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config)); assertEquals(TEST_DEFAULT_SYSTEM, spec.getSystemName()); }
@Test public void testGetStreamWithSystemAtBothScopesInConfig() { Config config = addConfigs(buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME(), TEST_PHYSICAL_NAME, StreamConfig.SYSTEM(), TEST_SYSTEM), JobConfig.JOB_DEFAULT_SYSTEM(), TEST_DEFAULT_SYSTEM); StreamSpec spec = StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config)); assertEquals(TEST_SYSTEM, spec.getSystemName()); }
@Test public void testGetStreamPhysicalNameArgSimple() { Config config = buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME(), TEST_PHYSICAL_NAME2, // This should be ignored because of the explicit arg 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()); }
@Test public void testGetStreamSystemNameArgValid() { Config config = buildStreamConfig(STREAM_ID, StreamConfig.PHYSICAL_NAME(), TEST_PHYSICAL_NAME, // This should be ignored because of the explicit arg StreamConfig.SYSTEM(), TEST_SYSTEM); // This too StreamSpec spec = StreamUtil.getStreamSpec(STREAM_ID, new StreamConfig(config)); assertEquals(STREAM_ID, spec.getId()); assertEquals(TEST_PHYSICAL_NAME, spec.getPhysicalName()); assertEquals(TEST_SYSTEM, spec.getSystemName()); }