agent_fix 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +12 -0
- data/CONTRIBUTION_GUIDELINES.md +22 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +86 -0
- data/LICENSE.txt +14 -0
- data/QUICKFIX_LICENSE.txt +46 -0
- data/README.md +210 -0
- data/Rakefile +39 -0
- data/VERSION +1 -0
- data/agent_fix.gemspec +83 -0
- data/config/fix_agents.rb +14 -0
- data/config/logging.properties +6 -0
- data/features/inspect_all.feature +28 -0
- data/features/scope.feature +68 -0
- data/features/step_definitions/steps.rb +32 -0
- data/features/support/FIX42.xml +2670 -0
- data/features/support/env.rb +29 -0
- data/lib/agent_fix/agent.rb +157 -0
- data/lib/agent_fix/configuration.rb +46 -0
- data/lib/agent_fix/cucumber/report.rb +79 -0
- data/lib/agent_fix/cucumber.rb +146 -0
- data/lib/agent_fix/message_cache.rb +31 -0
- data/lib/agent_fix.rb +75 -0
- data/spec/agent_fix/configuration_spec.rb +12 -0
- data/spec/agent_fix/message_cache_spec.rb +16 -0
- data/spec/spec_helper.rb +8 -0
- metadata +189 -0
data/.travis.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
If you come across any issues, please [tell us](https://github.com/connamara/agent_fix/issues).
|
2
|
+
Pull requests (with tests) are appreciated. No pull request is too small. Please help with:
|
3
|
+
|
4
|
+
* Reporting bugs
|
5
|
+
* Suggesting features
|
6
|
+
* Writing or improving documentation
|
7
|
+
* Fixing typos
|
8
|
+
* Cleaning whitespace
|
9
|
+
* Refactoring code
|
10
|
+
* Adding tests
|
11
|
+
* Closing [issues](https://github.com/connamara/agent_fix/issues)
|
12
|
+
|
13
|
+
Contributing to agent_fix:
|
14
|
+
|
15
|
+
1. Fork the [official repository](https://github.com/connamara/agent_fix/tree/master).
|
16
|
+
2. Make your changes in a topic branch.
|
17
|
+
3. Send a pull request.
|
18
|
+
|
19
|
+
Notes:
|
20
|
+
* If you report a bug and don't include a fix, please include a failing test.
|
21
|
+
* Contributions without tests won't be accepted.
|
22
|
+
* Please don't update the Gem version
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem "quickfix-jruby", "~>1.5.4"
|
4
|
+
gem "anticipate"
|
5
|
+
gem "cucumber", "~> 1.3"
|
6
|
+
gem "fix_spec", "~> 0.1"
|
7
|
+
#gem "slf4j"
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem "jeweler", "~> 1.8"
|
11
|
+
gem "rspec", "~> 2.14"
|
12
|
+
gem "rake", "~> 10.1"
|
13
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.5)
|
5
|
+
anticipate (0.1.1)
|
6
|
+
builder (3.2.2)
|
7
|
+
cucumber (1.3.6)
|
8
|
+
builder (>= 2.1.2)
|
9
|
+
diff-lcs (>= 1.1.3)
|
10
|
+
gherkin (~> 2.12.0)
|
11
|
+
multi_json (~> 1.7.5)
|
12
|
+
multi_test (>= 0.0.2)
|
13
|
+
cuke_mem (0.1.1)
|
14
|
+
cucumber (~> 1.3)
|
15
|
+
diff-lcs (1.2.4)
|
16
|
+
faraday (0.8.8)
|
17
|
+
multipart-post (~> 1.2.0)
|
18
|
+
fix_spec (0.1.0)
|
19
|
+
cuke_mem (~> 0.1.1)
|
20
|
+
json_spec (~> 1.1.1)
|
21
|
+
quickfix-jruby (~> 1.5.3)
|
22
|
+
gherkin (2.12.1-java)
|
23
|
+
multi_json (~> 1.3)
|
24
|
+
git (1.2.6)
|
25
|
+
github_api (0.10.1)
|
26
|
+
addressable
|
27
|
+
faraday (~> 0.8.1)
|
28
|
+
hashie (>= 1.2)
|
29
|
+
multi_json (~> 1.4)
|
30
|
+
nokogiri (~> 1.5.2)
|
31
|
+
oauth2
|
32
|
+
hashie (2.0.5)
|
33
|
+
highline (1.6.19)
|
34
|
+
httpauth (0.2.0)
|
35
|
+
jeweler (1.8.7)
|
36
|
+
builder
|
37
|
+
bundler (~> 1.0)
|
38
|
+
git (>= 1.2.5)
|
39
|
+
github_api (= 0.10.1)
|
40
|
+
highline (>= 1.6.15)
|
41
|
+
nokogiri (= 1.5.10)
|
42
|
+
rake
|
43
|
+
rdoc
|
44
|
+
json (1.8.0-java)
|
45
|
+
json_spec (1.1.1)
|
46
|
+
multi_json (~> 1.0)
|
47
|
+
rspec (~> 2.0)
|
48
|
+
jwt (0.1.8)
|
49
|
+
multi_json (>= 1.5)
|
50
|
+
multi_json (1.7.9)
|
51
|
+
multi_test (0.0.2)
|
52
|
+
multi_xml (0.5.5)
|
53
|
+
multipart-post (1.2.0)
|
54
|
+
nokogiri (1.5.10-java)
|
55
|
+
oauth2 (0.9.2)
|
56
|
+
faraday (~> 0.8)
|
57
|
+
httpauth (~> 0.2)
|
58
|
+
jwt (~> 0.1.4)
|
59
|
+
multi_json (~> 1.0)
|
60
|
+
multi_xml (~> 0.5)
|
61
|
+
rack (~> 1.2)
|
62
|
+
quickfix-jruby (1.5.4-java)
|
63
|
+
rack (1.5.2)
|
64
|
+
rake (10.1.0)
|
65
|
+
rdoc (4.0.1)
|
66
|
+
json (~> 1.4)
|
67
|
+
rspec (2.14.1)
|
68
|
+
rspec-core (~> 2.14.0)
|
69
|
+
rspec-expectations (~> 2.14.0)
|
70
|
+
rspec-mocks (~> 2.14.0)
|
71
|
+
rspec-core (2.14.5)
|
72
|
+
rspec-expectations (2.14.2)
|
73
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
74
|
+
rspec-mocks (2.14.3)
|
75
|
+
|
76
|
+
PLATFORMS
|
77
|
+
java
|
78
|
+
|
79
|
+
DEPENDENCIES
|
80
|
+
anticipate
|
81
|
+
cucumber (~> 1.3)
|
82
|
+
fix_spec (~> 0.1)
|
83
|
+
jeweler (~> 1.8)
|
84
|
+
quickfix-jruby (~> 1.5.4)
|
85
|
+
rake (~> 10.1)
|
86
|
+
rspec (~> 2.14)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Copyright (C) 2013 Connamara Systems, llc
|
2
|
+
|
3
|
+
This program is free software: you can redistribute it and/or modify
|
4
|
+
it under the terms of the GNU General Public License as published by
|
5
|
+
the Free Software Foundation, either version 3 of the License, or
|
6
|
+
(at your option) any later version.
|
7
|
+
|
8
|
+
This program is distributed in the hope that it will be useful,
|
9
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
GNU General Public License for more details.
|
12
|
+
|
13
|
+
You should have received a copy of the GNU General Public License
|
14
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
@@ -0,0 +1,46 @@
|
|
1
|
+
The QuickFIX Software License, Version 1.0
|
2
|
+
|
3
|
+
Copyright (c) 2001-2010 quickfixengine.org All rights
|
4
|
+
reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions
|
8
|
+
are met:
|
9
|
+
|
10
|
+
1. Redistributions of source code must retain the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
notice, this list of conditions and the following disclaimer in
|
15
|
+
the documentation and/or other materials provided with the
|
16
|
+
distribution.
|
17
|
+
|
18
|
+
3. The end-user documentation included with the redistribution,
|
19
|
+
if any, must include the following acknowledgment:
|
20
|
+
"This product includes software developed by
|
21
|
+
quickfixengine.org (http://www.quickfixengine.org/)."
|
22
|
+
Alternately, this acknowledgment may appear in the software itself,
|
23
|
+
if and wherever such third-party acknowledgments normally appear.
|
24
|
+
|
25
|
+
4. The names "QuickFIX" and "quickfixengine.org" must
|
26
|
+
not be used to endorse or promote products derived from this
|
27
|
+
software without prior written permission. For written
|
28
|
+
permission, please contact ask@quickfixengine.org
|
29
|
+
|
30
|
+
5. Products derived from this software may not be called "QuickFIX",
|
31
|
+
nor may "QuickFIX" appear in their name, without prior written
|
32
|
+
permission of quickfixengine.org
|
33
|
+
|
34
|
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
35
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
36
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
37
|
+
DISCLAIMED. IN NO EVENT SHALL QUICKFIXENGINE.ORG OR
|
38
|
+
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
39
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
40
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
41
|
+
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
42
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
43
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
44
|
+
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
45
|
+
SUCH DAMAGE.
|
46
|
+
|
data/README.md
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
agent\_fix [![Build Status](https://travis-ci.org/connamara/agent_fix.png)](https://travis-ci.org/connamara/agent_fix)
|
2
|
+
==========
|
3
|
+
|
4
|
+
Agent framework designed for FIX applications using [quickfix-jruby](https://github.com/connamara/quickfix-jruby).
|
5
|
+
|
6
|
+
Usage
|
7
|
+
-----
|
8
|
+
|
9
|
+
### Agent Types
|
10
|
+
|
11
|
+
#### Initiator
|
12
|
+
* Connects to an address hosting a fix session (FIX Client)
|
13
|
+
|
14
|
+
#### Acceptor
|
15
|
+
* Binds on an address to host a fix session (FIX Server)
|
16
|
+
|
17
|
+
|
18
|
+
### Agent Definition
|
19
|
+
|
20
|
+
Inside your project, declare agents and connection information inside ```config/fix_agents.rb``` like so:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
PORT=5000
|
24
|
+
AgentFIX.session_defaults.merge! BeginString: "FIX.4.2", SocketAcceptPort: PORT, SocketConnectPort: PORT, SocketConnectHost: "localhost"
|
25
|
+
|
26
|
+
AgentFIX.define_acceptor :my_acceptor do |a|
|
27
|
+
a.default ={SenderCompID: "TW"}
|
28
|
+
a.session ={TargetCompID: "ARCA"}
|
29
|
+
end
|
30
|
+
|
31
|
+
AgentFIX.define_initiator :my_initiator do |i|
|
32
|
+
i.default ={SenderCompID: "ARCA"}
|
33
|
+
i.session ={TargetCompID: "TW"}
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
Usage
|
38
|
+
-----
|
39
|
+
|
40
|
+
### Configuration
|
41
|
+
|
42
|
+
In order to use Agent FIX, in your `env.rb` you must:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
require 'agent_fix'
|
46
|
+
```
|
47
|
+
|
48
|
+
You can define a data dictionary using FIX spec:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
FIXSpec.data_dictionary= quickfix.DataDictionary.new "path/to/FIX42.xml"
|
52
|
+
```
|
53
|
+
|
54
|
+
Configure inspection behavior to use combined admin & app messages (default is app-only):
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
AgentFIX.include_session_level = true
|
58
|
+
```
|
59
|
+
|
60
|
+
### Getting Started
|
61
|
+
|
62
|
+
Start the FIX agents:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
AgentFIX.start
|
66
|
+
at_exit {AgentFIX.stop}
|
67
|
+
```
|
68
|
+
|
69
|
+
When using cucumber, to clear message caches before each scenario:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
Before do
|
73
|
+
sleep(0.5)
|
74
|
+
AgentFIX.reset
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
### Scoping in cucumber steps
|
79
|
+
|
80
|
+
Agent FIX comes with a few features to assist in organizing larger tests, including the ability to scope incoming messages. As an example, taken from `features/scope.feature`, first define your scope size with the expectation to receive a certain number of messages:
|
81
|
+
|
82
|
+
```cucumber
|
83
|
+
Then I should receive 3 messages on FIX with agent "my_initiator"
|
84
|
+
```
|
85
|
+
|
86
|
+
Your scope is now defined to 3 messages. Whenever you attempt to inspect a message by index, the locally defined scope will be used:
|
87
|
+
|
88
|
+
```cucumber
|
89
|
+
And the 2nd message should have the following:
|
90
|
+
| ClOrdID | "hello" |
|
91
|
+
| OrderID | "abc" |
|
92
|
+
| Symbol | "IBM" |
|
93
|
+
| OrdStatus | "PENDING_NEW" |
|
94
|
+
```
|
95
|
+
|
96
|
+
This will attempt to inspect the second message in the local scope. If you then said:
|
97
|
+
|
98
|
+
```cucumber
|
99
|
+
Then I should receive 4 messages on FIX with agent "my_initiator"
|
100
|
+
And the 2nd message should have the following:
|
101
|
+
| ClOrdID | "hello" |
|
102
|
+
| OrderID | "abc" |
|
103
|
+
| Symbol | "IBM" |
|
104
|
+
| OrdStatus | "PENDING_CANCEL" |
|
105
|
+
```
|
106
|
+
|
107
|
+
The inspection step, `And the 2nd message should have the following` will be looking at the 5th message the agent has received since the scenario was started, or the 2nd message in the last defined scope. The first scope was defined to have 3 messages, the second defined to have 4, which means the second scope is defined as messages #4-7.
|
108
|
+
|
109
|
+
### Scope inclusion
|
110
|
+
|
111
|
+
Scope inclusion is scope inspection without regard to order. Say the agent received the following FIX messages:
|
112
|
+
|
113
|
+
```
|
114
|
+
8=FIX.4.2|35=8|11=hello|17=123|37=abc|39=A|150=A|151=0|20=0|6=0|14=0|21=1|55=IBM|54=1|40=2|60=20090101-17:13:06.684|
|
115
|
+
8=FIX.4.2|35=8|11=hello|17=123|37=abc|39=0|150=0|151=0|20=0|6=0|14=0|21=1|55=IBM|54=1|40=2|60=20090101-17:13:06.684|
|
116
|
+
8=FIX.4.2|35=8|11=hello|17=123|37=abc|39=4|150=A|151=0|20=0|6=0|14=0|21=1|55=IBM|54=1|40=2|60=20090101-17:13:06.684|
|
117
|
+
8=FIX.4.2|35=8|11=hello|17=123|37=abc|39=2|150=A|151=0|20=0|6=0|14=0|21=1|55=IBM|54=1|40=2|60=20090101-17:13:06.684|
|
118
|
+
```
|
119
|
+
|
120
|
+
Define your scope:
|
121
|
+
|
122
|
+
|
123
|
+
```cucumber
|
124
|
+
Then I should receive 3 messages on FIX with agent "my_initiator"
|
125
|
+
```
|
126
|
+
|
127
|
+
Check for inclusion:
|
128
|
+
|
129
|
+
```cucumber
|
130
|
+
And the FIX messages should include a message with the following:
|
131
|
+
| ClOrdID | "hello" |
|
132
|
+
| OrderID | "abc" |
|
133
|
+
| Symbol | "IBM" |
|
134
|
+
| OrdStatus | "NEW" |
|
135
|
+
```
|
136
|
+
|
137
|
+
Message #2 has `OrdStatus=NEW`, and matches the cucumber step, so this step will pass. If the message was first or third in the scope, the step would still pass. If, however, another scope was then defined:
|
138
|
+
|
139
|
+
```cucumber
|
140
|
+
Then I should receive a message on FIX with agent "my_initiator"
|
141
|
+
```
|
142
|
+
|
143
|
+
And an inclusion check was performed:
|
144
|
+
|
145
|
+
```cucumber
|
146
|
+
And the FIX messages should include a message with the following:
|
147
|
+
| ClOrdID | "hello" |
|
148
|
+
| OrderID | "abc" |
|
149
|
+
| Symbol | "IBM" |
|
150
|
+
| OrdStatus | "NEW" |
|
151
|
+
```
|
152
|
+
|
153
|
+
The new scope, containing one message, will contain the last FIX message `OrdStatus=CANCELED`, and not `OrdStatus=NEW` since that was consumed by the previous scope. The second inclusion check for `OrdStatus=NEW` would then fail, since the received message was defined in a previous inspection scope.
|
154
|
+
|
155
|
+
### Identifying scoped FIX messages in failed scenarios
|
156
|
+
|
157
|
+
In a failed Agent FIX scenario, if a scope & agent were ever defined, the last defined scope & agent will print their sent & received messages, colored according to the last defined scope. All sent messages will be colored in green, received messages prior to the current scope will be colored in green, and the current scope when the scenario failed will have its messages colored in red.
|
158
|
+
|
159
|
+
### More
|
160
|
+
|
161
|
+
Check out [features](features/) to see all the ways you can use agent_fix.
|
162
|
+
|
163
|
+
Install
|
164
|
+
-------
|
165
|
+
|
166
|
+
```shell
|
167
|
+
gem install agent_fix
|
168
|
+
```
|
169
|
+
|
170
|
+
or add the following to Gemfile:
|
171
|
+
```ruby
|
172
|
+
gem 'agent_fix'
|
173
|
+
```
|
174
|
+
and run `bundle install` from your shell.
|
175
|
+
|
176
|
+
|
177
|
+
More Information
|
178
|
+
----------------
|
179
|
+
|
180
|
+
* [Rubygems](https://rubygems.org/gems/agent_fix)
|
181
|
+
* [Issues](https://github.com/connamara/agent_fix/issues)
|
182
|
+
* [Connamara Systems](http://connamara.com)
|
183
|
+
|
184
|
+
Contributing
|
185
|
+
------------
|
186
|
+
|
187
|
+
Please see the [contribution guidelines](CONTRIBUTION_GUIDELINES.md).
|
188
|
+
|
189
|
+
Credits
|
190
|
+
-------
|
191
|
+
|
192
|
+
Contributers:
|
193
|
+
|
194
|
+
* Chris Busbey
|
195
|
+
* Matt Lane
|
196
|
+
|
197
|
+
![Connamara Systems](http://www.connamara.com/images/home-connamara-logo-lg.png)
|
198
|
+
|
199
|
+
agent_fix is maintained and funded by [Connamara Systems, llc](http://connamara.com).
|
200
|
+
|
201
|
+
The names and logos for Connamara Systems are trademarks of Connamara Systems, llc.
|
202
|
+
|
203
|
+
Licensing
|
204
|
+
---------
|
205
|
+
|
206
|
+
agent_fix is Copyright © 2013 Connamara Systems, llc.
|
207
|
+
|
208
|
+
This software is available under the GPL and a commercial license. Please see the [LICENSE](LICENSE.txt) file for the terms specified by the GPL license. The commercial license offers more flexible licensing terms compared to the GPL, and includes support services. [Contact us](mailto:info@connamara.com) for more information on the Connamara commercial license, what it enables, and how you can start commercial development with it.
|
209
|
+
|
210
|
+
This product includes software developed by quickfixengine.org ([http://www.quickfixengine.org/](http://www.quickfixengine.org/)). Please see the [QuickFIX Software LICENSE](QUICKFIX_LICENSE.txt) for the terms specified by the QuickFIX Software License.
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'rspec/core/rake_task'
|
14
|
+
require 'cucumber/rake/task'
|
15
|
+
|
16
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
17
|
+
t.rspec_opts = %w{--color}
|
18
|
+
end
|
19
|
+
Cucumber::Rake::Task.new(:cucumber) do |t|
|
20
|
+
t.cucumber_opts = %w{--color --format pretty}
|
21
|
+
end
|
22
|
+
|
23
|
+
task :test => [:spec,:cucumber]
|
24
|
+
task :default => :test
|
25
|
+
|
26
|
+
require 'jeweler'
|
27
|
+
Jeweler::Tasks.new do |gem|
|
28
|
+
gem.name = "agent_fix"
|
29
|
+
gem.homepage = "http://github.com/connamara/agent_fix"
|
30
|
+
gem.license = "GPL"
|
31
|
+
gem.summary = %Q{Agent framework for FIX messages}
|
32
|
+
gem.description = %Q{Interact with FIX connections to send, receive, and inspect messages in cucumber}
|
33
|
+
gem.email = "info@connamara.com"
|
34
|
+
gem.authors = ["Matt Lane","Chris Busbey"]
|
35
|
+
# dependencies defined in Gemfile
|
36
|
+
end
|
37
|
+
|
38
|
+
Jeweler::RubygemsDotOrgTasks.new
|
39
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/agent_fix.gemspec
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "agent_fix"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Matt Lane", "Chris Busbey"]
|
12
|
+
s.date = "2013-09-04"
|
13
|
+
s.description = "Interact with FIX connections to send, receive, and inspect messages in cucumber"
|
14
|
+
s.email = "info@connamara.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".travis.yml",
|
21
|
+
"CONTRIBUTION_GUIDELINES.md",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"QUICKFIX_LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"agent_fix.gemspec",
|
30
|
+
"config/fix_agents.rb",
|
31
|
+
"config/logging.properties",
|
32
|
+
"features/inspect_all.feature",
|
33
|
+
"features/scope.feature",
|
34
|
+
"features/step_definitions/steps.rb",
|
35
|
+
"features/support/FIX42.xml",
|
36
|
+
"features/support/env.rb",
|
37
|
+
"lib/agent_fix.rb",
|
38
|
+
"lib/agent_fix/agent.rb",
|
39
|
+
"lib/agent_fix/configuration.rb",
|
40
|
+
"lib/agent_fix/cucumber.rb",
|
41
|
+
"lib/agent_fix/cucumber/report.rb",
|
42
|
+
"lib/agent_fix/message_cache.rb",
|
43
|
+
"spec/agent_fix/configuration_spec.rb",
|
44
|
+
"spec/agent_fix/message_cache_spec.rb",
|
45
|
+
"spec/spec_helper.rb"
|
46
|
+
]
|
47
|
+
s.homepage = "http://github.com/connamara/agent_fix"
|
48
|
+
s.licenses = ["GPL"]
|
49
|
+
s.require_paths = ["lib"]
|
50
|
+
s.rubygems_version = "1.8.24"
|
51
|
+
s.summary = "Agent framework for FIX messages"
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
s.specification_version = 3
|
55
|
+
|
56
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
57
|
+
s.add_runtime_dependency(%q<quickfix-jruby>, ["~> 1.5.4"])
|
58
|
+
s.add_runtime_dependency(%q<anticipate>, [">= 0"])
|
59
|
+
s.add_runtime_dependency(%q<cucumber>, ["~> 1.3"])
|
60
|
+
s.add_runtime_dependency(%q<fix_spec>, ["~> 0.1"])
|
61
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8"])
|
62
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.14"])
|
63
|
+
s.add_development_dependency(%q<rake>, ["~> 10.1"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<quickfix-jruby>, ["~> 1.5.4"])
|
66
|
+
s.add_dependency(%q<anticipate>, [">= 0"])
|
67
|
+
s.add_dependency(%q<cucumber>, ["~> 1.3"])
|
68
|
+
s.add_dependency(%q<fix_spec>, ["~> 0.1"])
|
69
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
70
|
+
s.add_dependency(%q<rspec>, ["~> 2.14"])
|
71
|
+
s.add_dependency(%q<rake>, ["~> 10.1"])
|
72
|
+
end
|
73
|
+
else
|
74
|
+
s.add_dependency(%q<quickfix-jruby>, ["~> 1.5.4"])
|
75
|
+
s.add_dependency(%q<anticipate>, [">= 0"])
|
76
|
+
s.add_dependency(%q<cucumber>, ["~> 1.3"])
|
77
|
+
s.add_dependency(%q<fix_spec>, ["~> 0.1"])
|
78
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
79
|
+
s.add_dependency(%q<rspec>, ["~> 2.14"])
|
80
|
+
s.add_dependency(%q<rake>, ["~> 10.1"])
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
PORT=5000
|
2
|
+
AgentFIX.session_defaults.merge! BeginString: "FIX.4.2", SocketAcceptPort: PORT, SocketConnectPort: PORT, SocketConnectHost: "localhost"
|
3
|
+
|
4
|
+
AgentFIX.define_initiator :my_initiator do |i|
|
5
|
+
i.default ={SenderCompID: "ARCA",ReconnectInterval: 1}
|
6
|
+
i.session ={TargetCompID: "TW"}
|
7
|
+
end
|
8
|
+
|
9
|
+
AgentFIX.define_acceptor :my_acceptor do |a|
|
10
|
+
a.default ={SenderCompID: "TW"}
|
11
|
+
a.session ={TargetCompID: "ARCA"}
|
12
|
+
end
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
@inspect_all
|
2
|
+
Feature: A simple test request example to demonstrate agent_fix scoping on all message types- including session level
|
3
|
+
|
4
|
+
Scenario Outline: Basic TestRequest
|
5
|
+
Outline demonstrates that both agents can send/receive session messages
|
6
|
+
|
7
|
+
Given the agents are running
|
8
|
+
Then I should receive a message on FIX of type "Logon" with agent "my_acceptor"
|
9
|
+
Then I should receive a message on FIX of type "Logon" with agent "my_initiator"
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
When "<sender>" sends a TestRequest with TestReqID "<req>"
|
14
|
+
And I sleep 5 seconds
|
15
|
+
Then "<receiver>" should receive a TestRequest with TestReqID "<req>"
|
16
|
+
And "<sender>" should receive a HeartBeat with TestReqID "<req>"
|
17
|
+
|
18
|
+
When I send the following FIX message from agent "<sender>":
|
19
|
+
"""
|
20
|
+
8=FIX.4.235=D11=hello21=155=IBM54=140=260=20090101-17:13:06.684
|
21
|
+
"""
|
22
|
+
Then I should receive a message on FIX of type "NewOrderSingle" with agent "<receiver>"
|
23
|
+
|
24
|
+
|
25
|
+
Examples:
|
26
|
+
|sender | receiver | req |
|
27
|
+
|my_initiator | my_acceptor | hello |
|
28
|
+
|my_acceptor | my_initiator | world |
|
@@ -0,0 +1,68 @@
|
|
1
|
+
Feature: A demonstration of scoping capabilities in agent_fix
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given my agents are logged on
|
5
|
+
|
6
|
+
Scenario:
|
7
|
+
When I send the following FIX message from agent "my_initiator":
|
8
|
+
"""
|
9
|
+
8=FIX.4.235=D11=hello21=155=IBM54=140=260=20090101-17:13:06.684
|
10
|
+
"""
|
11
|
+
|
12
|
+
Then I should receive a message on FIX of type "NewOrderSingle" with agent "my_acceptor"
|
13
|
+
When I send the following FIX messages from agent "my_acceptor":
|
14
|
+
"""
|
15
|
+
8=FIX.4.235=811=hello17=12337=abc39=A150=A151=020=06=014=021=155=IBM54=140=260=20090101-17:13:06.684
|
16
|
+
8=FIX.4.235=811=hello17=12337=abc39=0150=0151=020=06=014=021=155=IBM54=140=260=20090101-17:13:06.684
|
17
|
+
"""
|
18
|
+
|
19
|
+
Then I should receive 2 messages on FIX with agent "my_initiator"
|
20
|
+
And the 1st message should have the following:
|
21
|
+
| ClOrdID | "hello" |
|
22
|
+
| OrderID | "abc" |
|
23
|
+
| Symbol | "IBM" |
|
24
|
+
| OrdStatus | "PENDING_NEW" |
|
25
|
+
|
26
|
+
When I inspect the 2nd message
|
27
|
+
Then the FIX message should have the following:
|
28
|
+
| ClOrdID | "hello" |
|
29
|
+
| OrderID | "abc" |
|
30
|
+
| Symbol | "IBM" |
|
31
|
+
| OrdStatus | "NEW" |
|
32
|
+
|
33
|
+
When I send the following FIX messages from agent "my_acceptor":
|
34
|
+
"""
|
35
|
+
8=FIX.4.235=811=hello17=12337=abc39=4150=A151=020=06=014=021=155=IBM54=140=260=20090101-17:13:06.684
|
36
|
+
"""
|
37
|
+
|
38
|
+
Then I should receive a message over FIX with agent "my_initiator"
|
39
|
+
And the FIX message should have the following:
|
40
|
+
| ClOrdID | "hello" |
|
41
|
+
| OrderID | "abc" |
|
42
|
+
| Symbol | "IBM" |
|
43
|
+
| OrdStatus | "CANCELED" |
|
44
|
+
|
45
|
+
When I sleep 5 seconds
|
46
|
+
Then I should not receive any more messages with agent "my_initiator"
|
47
|
+
And I should not receive any more messages with agent "my_initiator"
|
48
|
+
|
49
|
+
Scenario: scope inclusion for app messages only (default)
|
50
|
+
When I send the following FIX message from agent "my_initiator":
|
51
|
+
"""
|
52
|
+
8=FIX.4.235=D11=hello21=155=IBM54=140=260=20090101-17:13:06.684
|
53
|
+
"""
|
54
|
+
|
55
|
+
Then I should receive a message on FIX of type "NewOrderSingle" with agent "my_acceptor"
|
56
|
+
When I send the following FIX messages from agent "my_acceptor":
|
57
|
+
"""
|
58
|
+
8=FIX.4.235=811=hello17=12337=abc39=A150=A151=020=06=014=021=155=IBM54=140=260=20090101-17:13:06.684
|
59
|
+
8=FIX.4.235=811=hello17=12337=abc39=0150=0151=020=06=014=021=155=IBM54=140=260=20090101-17:13:06.684
|
60
|
+
8=FIX.4.235=811=hello17=12337=abc39=4150=A151=020=06=014=021=155=IBM54=140=260=20090101-17:13:06.684
|
61
|
+
"""
|
62
|
+
|
63
|
+
Then I should receive 3 messages on FIX with agent "my_initiator"
|
64
|
+
And the FIX messages should include a message with the following:
|
65
|
+
| ClOrdID | "hello" |
|
66
|
+
| OrderID | "abc" |
|
67
|
+
| Symbol | "IBM" |
|
68
|
+
| OrdStatus | "NEW" |
|