首页 > 其他分享 >fix协议介绍5-测试消息

fix协议介绍5-测试消息

时间:2022-10-10 14:33:33浏览次数:44  
标签:协议 tagIdsSet fix tagId testReqID Tag 测试 new public


FIX.5.0SP2 Message

TestRequest [type '1']



The test request message forces a heartbeat from the opposing application. The test request message checks sequence numbers or verifies communication line status. The opposite application responds to the Test Request with a Heartbeat containing the TestReqID.

fix协议介绍5-测试消息_ide



测试消息实现:

package cs.mina.codec.msg;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import cs.mina.exception.InValidDataException;

/*
*@author(huangxiaoping)
*@date 2013-11-25
*/
public class TestRequestMsg extends BaseMsg {
private Tag testReqID = new Tag("112", "String", true);
private Set<String> tagIdsSet = new HashSet<String>();

public TestRequestMsg() {
this.getHeadEntity().getMsgType().setTagValue("1");
tagIdsSet.add("112");
this.getBodyEntity().getBodyTagList().add(testReqID);
}

@Override
public void decodeBody() {
Set<String> already=new HashSet<String>();
String[] bodyItems=this.body.split(BaseMsg.SOH);
for(int i=0;i<bodyItems.length;i++){
String[]tagItems=bodyItems[i].split("=");
if(tagItems.length!=2){
throw new InValidDataException("消息格式错误");
}
String tagId=tagItems[0];
if(already.contains(tagId)){
throw new InValidDataException("消息格式错误");
}
already.add(tagId);
if(this.tagIdsSet.contains(tagId)){
List<Tag> tagList=this.bodyEntity.getBodyTagList();
for(int j=0;j<tagList.size();j++){
Tag tag=tagList.get(j);
if(tag.getTagId().equals(tagId)){
tag.setTagValue(tagItems[1]);
break;
}
}
}else{
throw new InValidDataException("消息格式错误,"+tagId+"不在消息体内");
}
}
}

@Override
public void validate() {
this.headEntity.validate();
List<Tag> bodyTagList=this.bodyEntity.getBodyTagList();
for(int i=0;i<bodyTagList.size();i++){
bodyTagList.get(i).validate();
}
this.tailerEntity.validate();
}

public Tag getTestReqID() {
return testReqID;
}

public void setTestReqID(Tag testReqID) {
this.testReqID = testReqID;
}

public Set<String> getTagIdsSet() {
return tagIdsSet;
}

public void setTagIdsSet(Set<String> tagIdsSet) {
this.tagIdsSet = tagIdsSet;
}

}


处理逻辑:略



标签:协议,tagIdsSet,fix,tagId,testReqID,Tag,测试,new,public
From: https://blog.51cto.com/u_11979904/5743361

相关文章

  • fix协议介绍4-心跳
    FIX.5.0SP2MessageHeartbeat [type'0']TheHeartbeatmonitorsthestatusofthecommunicationlinkandidentifieswhenthelastofastringofmessageswas......
  • fix协议介绍6-重发消息
    FIX.5.0SP2MessageResendRequest [type'2']Theresendrequestissentbythereceivingapplicationtoinitiatetheretransmissionofmessages.Thisfunction......
  • fix协议介绍7-序列号重置
    FIX.5.0SP2MessageSequenceReset [type'4']Thesequenceresetmessageisusedbythesendingapplicationtoresettheincomingsequencenumberontheopposi......
  • fix协议介绍8-Reject消息
    FIX.5.0SP2MessageReject [type'3']Therejectmessageshouldbeissuedwhenamessageisreceivedbutcannotbeproperlyprocessedduetoasession-levelr......
  • RFID Gen2协议Session含义
    RFIDGen2协议中Session参数主要为了方便标签盘点。每个标签都包含s0-s3总计4种session,每种session中又各有A,B两种inventoriedflag,这些flag在不同Session之间不互通。换......
  • DFP 数据转发协议应用实例 3.LoRA 中继-使用频道实现
    DFP数据转发协议应用实例 3.LoRA中继-使用频道实现DFP是什么?稳控科技编写的一套数据转发规则,取自“自由转发协议FFP(FreeForwardProtocol)”,或者DFP(DoubleFProt......
  • 软件测试基础练习
    1.小程序的业务用例    2.单模块用例编写  用例编号用例标题项目/模块优先级前置条件操作步骤测试数据预期结果login_phone......
  • mysql 5.1.73 binlog测试以及全量备份恢复测试
       甲方提出业务服务器的mysql日志要本地备份或者上传日志服务器,以及要具备回滚、恢复功能。问了度娘后,同甲方商量、建议,保存binlog日志30天且每月全量备份一次。 ......
  • 如何实现汇川PLC和工业机器人的协议解析与数据采集?
    汇川是一家专注于工业自动化的设备制造商,具备一整套完善的产品与服务,涉及变频器、伺服系统、PLC、HMI触摸屏、电动汽车电机控制器、光伏逆变器等等,在制造业、新能源、环保节......
  • 【测试】Selenium录制单元测试脚本
    因业务性质发生变化,公司有要求做业务测试自动化用以替代人工进行可重复执行操作。基于学习曲线比较平缓且容易上手考虑,最终选择了Selenium作为自动化测试框架。安装Selenium......