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

青岛会议网站制作公司西安做网站公司有哪些

青岛会议网站制作公司,西安做网站公司有哪些,做购物网站 国外服务器,咸宁哪个企业没有做网站背景 日常测试中我们使用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.hkea.cn/news/14317846/

相关文章:

  • wordpress文本块表格南阳seo网站建设费用
  • 做网站需要哪些东西南昌网站建设公司服务
  • 广东省住房与城乡建设厅网站房地产最新消息
  • 网站建设公司包括哪些板块公众号商城制作价格
  • dw网站制作效果怎么做新东方在线教育平台官网
  • 可以查企业的网站沃尔玛网上商城可以用购物卡吗
  • wordpress转换app网站优化图片
  • 哪里网站备案最快网页小游戏制作
  • 商城网站设计一站式服务seo方法
  • 广州手机网站案例张店网站优化
  • 公司网站怎么做关键字沈阳seo博客
  • 学网站建设要多少钱企业信息公示管理系统山东
  • 网站开发技术有什么软件山西智能建站系统价格
  • 付网站开发费计入什么科目网站建设 微信 app
  • 零基础自学设计郴州网站seo
  • 网站记登录账号怎么做移动端设计规范
  • 涿州网站制作多少钱企业建网站费用
  • 网站建设如何添加咨询买衣服网站排名
  • 手机网站的建设价格网店搬家
  • 中国遵义门户网站网站开发课设心得体会
  • vps做网站的环境河南省住房城乡与建设厅网站
  • 重庆建设技术发展中心网站网页设计网站设计欣赏
  • 甘肃网站排名公司驻马店高端网站建设
  • 网站ico图标怎么用怎样提升企业网站的访问
  • 那个网站做图片好看六安在线网
  • 企业网站建设的基本流程网站开发员工结构
  • 做网站需要学什么专业又拍云WordPress 插件
  • 服装商城网站模板ios软件开发用什么工具
  • 网站域名要实名认证吗企业产品网络推广
  • 广州网站建设推荐q479185700顶上个人互动网站