Skip to content
A fix session layer test suite written in Scala. It acts as an initiator and looks for the correct responses.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
fixspec
sf-fix-tester/src
.gitignore
LICENSE.txt
README.md
build.sbt

README.md

SackFix

A Scala Fix Engine implementation. It is a full implementation of the session level protocol, tested using the sackfix tester project, supporting acceptor and initiators using AKKA and Scala.

To get started simply download the examples project and start the acceptor and then the initiator. The SackFix suite consists of

  • Examples: This is all you need!
  • Tester: A very simple test suite to stress out any Session level implementation.
  • Session: All of the statemachines and message handling for the Fix Session. ie the business logic lives here.
  • Messages: Code generated Fix Messages for all versions of fix.
  • Common: The code generator and common classes - including all the code generated Fields.

Full documentation is at SackFix.org.

Versions

JDK 1.8, Scala 2.11, SBT 0.13.12, Akka 2.4.16. Feel free to upgrade.

What is this project?

SackFixTests is the independent test suite used to validate the session layer implementation within SackFix.

It does not rely on SackFix itself (see sackfix.org) but includes a very tiny set of utility classes to act as a Fix initiator.

This means you can use it to validate your own session layer implementation.

Start up your Fix server implementation, change the src/main/resources/application.conf so that it matches your server settings. Then fire up sbt and run the tests.

Does your server need to do anything special?

The tests require that should you receive a NewOrderSingle then you should reply with an ExecutionReport. For instance, see T8_ResendRequestSpec.

You also need a persistent message store so that replay of business messages works.

What is not tested?

Well, SackFix will not implement login, or encryption, or data content. It will also not insist on the ordering of fields within the message or header as experience shows there are too many implementations which do not do that correctly.

Due to the above, tests that focus on these items were not written.

In particular:

  • A tests of ordering of fields in a group,
  • A test that all header fields preceed all body fields

What is tested?

Pretty much all the session level validation and message flows for login, logout and resend requests.

How does it work?

There is a really straight forward Fix sender and receiver based on the old Java sockets - this is very deliberately not straying into NIO, Netty or Akka.io etc. Its as simple as I could do it, with little thought or effort.

So the simple fix package does key value tuples, and sockets. It provides the handy utils for logging in, logging out and creating headers using the values from application.conf.

Why SackFix tests?

As I said, I've been learning Scala and wanted to know the session level spec, and writing the tests seemed like a fine way to learn.

All the best,

Jonathan

2017

How to run it

cd into the base dir of the project
sbt
>clean
>compile
>test

Expected output

> test
[info] Compiling 39 Scala sources to C:\all_dev\sackfix\sackfixtests\sf-fix-tester\target\scala-2.11\test-classes...
[info] T14_h_DuplicateTag:
[info] Receive application or administrative message
[info] - should Send message with missing value
[info] T4_b_SendThemTestReqSpec:
[info] Send heartbeat message
[info] - should If send a test request expect heartbeat reply
[info] T2_q_InvalidMessageType:
[info] Receive Message Standard Header
[info] - should Reject invalid message type
[info] T10_2_ReceiveSeqResetSeqGapFillDupLowerSpec:
[info] Receive SequenceReset Message
[info] - should If msgSeqsend time, disconnect
[info] - should logon has low seq num and poss dup flag=y, disconnect and close socket after 2 secs
[info] T10_4_ReceiveSeqResetSeqGapFillSpec:
[info] Receive SequenceReset Message
[info] - should Reset the sequence number!
[info] T10_3_ReceiveSeqResetSeqGapFillLowerSpec:
[info] Receive SequenceReset Message
[info] - should If msgSeqexpected then gap fill
[info] T2_b_SeqNumResend:
[info] Receive Message Standard Header
[info] - should accept first message and then resend request
[info] T1S_a_LoginResendRequestSpec:
[info] Receive Logon message
[info] - should Receive a logon and a resend request
[info] T1S_c_BadCompIdSpec:
[info] Receive Logon message
[info] - should Close the socket
[info] T1S_b_LoginTwiceSpec:
[info] Receive Logon message
[info] - should 2nd Logon should just get socket closed
[info] T14_b_MissingMandTag:
[info] Receive application or administrative message
[info] - should Send message with missing mand tag
[info] T3_e_GarbledChecksumBadLen:
[info] Receive Message Standard Trailer
[info] - should Garbled checsum of 2 chars ignored
[info] Run completed in 1 minute, 32 seconds.
[info] Total number of tests run: 40
[info] Suites: completed 39, aborted 0
[info] Tests: succeeded 40, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 99 s, completed

You can’t perform that action at this time.