dde 0.2.2 → 0.2.8
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.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/dde_main +7 -89
- data/dde.gemspec +13 -8
- data/doc/dde_formats.doc +0 -0
- data/exp/exp_client.rb +44 -0
- data/exp/exp_dde_monitor.rb +18 -0
- data/exp/exp_dde_server.rb +36 -0
- data/exp/exp_lib.rb +38 -0
- data/exp/exp_server.rb +44 -0
- data/lib/dde.rb +1 -0
- data/lib/dde/app.rb +12 -5
- data/lib/dde/monitor.rb +70 -3
- data/lib/dde/xl_server.rb +82 -1
- data/lib/dde/xl_table.rb +102 -104
- data/spec/dde/app_shared.rb +85 -0
- data/spec/dde/app_spec.rb +2 -78
- data/spec/dde/client_spec.rb +68 -40
- data/spec/dde/monitor_spec.rb +15 -2
- data/spec/dde/server_shared.rb +12 -11
- data/spec/dde/server_spec.rb +10 -1
- data/spec/dde/xl_server_spec.rb +11 -0
- data/spec/dde/xl_table_spec.rb +1 -1
- metadata +11 -6
- data/doc/~$Table_format.doc +0 -0
- data/doc/~$e_formats.doc +0 -0
data/spec/dde/client_spec.rb
CHANGED
@@ -1,13 +1,39 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
2
3
|
|
3
4
|
module DDETest
|
4
5
|
|
6
|
+
def start_callback_recorder
|
7
|
+
@client_calls = []
|
8
|
+
@server_calls = []
|
9
|
+
@client = DDE::Client.new {|*args| @client_calls << extract_values(*args); 1}
|
10
|
+
@server = DDE::Server.new do |*args|
|
11
|
+
@server_calls << extract_values(*args)
|
12
|
+
#puts "#{Time.now.strftime('%T.%6N')} #{extract_values(*args)}"
|
13
|
+
DDE_FACK
|
14
|
+
end
|
15
|
+
@server.start_service('service')
|
16
|
+
end
|
17
|
+
|
18
|
+
def stop_callback_recorder
|
19
|
+
@client.stop_conversation if @client.conversation_active?
|
20
|
+
#@client.stop_dde if @client.dde_active?
|
21
|
+
@server.stop_service if @server.service_active?
|
22
|
+
@server.stop_dde if @server.dde_active?
|
23
|
+
end
|
24
|
+
|
25
|
+
def extract_values(type, format, conv, hsz1, hsz2, data, data1, data2)
|
26
|
+
[Win::DDE::TYPES[type], format, conv,
|
27
|
+
dde_query_string(@client.id, hsz1),
|
28
|
+
dde_query_string(@client.id, hsz2),
|
29
|
+
data, data1, data2]
|
30
|
+
end
|
31
|
+
|
5
32
|
describe DDE::Client do
|
6
|
-
|
7
|
-
|
33
|
+
before(:each){ @client = DDE::Client.new }
|
34
|
+
after(:each){ @client.stop_dde if @client.dde_active?}
|
8
35
|
|
9
|
-
|
10
|
-
# after(:each ){ @client.stop_dde}
|
36
|
+
it_should_behave_like "DDE App"
|
11
37
|
|
12
38
|
it 'new without parameters creates Client but does not activate DDEML' do
|
13
39
|
@client.id.should == nil
|
@@ -19,14 +45,14 @@ module DDETest
|
|
19
45
|
end
|
20
46
|
|
21
47
|
it 'new with attached callback block creates Client and activates DDEML' do
|
22
|
-
client = DDE::Client.new {|*args|}
|
23
|
-
client.id.should be_an Integer
|
24
|
-
client.id.should_not == 0
|
25
|
-
client.dde_active?.should == true
|
26
|
-
client.conversation.should == nil
|
27
|
-
client.conversation_active?.should == false
|
28
|
-
client.service.should == nil
|
29
|
-
client.topic.should == nil
|
48
|
+
@client = DDE::Client.new {|*args|}
|
49
|
+
@client.id.should be_an Integer
|
50
|
+
@client.id.should_not == 0
|
51
|
+
@client.dde_active?.should == true
|
52
|
+
@client.conversation.should == nil
|
53
|
+
@client.conversation_active?.should == false
|
54
|
+
@client.service.should == nil
|
55
|
+
@client.topic.should == nil
|
30
56
|
end
|
31
57
|
|
32
58
|
describe '#start_conversation' do
|
@@ -43,14 +69,13 @@ module DDETest
|
|
43
69
|
should raise_error /DDE is not initialized/
|
44
70
|
@client.conversation_active?.should == false
|
45
71
|
end
|
46
|
-
end
|
72
|
+
end # context 'with inactive (uninitialized) DDE:'
|
47
73
|
|
48
74
|
context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
49
|
-
before(:each )
|
50
|
-
|
51
|
-
|
52
|
-
@
|
53
|
-
@server = DDE::Server.new {|*args| @server_calls << args; 1}.start_service('service')
|
75
|
+
before(:each ){start_callback_recorder}
|
76
|
+
after(:each )do
|
77
|
+
stop_callback_recorder
|
78
|
+
#p @server_calls, @client_calls # ?????????? No XTYP_DISCONNECT ? Why ?
|
54
79
|
end
|
55
80
|
|
56
81
|
it 'starts new conversation if DDE is already activated' do
|
@@ -78,23 +103,24 @@ module DDETest
|
|
78
103
|
it 'initiates XTYP_CONNECT transaction to service`s callback' do
|
79
104
|
@client.start_conversation 'service', 'topic'
|
80
105
|
|
81
|
-
@server_calls.first[0].should == XTYP_CONNECT
|
82
|
-
@server_calls.first[3].should == @client.topic
|
83
|
-
@server_calls.first[4].should == @client.service
|
106
|
+
@server_calls.first[0].should == 'XTYP_CONNECT'
|
107
|
+
@server_calls.first[3].should == @client.topic
|
108
|
+
@server_calls.first[4].should == @client.service
|
84
109
|
end
|
85
110
|
|
86
111
|
it 'if server confirms connect, XTYP_CONNECT_CONFIRM transaction to service`s callback follows' do
|
87
112
|
@client.start_conversation 'service', 'topic'
|
88
113
|
|
89
|
-
@server_calls
|
90
|
-
@server_calls[1][
|
91
|
-
@server_calls[1][
|
114
|
+
# p @server_calls, @client_calls # ?????????? No XTYP_DISCONNECT ? Why ?
|
115
|
+
@server_calls[1][0].should == 'XTYP_CONNECT_CONFIRM'
|
116
|
+
@server_calls[1][3].should == @client.topic
|
117
|
+
@server_calls[1][4].should == @client.service
|
92
118
|
end
|
93
119
|
|
94
120
|
it 'client`s callback receives no transactions' do
|
95
121
|
@client.start_conversation 'service', 'topic'
|
96
122
|
|
97
|
-
p @server_calls, @client.service.handle, @client.topic.handle, @client.conversation
|
123
|
+
#p @server_calls, @client.service.handle, @client.topic.handle, @client.conversation
|
98
124
|
@client_calls.should == []
|
99
125
|
end
|
100
126
|
|
@@ -109,10 +135,14 @@ module DDETest
|
|
109
135
|
lambda{@client.start_conversation('not_a_service', 'topic')}.
|
110
136
|
should raise_error /A client`s attempt to establish a conversation has failed/
|
111
137
|
@client.conversation_active?.should == false
|
138
|
+
|
139
|
+
#ensure
|
140
|
+
dde_free_string_handle(@client.id, @client.topic.handle)
|
141
|
+
dde_free_string_handle(@client.id, @client.service.handle)
|
112
142
|
end
|
113
143
|
|
114
|
-
end
|
115
|
-
end
|
144
|
+
end # context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
145
|
+
end # describe '#start_conversation'
|
116
146
|
|
117
147
|
describe '#stop_conversation' do
|
118
148
|
|
@@ -123,15 +153,12 @@ module DDETest
|
|
123
153
|
@client.conversation_active?.should == false
|
124
154
|
end
|
125
155
|
|
126
|
-
end
|
156
|
+
end # context 'with inactive (uninitialized) DDE:'
|
127
157
|
|
128
158
|
context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
129
|
-
before(:each )
|
130
|
-
|
131
|
-
|
132
|
-
@client = DDE::Client.new {|*args| @client_calls << args; 1}
|
133
|
-
@server = DDE::Server.new {|*args| @server_calls << args; 1}
|
134
|
-
@server.start_service('service')
|
159
|
+
before(:each ){start_callback_recorder}
|
160
|
+
after(:each )do
|
161
|
+
stop_callback_recorder
|
135
162
|
end
|
136
163
|
|
137
164
|
it 'fails to stop conversation' do
|
@@ -141,7 +168,8 @@ module DDETest
|
|
141
168
|
end
|
142
169
|
|
143
170
|
context 'conversation already started' do
|
144
|
-
before(:each
|
171
|
+
before(:each){ @client.start_conversation 'service', 'topic' }
|
172
|
+
after(:each){ @client.stop_conversation if @client.conversation_active?}
|
145
173
|
|
146
174
|
it 'stops conversation' do
|
147
175
|
res = @client.stop_conversation
|
@@ -165,12 +193,12 @@ module DDETest
|
|
165
193
|
pending
|
166
194
|
@client.stop_conversation
|
167
195
|
p @server_calls, @client_calls # ?????????? No XTYP_DISCONNECT ? Why ?
|
168
|
-
@server_calls.last[0].should == XTYP_DISCONNECT
|
196
|
+
@server_calls.last[0].should == 'XTYP_DISCONNECT'
|
169
197
|
end
|
170
198
|
|
171
|
-
end
|
199
|
+
end # context 'conversation already started'
|
172
200
|
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
201
|
+
end # context 'with active (initialized) DDE AND existing DDE server supporting "service" topic'
|
202
|
+
end # describe '#stop_conversation'
|
203
|
+
end # describe DDE::Client
|
176
204
|
end
|
data/spec/dde/monitor_spec.rb
CHANGED
@@ -1,16 +1,29 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
2
3
|
|
3
4
|
module DDETest
|
4
5
|
|
5
6
|
describe DDE::Monitor do
|
6
|
-
|
7
|
-
|
7
|
+
before(:each){ @monitor = DDE::Monitor.new }
|
8
|
+
after(:each){ @monitor.stop_dde }
|
9
|
+
|
10
|
+
it_should_behave_like "DDE App"
|
11
|
+
|
8
12
|
it 'starts without constructor parameters' do
|
9
13
|
@monitor = DDE::Monitor.new
|
10
14
|
|
11
15
|
@monitor.id.should be_an Integer
|
12
16
|
@monitor.id.should_not == 0
|
13
17
|
@monitor.dde_active?.should == true
|
18
|
+
|
19
|
+
@monitor.init_flags.should == APPCLASS_MONITOR | # this is monitor
|
20
|
+
MF_CALLBACKS | # monitor callback functions
|
21
|
+
MF_CONV | # monitor conversation data
|
22
|
+
MF_ERRORS | # monitor DDEML errors
|
23
|
+
MF_HSZ_INFO | # monitor data handle activity
|
24
|
+
MF_LINKS | # monitor advise loops
|
25
|
+
MF_POSTMSGS | # monitor posted DDE messages
|
26
|
+
MF_SENDMSGS # monitor sent DDE messages
|
14
27
|
end
|
15
28
|
|
16
29
|
# context 'with existing DDE clients and server supporting "service" topic' do
|
data/spec/dde/server_shared.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
2
|
+
|
1
3
|
module DDETest
|
2
4
|
shared_examples_for "DDE Server" do
|
5
|
+
|
6
|
+
it_should_behave_like "DDE App"
|
7
|
+
|
3
8
|
it 'new without parameters creates Server but does not activate DDEML or start service' do
|
4
9
|
@server.id.should == nil
|
5
10
|
@server.service.should == nil
|
@@ -8,12 +13,12 @@ module DDETest
|
|
8
13
|
end
|
9
14
|
|
10
15
|
it 'new with attached callback block creates Server and activates DDEML, but does not start service' do
|
11
|
-
server = described_class.new {|*args|}
|
12
|
-
server.id.should be_an Integer
|
13
|
-
server.id.should_not == 0
|
14
|
-
server.dde_active?.should == true
|
15
|
-
server.service.should == nil
|
16
|
-
server.service_active?.should == false
|
16
|
+
@server = described_class.new {|*args|}
|
17
|
+
@server.id.should be_an Integer
|
18
|
+
@server.id.should_not == 0
|
19
|
+
@server.dde_active?.should == true
|
20
|
+
@server.service.should == nil
|
21
|
+
@server.service_active?.should == false
|
17
22
|
end
|
18
23
|
|
19
24
|
describe '#start_service' do
|
@@ -35,11 +40,6 @@ module DDETest
|
|
35
40
|
res.should == @server
|
36
41
|
end
|
37
42
|
|
38
|
-
it 'fails to start new service without callback block' do
|
39
|
-
lambda{@server.start_service('myservice')}.should raise_error DDE::Errors::ServiceError
|
40
|
-
@server.service_active?.should == false
|
41
|
-
end
|
42
|
-
|
43
43
|
end
|
44
44
|
|
45
45
|
context 'with active (initialized) DDE:' do
|
@@ -77,6 +77,7 @@ module DDETest
|
|
77
77
|
|
78
78
|
context 'with already registered DDE service: "myservice"' do
|
79
79
|
before(:each){ @server.start_service('myservice')}
|
80
|
+
after(:each){ @server.stop_service if @server.service_active?}
|
80
81
|
|
81
82
|
it 'stops previously registered service' do
|
82
83
|
@server.stop_service.should be_true
|
data/spec/dde/server_spec.rb
CHANGED
@@ -5,6 +5,10 @@ module DDETest
|
|
5
5
|
|
6
6
|
describe DDE::Server do
|
7
7
|
before(:each ){ @server = DDE::Server.new }
|
8
|
+
after(:each) do
|
9
|
+
@server.stop_service if @server.service_active?
|
10
|
+
@server.stop_dde if @server.dde_active?
|
11
|
+
end
|
8
12
|
|
9
13
|
it_should_behave_like "DDE Server"
|
10
14
|
|
@@ -14,8 +18,13 @@ module DDETest
|
|
14
18
|
expect{@server.start_dde{|*args|}.start_service}.to raise_error ArgumentError, /0 for 1/
|
15
19
|
expect{@server.start_service {|*args|}}.to raise_error ArgumentError, /0 for 1/
|
16
20
|
end
|
17
|
-
end
|
18
21
|
|
22
|
+
it 'callback block should be given explicitly' do
|
23
|
+
lambda{@server.start_service('myservice')}.should raise_error DDE::Errors::ServiceError
|
24
|
+
@server.service_active?.should == false
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
19
28
|
|
20
29
|
end
|
21
30
|
end
|
data/spec/dde/xl_server_spec.rb
CHANGED
@@ -5,6 +5,10 @@ module DDETest
|
|
5
5
|
|
6
6
|
describe DDE::XlServer do
|
7
7
|
before(:each ){ @server = DDE::XlServer.new }
|
8
|
+
after(:each) do
|
9
|
+
@server.stop_service if @server.service_active?
|
10
|
+
@server.stop_dde if @server.dde_active?
|
11
|
+
end
|
8
12
|
|
9
13
|
it_should_behave_like "DDE Server"
|
10
14
|
|
@@ -31,7 +35,14 @@ module DDETest
|
|
31
35
|
@server.service.handle.should_not == 0
|
32
36
|
@server.service_active?.should == true
|
33
37
|
end
|
38
|
+
|
39
|
+
it 'starts new service with default callback block' do
|
40
|
+
@server.start_service('myservice1')
|
41
|
+
@server.service_active?.should == true
|
42
|
+
@server.service.name.should == 'myservice1'
|
43
|
+
end
|
34
44
|
end
|
45
|
+
|
35
46
|
context 'with active (initialized) DDE:' do
|
36
47
|
before(:each ){ @server = DDE::XlServer.new {|*args|}}
|
37
48
|
|
data/spec/dde/xl_table_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dde
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arvicco
|
@@ -9,18 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-17 00:00:00 +03:00
|
13
13
|
default_executable: dde_main
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: win
|
17
17
|
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.1.
|
23
|
+
version: 0.1.26
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
@@ -64,8 +64,11 @@ files:
|
|
64
64
|
- doc/dde_formats.doc
|
65
65
|
- doc/ddeml.d.txt
|
66
66
|
- doc/types.txt
|
67
|
-
-
|
68
|
-
-
|
67
|
+
- exp/exp_client.rb
|
68
|
+
- exp/exp_dde_monitor.rb
|
69
|
+
- exp/exp_dde_server.rb
|
70
|
+
- exp/exp_lib.rb
|
71
|
+
- exp/exp_server.rb
|
69
72
|
- features/dde.feature
|
70
73
|
- features/step_definitions/dde_steps.rb
|
71
74
|
- features/support/env.rb
|
@@ -77,6 +80,7 @@ files:
|
|
77
80
|
- lib/dde/server.rb
|
78
81
|
- lib/dde/xl_server.rb
|
79
82
|
- lib/dde/xl_table.rb
|
83
|
+
- spec/dde/app_shared.rb
|
80
84
|
- spec/dde/app_spec.rb
|
81
85
|
- spec/dde/client_spec.rb
|
82
86
|
- spec/dde/dde_string_spec.rb
|
@@ -116,6 +120,7 @@ signing_key:
|
|
116
120
|
specification_version: 3
|
117
121
|
summary: DDE server for Ruby
|
118
122
|
test_files:
|
123
|
+
- spec/dde/app_shared.rb
|
119
124
|
- spec/dde/app_spec.rb
|
120
125
|
- spec/dde/client_spec.rb
|
121
126
|
- spec/dde/dde_string_spec.rb
|
data/doc/~$Table_format.doc
DELETED
Binary file
|
data/doc/~$e_formats.doc
DELETED
Binary file
|