Skip to content

Commit

Permalink
Adds nextexpectedseqnum test defs and refactors test server to suppor…
Browse files Browse the repository at this point in the history
…t new syntax
  • Loading branch information
ackleymi committed Aug 30, 2024
1 parent 1c2db3a commit 9ddc098
Show file tree
Hide file tree
Showing 30 changed files with 490 additions and 30 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,32 +241,32 @@ jobs:
ACCEPTANCE_SET: lastseqnumprocessed
run: make generate-ci && make build && make $FIX_TEST

# nextexpectedseqnum:
# name: NextExpectedSeqNum Suite
# runs-on: ubuntu-latest
# strategy:
# matrix:
# go: [1.21]
# fix-version:
# - fix44
# - fix50
# - fix50sp1
# - fix50sp2
# steps:
# - name: Setup
# uses: actions/setup-go@v2
# with:
# go-version: ${{ matrix.go }}
# - name: Check out source
# uses: actions/checkout@v2
# - name: Install ruby
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: '3.0'
# - name: Acceptance test
# env:
# GO111MODULE: on
# FIX_TEST: ${{ matrix.fix-version }}
# STORE_TYPE: memory
# ACCEPTANCE_SET: nextexpectedseqnum
# run: make generate-ci && make build && make $FIX_TEST
nextexpectedseqnum:
name: NextExpectedSeqNum Suite
runs-on: ubuntu-latest
strategy:
matrix:
go: [1.21]
fix-version:
- fix44
- fix50
- fix50sp1
- fix50sp2
steps:
- name: Setup
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Check out source
uses: actions/checkout@v2
- name: Install ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Acceptance test
env:
GO111MODULE: on
FIX_TEST: ${{ matrix.fix-version }}
STORE_TYPE: memory
ACCEPTANCE_SET: nextexpectedseqnum
run: make generate-ci && make build && make $FIX_TEST
2 changes: 2 additions & 0 deletions _test/Reflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def processLine(lineNum, line, body, cid)
connectAction(cid)
elsif body == "DISCONNECT"
disconnectAction(cid)
elsif body.index("SET_SESSION") == 0
setSeqnum(body)
else
raise "Syntax error: " + body
end
Expand Down
8 changes: 8 additions & 0 deletions _test/ReflectorClient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require 'Reflector'
require 'FixParser'
require "socket"
require 'uri'
require 'net/http'

class ReflectorClient

Expand Down Expand Up @@ -62,6 +64,12 @@ def @reflector.disconnectAction(cid)
@sockets.delete(cid)
@parsers.delete(cid)
end

def @reflector.setSeqnum(body)
left_array = body.split(" ")
uri = URI('http://localhost:8095/seqnum?SESSION='+left_array[1]+'&'+left_array[2])
Net::HTTP.get_response(uri)
end

def @reflector.waitConnectAction(cid)
end
Expand Down
10 changes: 10 additions & 0 deletions _test/cfg/nextexpectedseqnum/fix44.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[DEFAULT]
SocketAcceptPort=5005
SenderCompID=ISLD
TargetCompID=TW
FileLogPath=tmp

[SESSION]
BeginString=FIX.4.4
DataDictionary=../spec/FIX44.xml
EnableNextExpectedMsgSeqNum=Y
12 changes: 12 additions & 0 deletions _test/cfg/nextexpectedseqnum/fix50.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[DEFAULT]
SocketAcceptPort=5006
SenderCompID=ISLD
TargetCompID=TW
FileLogPath=tmp

[SESSION]
BeginString=FIXT.1.1
DefaultApplVerID=FIX.5.0
TransportDataDictionary=../spec/FIXT11.xml
AppDataDictionary=../spec/FIX50.xml
EnableNextExpectedMsgSeqNum=Y
12 changes: 12 additions & 0 deletions _test/cfg/nextexpectedseqnum/fix50sp1.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[DEFAULT]
SocketAcceptPort=5007
SenderCompID=ISLD
TargetCompID=TW
FileLogPath=tmp

[SESSION]
BeginString=FIXT.1.1
DefaultApplVerID=FIX.5.0SP1
TransportDataDictionary=../spec/FIXT11.xml
AppDataDictionary=../spec/FIX50SP1.xml
EnableNextExpectedMsgSeqNum=Y
12 changes: 12 additions & 0 deletions _test/cfg/nextexpectedseqnum/fix50sp2.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[DEFAULT]
SocketAcceptPort=5008
SenderCompID=ISLD
TargetCompID=TW
FileLogPath=tmp

[SESSION]
BeginString=FIXT.1.1
DefaultApplVerID=FIX.5.0SP2
TransportDataDictionary=../spec/FIXT11.xml
AppDataDictionary=../spec/FIX50SP2.xml
EnableNextExpectedMsgSeqNum=Y
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
iCONNECT

#------------------------
# logon message and response
# send logon with sequence number equals to 1
# expect for a logon response with NextExpectedMsgSeqNum field equals to 2
#------------------------

I8=FIX.4.435=A34=149=TW52=<TIME>56=ISLD98=0789=1108=2
E8=FIX.4.49=6635=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=2789=210=0

# logout message and response
I8=FIX.4.435=534=249=TW52=<TIME>56=ISLD
E8=FIX.4.49=4935=534=249=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# If message NextExpectedMsgSeqNum field is too high, we must disconnect

iCONNECT
iSET_SESSION FIX.4.4:ISLD->TW NEXTSENDERSEQNUM=1
iSET_SESSION FIX.4.4:ISLD->TW NEXTTARGETSEQNUM=1

I8=FIX.4.435=A34=100049=TW52=<TIME>56=ISLD98=0789=1200108=30

E8=FIX.4.49=13535=534=149=ISLD52=00000000-00:00:00.00056=TW58=Tag 789 (NextExpectedMsgSeqNum) is higher than expected. Expected 1, Received 120010=0
eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
iCONNECT
iSET_SESSION FIX.4.4:ISLD->TW NEXTSENDERSEQNUM=2000
iSET_SESSION FIX.4.4:ISLD->TW NEXTTARGETSEQNUM=1

I8=FIX.4.435=A34=149=TW52=<TIME>56=ISLD98=0789=1108=30

E8=FIX.4.49=7035=A34=200049=ISLD52=00000000-00:00:00.00056=TW98=0108=30789=210=0
E8=FIX.4.49=9435=434=143=Y49=ISLD52=<TIME>56=TW122=<TIME>36=2001123=Y

# logout message and response
I8=FIX.4.435=534=249=TW52=<TIME>56=ISLD
E8=FIX.4.49=5235=534=200149=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# FIX Logon using tag 141/ResetSeqNumFlag and tag 789/NextExpectedSeqMsgNum

iCONNECT
iSET_SESSION FIX.4.4:ISLD->TW NEXTSENDERSEQNUM=2000
iSET_SESSION FIX.4.4:ISLD->TW NEXTTARGETSEQNUM=2000

I8=FIX.4.435=A34=149=TW52=<TIME>56=ISLD98=0789=1141=Y108=30
E8=FIX.4.49=7335=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=30141=Y789=210=0

# logout message and response
I8=FIX.4.435=534=249=TW52=<TIME>56=ISLD
E8=FIX.4.49=4935=534=249=ISLD52=00000000-00:00:0056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
iCONNECT

#------------------------
# logon message and response
# send logon with sequence number equals to 1
# expect for a logon response with NextExpectedMsgSeqNum field equals to 2
#------------------------

I8=FIXT.1.135=A34=149=TW52=<TIME>56=ISLD98=0789=11137=7108=2
E8=FIXT.1.19=7335=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=2789=21137=710=0

# logout message and response
I8=FIXT.1.135=534=249=TW52=<TIME>56=ISLD
E8=FIXT.1.19=4935=534=249=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# If message NextExpectedMsgSeqNum field is too high, we must disconnect

iCONNECT
iSET_SESSION FIXT.1.1:ISLD->TW NEXTSENDERSEQNUM=1
iSET_SESSION FIXT.1.1:ISLD->TW NEXTTARGETSEQNUM=1
I8=FIXT.1.135=A34=100049=TW52=<TIME>56=ISLD98=0789=12001137=7108=30

E8=FIXT.1.19=13535=534=149=ISLD52=00000000-00:00:00.00056=TW58=Tag 789 (NextExpectedMsgSeqNum) is higher than expected. Expected 1, Received 120010=0
eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
iCONNECT
iSET_SESSION FIXT.1.1:ISLD->TW NEXTSENDERSEQNUM=2000
iSET_SESSION FIXT.1.1:ISLD->TW NEXTTARGETSEQNUM=1

I8=FIXT.1.135=A34=149=TW52=<TIME>56=ISLD98=0789=11137=7108=30

E8=FIXT.1.19=7735=A34=200049=ISLD52=00000000-00:00:00.00056=TW98=0108=30789=21137=710=0
E8=FIXT.1.19=9435=434=143=Y49=ISLD52=<TIME>56=TW122=<TIME>36=2001123=Y

# logout message and response
I8=FIXT.1.135=534=249=TW52=<TIME>56=ISLD
E8=FIXT.1.19=5235=534=200149=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# FIX Logon using tag 141/ResetSeqNumFlag and tag 789/NextExpectedSeqMsgNum

iCONNECT
iSET_SESSION FIXT.1.1:ISLD->TW NEXTSENDERSEQNUM=2000
iSET_SESSION FIXT.1.1:ISLD->TW NEXTTARGETSEQNUM=2000

I8=FIXT.1.135=A34=149=TW52=<TIME>56=ISLD98=0789=1141=Y1137=7108=30
E8=FIXT.1.19=8035=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=30141=Y789=21137=710=0

# logout message and response
I8=FIXT.1.135=534=249=TW52=<TIME>56=ISLD
E8=FIXT.1.19=4935=534=249=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
iCONNECT

#------------------------
# logon message and response
# send logon with sequence number equals to 1
# expect for a logon response with NextExpectedMsgSeqNum field equals to 2
#------------------------

I8=FIXT.1.135=A34=149=TW52=<TIME>56=ISLD98=0789=11137=8108=2
E8=FIXT.1.19=7335=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=2789=21137=810=0

# logout message and response
I8=FIXT.1.135=534=249=TW52=<TIME>56=ISLD
E8=FIXT.1.19=4935=534=249=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# If message NextExpectedMsgSeqNum field is too high, we must disconnect

iCONNECT
iSET_SESSION FIXT.1.1:ISLD->TW NEXTSENDERSEQNUM=1
iSET_SESSION FIXT.1.1:ISLD->TW NEXTTARGETSEQNUM=1
I8=FIXT.1.135=A34=100049=TW52=<TIME>56=ISLD98=0789=12001137=8108=30

E8=FIXT.1.19=13535=534=149=ISLD52=00000000-00:00:00.00056=TW58=Tag 789 (NextExpectedMsgSeqNum) is higher than expected. Expected 1, Received 120010=0
eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
iCONNECT
iSET_SESSION FIXT.1.1:ISLD->TW NEXTSENDERSEQNUM=2000
iSET_SESSION FIXT.1.1:ISLD->TW NEXTTARGETSEQNUM=1

I8=FIXT.1.135=A34=149=TW52=<TIME>56=ISLD98=0789=11137=10108=30

E8=FIXT.1.19=7735=A34=200049=ISLD52=00000000-00:00:00.00056=TW98=0108=30789=21137=810=0
E8=FIXT.1.19=9435=434=143=Y49=ISLD52=<TIME>56=TW122=<TIME>36=2001123=Y

# logout message and response
I8=FIXT.1.135=534=249=TW52=<TIME>56=ISLD
E8=FIXT.1.19=5235=534=200149=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# FIX Logon using tag 141/ResetSeqNumFlag and tag 789/NextExpectedSeqMsgNum

iCONNECT
iSET_SESSION FIXT.1.1:ISLD->TW NEXTSENDERSEQNUM=2000
iSET_SESSION FIXT.1.1:ISLD->TW NEXTTARGETSEQNUM=2000

I8=FIXT.1.135=A34=149=TW52=<TIME>56=ISLD98=0789=1141=Y1137=8108=30
E8=FIXT.1.19=8035=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=30141=Y789=21137=810=0

# logout message and response
I8=FIXT.1.135=534=249=TW52=<TIME>56=ISLD
E8=FIXT.1.19=4935=534=249=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
iCONNECT

#------------------------
# logon message and response
# send logon with sequence number equals to 1
# expect for a logon response with NextExpectedMsgSeqNum field equals to 2
#------------------------

I8=FIXT.1.135=A34=149=TW52=<TIME>56=ISLD98=0789=11137=9108=2
E8=FIXT.1.19=7335=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=2789=21137=910=0

# logout message and response
I8=FIXT.1.135=534=249=TW52=<TIME>56=ISLD
E8=FIXT.1.19=4935=534=249=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# If message NextExpectedMsgSeqNum field is too high, we must disconnect

iCONNECT
iSET_SESSION FIXT.1.1:ISLD->TW NEXTSENDERSEQNUM=1
iSET_SESSION FIXT.1.1:ISLD->TW NEXTTARGETSEQNUM=1
I8=FIXT.1.135=A34=100049=TW52=<TIME>56=ISLD98=0789=12001137=9108=30

E8=FIXT.1.19=13535=534=149=ISLD52=00000000-00:00:00.00056=TW58=Tag 789 (NextExpectedMsgSeqNum) is higher than expected. Expected 1, Received 120010=0
eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
iCONNECT
iSET_SESSION FIXT.1.1:ISLD->TW NEXTSENDERSEQNUM=2000
iSET_SESSION FIXT.1.1:ISLD->TW NEXTTARGETSEQNUM=1

I8=FIXT.1.135=A34=149=TW52=<TIME>56=ISLD98=0789=11137=9108=30

E8=FIXT.1.19=7735=A34=200049=ISLD52=00000000-00:00:00.00056=TW98=0108=30789=21137=910=0
E8=FIXT.1.19=9435=434=143=Y49=ISLD52=<TIME>56=TW122=<TIME>36=2001123=Y

# logout message and response
I8=FIXT.1.135=534=249=TW52=<TIME>56=ISLD
E8=FIXT.1.19=5235=534=200149=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# FIX Logon using tag 141/ResetSeqNumFlag and tag 789/NextExpectedSeqMsgNum

iCONNECT
iSET_SESSION FIXT.1.1:ISLD->TW NEXTSENDERSEQNUM=2000
iSET_SESSION FIXT.1.1:ISLD->TW NEXTTARGETSEQNUM=2000

I8=FIXT.1.135=A34=149=TW52=<TIME>56=ISLD98=0789=1141=Y1137=9108=30
E8=FIXT.1.19=8035=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=30141=Y789=21137=910=0

# logout message and response
I8=FIXT.1.135=534=249=TW52=<TIME>56=ISLD
E8=FIXT.1.19=4935=534=249=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
Loading

0 comments on commit 9ddc098

Please sign in to comment.