public static Fields getSingleOutputStreamFields(IComponent component) { OutputFieldsGetter getter = new OutputFieldsGetter(); component.declareOutputFields(getter); Map<String, StreamInfo> declaration = getter.getFieldsDeclaration(); if(declaration.size()!=1) { throw new RuntimeException("Trident only supports components that emit a single stream"); } StreamInfo si = declaration.values().iterator().next(); if(si.is_direct()) { throw new RuntimeException("Trident does not support direct streams"); } return new Fields(si.get_output_fields()); }
protected void initCommon(String id, IComponent component, Number parallelism) throws IllegalArgumentException { ComponentCommon common = new ComponentCommon(); common.set_inputs(new HashMap<GlobalStreamId, Grouping>()); if (parallelism != null) { int dop = parallelism.intValue(); if(dop < 1) { throw new IllegalArgumentException("Parallelism must be positive."); } common.set_parallelism_hint(dop); } else { common.set_parallelism_hint(1); } Map conf = component.getComponentConfiguration(); if(conf!=null) common.set_json_conf(JSONValue.toJSONString(conf)); _commons.put(id, common); }
private ComponentCommon getComponentCommon(String id, IComponent component) { ComponentCommon ret = new ComponentCommon(_commons.get(id)); OutputFieldsGetter getter = new OutputFieldsGetter(); component.declareOutputFields(getter); ret.set_streams(getter.getFieldsDeclaration()); return ret; }
private void initCommon(String id, IComponent component, Integer parallelism) { ComponentCommon common = new ComponentCommon(); common.set_inputs(new HashMap<GlobalStreamId, Grouping>()); if(parallelism!=null) common.set_parallelism_hint(parallelism); Map conf = component.getComponentConfiguration(); if(conf!=null) common.set_json_conf(JSONValue.toJSONString(conf)); _commons.put(id, common); }
private ComponentCommon getComponentCommon(String id, IComponent component) { ComponentCommon ret = new ComponentCommon(_commons.get(id)); OutputFieldsGetter getter = new OutputFieldsGetter(); component.declareOutputFields(getter); // declare watermark stream for all components getter.declareStream(Common.WATERMARK_STREAM_ID, new Fields("watermark")); ret.set_streams(getter.getFieldsDeclaration()); return ret; }
private void initCommon(String id, IComponent component, Number parallelism) { ComponentCommon common = new ComponentCommon(); common.set_inputs(new HashMap<GlobalStreamId, Grouping>()); if(parallelism!=null) common.set_parallelism_hint(parallelism.intValue()); Map conf = component.getComponentConfiguration(); if(conf!=null) common.set_json_conf(JSONValue.toJSONString(conf)); _commons.put(id, common); }
/** * Verifies that the actual component declares only the given values and nothing else, <b>in order</b>. * * @param fields the given fields. * @return {@code this} assertion object. * @see ObjectEnumerableAssert#containsExactly(Object...) */ public IComponentAssert declareExactly(String... fields) { OutputFieldsDeclarer declarer = mock(OutputFieldsDeclarer.class); actual.declareOutputFields(declarer); ArgumentCaptor<Fields> fieldsCaptor = ArgumentCaptor.forClass(Fields.class); verify(declarer).declare(fieldsCaptor.capture()); assertThat(fieldsCaptor.getValue()).containsExactly(fields); return myself; } }
protected void initCommon(String id, IComponent component, Number parallelism) throws IllegalArgumentException { ComponentCommon common = new ComponentCommon(); common.set_inputs(new HashMap<GlobalStreamId, Grouping>()); if (parallelism != null) { int dop = parallelism.intValue(); if(dop < 1) { throw new IllegalArgumentException("Parallelism must be positive."); } common.set_parallelism_hint(dop); } else { common.set_parallelism_hint(1); } Map conf = component.getComponentConfiguration(); if(conf!=null) common.set_json_conf(JSONValue.toJSONString(conf)); _commons.put(id, common); }
public static Fields getSingleOutputStreamFields(IComponent component) { OutputFieldsGetter getter = new OutputFieldsGetter(); component.declareOutputFields(getter); Map<String, StreamInfo> declaration = getter.getFieldsDeclaration(); if(declaration.size()!=1) { throw new RuntimeException("Trident only supports components that emit a single stream"); } StreamInfo si = declaration.values().iterator().next(); if(si.is_direct()) { throw new RuntimeException("Trident does not support direct streams"); } return new Fields(si.get_output_fields()); }
public static Fields getSingleOutputStreamFields(IComponent component) { OutputFieldsGetter getter = new OutputFieldsGetter(); component.declareOutputFields(getter); Map<String, StreamInfo> declaration = getter.getFieldsDeclaration(); if(declaration.size()!=1) { throw new RuntimeException("Trident only supports components that emit a single stream"); } StreamInfo si = declaration.values().iterator().next(); if(si.is_direct()) { throw new RuntimeException("Trident does not support direct streams"); } return new Fields(si.get_output_fields()); }
private ComponentCommon getComponentCommon(String id, IComponent component) { ComponentCommon ret = new ComponentCommon(_commons.get(id)); OutputFieldsGetter getter = new OutputFieldsGetter(); component.declareOutputFields(getter); ret.set_streams(getter.getFieldsDeclaration()); return ret; }
private ComponentCommon getComponentCommon(String id, IComponent component) { ComponentCommon ret = new ComponentCommon(_commons.get(id)); OutputFieldsGetter getter = new OutputFieldsGetter(); component.declareOutputFields(getter); ret.set_streams(getter.getFieldsDeclaration()); return ret; }