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

供热设施网站搭建教程网站建设的关键事项

供热设施网站搭建教程,网站建设的关键事项,05网学霸答案,吴江住房和城乡建设局官方网站背景 我们经常需要对KeyedBroadcastProcessFunction函数进行单元测试#xff0c;以确保上线之前这个函数的功能是正常的#xff0c;包括里面的广播状态和键值分区状态 测试KeyedBroadcastProcessFunction类 Testpublic void testHarnessForKeyedBroadcastProcessFunction()…背景 我们经常需要对KeyedBroadcastProcessFunction函数进行单元测试以确保上线之前这个函数的功能是正常的包括里面的广播状态和键值分区状态 测试KeyedBroadcastProcessFunction类 Testpublic void testHarnessForKeyedBroadcastProcessFunction() throws Exception {KeyedBroadcastProcessFunctionString, String, String, String function new MyKeyedBroadcastProcessFunction();// 键值分区状态final ValueStateDescriptorString valueStateDescriptor new ValueStateDescriptor(item, BasicTypeInfo.STRING_TYPE_INFO);// 广播状态final MapStateDescriptorString, String ruleStateDescriptor new MapStateDescriptor(RulesBroadcastState,BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO);KeyedBroadcastOperatorTestHarnessString, String, String, String harness ProcessFunctionTestHarnesses.forKeyedBroadcastProcessFunction(function, x - x,TypeInformation.of(String.class), ruleStateDescriptor);harness.processBroadcastElement(0, 1);harness.processBroadcastElement(000, 2);harness.processElement(1, 10);// 判断键值分区状态(注意这里最好就只是某个key下面也就是分组key直接设置为x-固定常数值即可)ValueStateString valueState function.getRuntimeContext().getState(valueStateDescriptor);Assert.assertEquals(valueState.value(), 1);// 判断广播状态BroadcastStateString, String broadcastState harness.getBroadcastState(ruleStateDescriptor);Assert.assertTrue(broadcastState.contains(0));Assert.assertTrue(broadcastState.contains(000));// 判断输出的列表Assert.assertEquals(harness.extractOutputValues(), Arrays.asList(0, 000, 1));}关键代码 1.获取键值分区状态 ValueStateString valueState function.getRuntimeContext().getState(valueStateDescriptor);2.获取广播状态: BroadcastStateString, String broadcastState harness.getBroadcastState(ruleStateDescriptor);3.工具类 public class ProcessFunctionTestHarnesses {public ProcessFunctionTestHarnesses() {}public static IN, OUT OneInputStreamOperatorTestHarnessIN, OUT forProcessFunction(ProcessFunctionIN, OUT function) throws Exception {OneInputStreamOperatorTestHarnessIN, OUT testHarness new OneInputStreamOperatorTestHarness(new ProcessOperator((ProcessFunction)Preconditions.checkNotNull(function)), 1, 1, 0);testHarness.setup();testHarness.open();return testHarness;}public static K, IN, OUT KeyedOneInputStreamOperatorTestHarnessK, IN, OUT forKeyedProcessFunction(KeyedProcessFunctionK, IN, OUT function, KeySelectorIN, K keySelector, TypeInformationK keyType) throws Exception {KeyedOneInputStreamOperatorTestHarnessK, IN, OUT testHarness new KeyedOneInputStreamOperatorTestHarness(new KeyedProcessOperator((KeyedProcessFunction)Preconditions.checkNotNull(function)), keySelector, keyType, 1, 1, 0);testHarness.open();return testHarness;}public static IN1, IN2, OUT TwoInputStreamOperatorTestHarnessIN1, IN2, OUT forCoProcessFunction(CoProcessFunctionIN1, IN2, OUT function) throws Exception {TwoInputStreamOperatorTestHarnessIN1, IN2, OUT testHarness new TwoInputStreamOperatorTestHarness(new CoProcessOperator((CoProcessFunction)Preconditions.checkNotNull(function)), 1, 1, 0);testHarness.open();return testHarness;}public static K, IN1, IN2, OUT KeyedTwoInputStreamOperatorTestHarnessK, IN1, IN2, OUT forKeyedCoProcessFunction(KeyedCoProcessFunctionK, IN1, IN2, OUT function, KeySelectorIN1, K keySelector1, KeySelectorIN2, K keySelector2, TypeInformationK keyType) throws Exception {KeyedTwoInputStreamOperatorTestHarnessK, IN1, IN2, OUT testHarness new KeyedTwoInputStreamOperatorTestHarness(new KeyedCoProcessOperator((KeyedCoProcessFunction)Preconditions.checkNotNull(function)), keySelector1, keySelector2, keyType, 1, 1, 0);testHarness.open();return testHarness;}public static IN1, IN2, OUT BroadcastOperatorTestHarnessIN1, IN2, OUT forBroadcastProcessFunction(BroadcastProcessFunctionIN1, IN2, OUT function, MapStateDescriptor?, ?... descriptors) throws Exception {BroadcastOperatorTestHarnessIN1, IN2, OUT testHarness new BroadcastOperatorTestHarness(new CoBroadcastWithNonKeyedOperator((BroadcastProcessFunction)Preconditions.checkNotNull(function), Arrays.asList(descriptors)), 1, 1, 0);testHarness.open();return testHarness;}public static K, IN1, IN2, OUT KeyedBroadcastOperatorTestHarnessK, IN1, IN2, OUT forKeyedBroadcastProcessFunction(KeyedBroadcastProcessFunctionK, IN1, IN2, OUT function, KeySelectorIN1, K keySelector, TypeInformationK keyType, MapStateDescriptor?, ?... descriptors) throws Exception {KeyedBroadcastOperatorTestHarnessK, IN1, IN2, OUT testHarness new KeyedBroadcastOperatorTestHarness(new CoBroadcastWithKeyedOperator((KeyedBroadcastProcessFunction)Preconditions.checkNotNull(function), Arrays.asList(descriptors)), keySelector, keyType, 1, 1, 0);testHarness.open();return testHarness;} }
http://www.w-s-a.com/news/839643/

相关文章:

  • 做国外单的网站叫什么海南省海口市网站建设
  • 杭州响应式网站案例wordpress5.2.2
  • 网站建设运营维护合同wordpress资源搜索插件
  • 国外网站流量查询东莞网站建设教程
  • 餐饮类网站建设达到的作用东莞工程建设交易中心网
  • 网站设计 知识产权湖北网站建设xiduyun
  • 猫咪网站模版下载中国风 古典 红色 网站源代码
  • 个人网站备案模板制作网站首页
  • 潍坊正规建设网站网站建设设计作业
  • 推荐一下网站谢谢辽宁住房城乡建设部官方网站
  • 网站文件大小英选 网站开发
  • 济南建网站哪家好wordpress编辑器排行
  • 在福州做搬家网站多少钱画册设计网站有哪些
  • 如何让别人浏览我做的网站哪些方法可以建设网站
  • 网站建设与管理网络推广的优点
  • 美食网站的设计与制作做网站的电销话术
  • 中国档案网站建设现状研究陕西建设厅执业资格注册中心网站
  • 网站建设的内容管理怎么用ps切片在dw里做网站
  • 建设婚恋网站用什么搭建涿州网站开发
  • 做知识内容的网站与app哈尔滨哪里有做网站的
  • 青岛企业网站建站模板百度网站建设推广
  • 做360网站中保存的图片存在哪里个人建立网站要多少钱
  • 网站安装部署无锡做网站的公司
  • 怎么将网站做成小程序安装wordpress到服务器
  • 企业网站建设的四大因素沈阳网站建设招标公司
  • wordpress仿站开发公司网站策划宣传
  • 金乡县网站开发网站开发三个流程
  • qq空间网站是多少纺织网站建设方案
  • 建设微网站项目报告网站优化难吗
  • 做网站需要自己上传产品吗企业网站系统设计