当前位置: 首页 > news >正文

黄石企业网站建设开发网站logo教程

黄石企业网站建设开发,网站logo教程,南昌网站空间,搜索引擎优化的方法背景 日常测试中我们使用flink的TestHarness只能测试单个算子#xff0c;很多情况下我们需要集成测试来测试真正的问题#xff0c;所以在flink中进行集成测试还是非常有必要的#xff0c;本文就来记录下如何在flink中进行集成测试 flink中进行集成测试 flink中进行集成测…背景 日常测试中我们使用flink的TestHarness只能测试单个算子很多情况下我们需要集成测试来测试真正的问题所以在flink中进行集成测试还是非常有必要的本文就来记录下如何在flink中进行集成测试 flink中进行集成测试 flink中进行集成测试的关键类MiniClusterWithClientResource这是一个启动本地flink集群的关键类先看一下集成测试的关键代码 /*** FLINK集成测试* https://nightlies.apache.org/flink/flink-docs-release-1.13/zh/docs/dev/datastream/testing/**/ public class FlinkIntegrationTest {public static final Configuration config Configuration.fromMap(new HashMapString, String() {{put(heartbeat.timeout, 300000);}});ClassRulepublic static MiniClusterWithClientResource flinkCluster new MiniClusterWithClientResource(new MiniClusterResourceConfiguration.Builder().setConfiguration(config).setNumberSlotsPerTaskManager(1).setNumberTaskManagers(3).build());Testpublic void testStateFlatMap() throws Exception {StatefulFlatMap statefulFlatMap new StatefulFlatMap();StreamExecutionEnvironment env StreamExecutionEnvironment.getExecutionEnvironment();// configure your test environmentenv.setParallelism(2);// values are collected in a static variableCollectSink.values.clear();// create a stream of custom elements and apply transformationsenv.fromElements(world, hi).keyBy(e - 1).flatMap(statefulFlatMap).addSink(new CollectSink());// executeenv.execute();// verify your resultsassertTrue(CollectSink.values.containsAll(Lists.newArrayList(hello world, hello hi world)));}Testpublic void testStateFlatMap1() throws Exception {StatefulFlatMap statefulFlatMap new StatefulFlatMap();StreamExecutionEnvironment env StreamExecutionEnvironment.getExecutionEnvironment();// configure your test environmentenv.setParallelism(2);// values are collected in a static variableCollectSink.values.clear();// create a stream of custom elements and apply transformationsenv.fromElements(world, hi, world).keyBy(e - e).flatMap(statefulFlatMap).addSink(new CollectSink());// executeenv.execute();// verify your resultsassertTrue(CollectSink.values.containsAll(Lists.newArrayList(hello world, hello hi, hello world world)));}// create a testing sinkprivate static class CollectSink implements SinkFunctionString {// must be staticpublic static final ListString values Collections.synchronizedList(new ArrayList());Overridepublic void invoke(String value, Context context) throws Exception {values.add(value);}}}public class StatefulFlatMap extends RichFlatMapFunctionString, String {ValueStateString previousInput;Overridepublic void open(Configuration parameters) throws Exception {previousInput getRuntimeContext().getState(new ValueStateDescriptorString(previousInput, Types.STRING));}Overridepublic void flatMap(String in, CollectorString collector) throws Exception {String out hello in;if(previousInput.value() ! null){out out previousInput.value();}previousInput.update(in);collector.collect(out);}由于我们是集成测试我们一般输入source和输出sink是自己构造的比如这里的CollectSink这里就可以正常测试包括状态在内的pineline集成测试了
http://www.sadfv.cn/news/282890/

相关文章:

  • 宿州企业网站建设太原网络项目
  • 免费商用自媒体图片网站网站企业制作
  • 东莞南城网站设计python3 网站开发实例
  • 安塞网站建设制作小程序的公司
  • 免费网站正能量小说给公司创建网站流程
  • 网站开发工程师学什么区别wordpress有游客注册帐号功能
  • 网站建设合同缴印花税郑州网站seo多少钱
  • 沈阳响应式网站制作中国星子网
  • 中山 网站设计山西公司网站开发
  • 重庆电子网站建设手机兼职任务平台
  • 学校网站建设费用外贸网站推广技巧
  • 企业网站管理系统 软件著作权广西南宁网络营销网站
  • wordpress 知名网站网站安全建设工作总结
  • 用高权重网站的目录做站群怎么样陕西西安封闭通知最新
  • 网站怎么做全屏的做一个论坛网站要多少钱
  • 做网站怎么赚钱知乎深圳定制家具厂
  • 网站开发的初级技术员网页游戏哪个平台好
  • 微信公众号建立网站ps软件免费
  • 红木家具网站建设总体规划凡客诚品的衣服质量怎么样
  • 怎么让百度收录你的网站网站设计需要的元素
  • 教学网站设计与开发网站后台登陆图片
  • 高明铝业网站建站pc 移动端网站建设
  • 网站建站网站建站泉州网站开发人员
  • ppt做多个网站wordpress打开越来越慢
  • 域名怎么做网站高级私人定制制衣店
  • 网页设计与网站建设程序作业好的产品怎么推广语言
  • 无极分期网站定制网站建设多少钱
  • 网站专题分类user pro wordpress
  • 重庆网站制作开发网站建设实例pdf下载
  • 上海易站网站建设wordpress 同步 朋友圈