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

制作视频的手机软件站长seo查询工具

制作视频的手机软件,站长seo查询工具,wordpress 档案插件,网站开发的朋友圈背景 日常测试中我们使用flink的TestHarness只能测试单个算子,很多情况下我们需要集成测试来测试真正的问题,所以在flink中进行集成测试还是非常有必要的,本文就来记录下如何在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 HashMap<String, 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 SinkFunction<String> {// must be staticpublic static final List<String> values = Collections.synchronizedList(new ArrayList<>());@Overridepublic void invoke(String value, Context context) throws Exception {values.add(value);}}}public class StatefulFlatMap extends RichFlatMapFunction<String, String> {ValueState<String> previousInput;@Overridepublic void open(Configuration parameters) throws Exception {previousInput = getRuntimeContext().getState(new ValueStateDescriptor<String>("previousInput", Types.STRING));}@Overridepublic void flatMap(String in, Collector<String> 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.dinnco.com/news/49504.html

相关文章:

  • 网站建设属什么资产西地那非
  • wordpress公园模板seo网站推广工具
  • 怎么设置网站免费推广公司
  • 怎么进入国外网站百度账号中心官网
  • 网页设计师网站大全近期新闻热点大事件
  • 重庆网页设计培训优化大师电脑版官网
  • wordpress博客收藏贵州seo技术查询
  • 织梦怎么做淘客网站谷歌广告怎么投放
  • 铜陵app网站做营销招聘营销推广软文案例
  • 网站关键词怎么写今天国际新闻
  • php如何自学做网站制作网站的软件有哪些
  • 国际新闻最新消息今天中国台湾上海网站seo优化
  • 中山大良网站建设网店培训骗局
  • 怎么查寻一个网站做的竞价免费培训seo网站
  • 建筑企业查询seo下拉优化
  • 做一个京东网站怎么做全球疫情今天最新消息
  • jsp商务网站建设网络营销推广平台有哪些
  • 中国新闻发布重庆seo网络优化师
  • 南昌哪里做网站好网站推广优化网址
  • 北京大型网站建设公司东莞百度seo
  • 杭州做网站博客朝阳seo搜索引擎
  • 贺州招聘网站建设今天军事新闻最新消息
  • 阿里服务器可以做多少个网站百度seo关键词排名优化工具
  • 建立主题网站的顺序是网页设计培训学校
  • 宝安做网站多少钱app开发需要多少钱
  • 公安局内网网站建设的现状seo设置是什么
  • 网站建设 定制广东省最新新闻
  • dedecms网站的下载电脑优化是什么意思
  • 东莞企业网站建设开发公司视频推广渠道有哪些
  • 怎么做才能提高网站权重千峰培训出来好就业吗