agent_fix 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ When(/^I sleep (\d+) seconds$/) do |for_time|
2
+ sleep for_time.to_i
3
+ end
4
+
5
+ Given(/^the agents are running$/) do
6
+ #nop
7
+ end
8
+
9
+
10
+
11
+ Given(/^my agents are logged on$/) do
12
+ sleeping(AgentFIX.cucumber_sleep_seconds).seconds.between_tries.failing_after(AgentFIX.cucumber_retries).tries do
13
+ AgentFIX.agents_hash[:my_acceptor].loggedOn?.should be_true
14
+ AgentFIX.agents_hash[:my_initiator].loggedOn?.should be_true
15
+ end
16
+ end
17
+
18
+ When(/^"(.*?)" sends a TestRequest with TestReqID "(.*)"$/) do |agent, value|
19
+ msg = quickfix.Message.new
20
+ msg.getHeader.setField(quickfix.field.MsgType.new('1'))
21
+ msg.setField(quickfix.field.TestReqID.new(value))
22
+
23
+ AgentFIX.agents_hash[agent.to_sym].sendToTarget(msg)
24
+ end
25
+
26
+ Then(/^"(.*?)" should receive a (TestRequest|HeartBeat) with TestReqID "(.*?)"$/) do |agent, messageType, value|
27
+ steps %Q{Then I should receive a FIX message of type "#{messageType}" with agent "#{agent}"}
28
+
29
+ reqID = quickfix.field.TestReqID.new
30
+ @message.getField(reqID)
31
+ reqID.getValue.should ==(value)
32
+ end