ass_launcher 0.1.1.alpha → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +69 -67
- data/Rakefile +19 -0
- data/ass_launcher.gemspec +8 -2
- data/bin/dev-helper +7 -0
- data/bin/lib/dev_helper/cli_def_report.rb +191 -0
- data/bin/lib/dev_helper/cli_def_snippets.rb +426 -0
- data/bin/lib/dev_helper/designer.rb +172 -0
- data/bin/lib/dev_helper.rb +59 -0
- data/examples/arguments_builder_example.rb +150 -0
- data/examples/binary_wrappers_example.rb +211 -0
- data/examples/connection_string_example.rb +59 -0
- data/examples/create_infobase_example.rb +45 -0
- data/examples/enterprise_ole_example.rb +238 -0
- data/examples/enterprise_out_example.rb +87 -0
- data/examples/enterprise_running_example.rb +103 -0
- data/examples/example_helper.rb +122 -0
- data/examples/templates/example_template.cf +0 -0
- data/examples/templates/example_template.v8i +9 -0
- data/examples/templates/hello.epf +0 -0
- data/examples/troubles/with_creteinfobase_example.rb +408 -0
- data/examples/troubles/with_running_1c_example.rb +212 -0
- data/examples/v8i_file_example.rb +72 -0
- data/examples/webclient_example.rb +67 -0
- data/lib/ass_launcher/api.rb +113 -0
- data/lib/ass_launcher/enterprise/binary_wrapper.rb +159 -144
- data/lib/ass_launcher/enterprise/cli/arguments_builder.rb +177 -16
- data/lib/ass_launcher/enterprise/cli/binary_matcher.rb +69 -0
- data/lib/ass_launcher/enterprise/cli/parameters.rb +297 -44
- data/lib/ass_launcher/enterprise/cli/spec_dsl/dsl_helpers.rb +111 -5
- data/lib/ass_launcher/enterprise/cli/spec_dsl.rb +102 -51
- data/lib/ass_launcher/enterprise/cli.rb +50 -90
- data/lib/ass_launcher/enterprise/cli_def/8.2.17.rb +317 -0
- data/lib/ass_launcher/enterprise/cli_def/8.2.18.rb +3 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.3.rb +90 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.4.rb +58 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.5.rb +21 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.6.rb +91 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.7.rb +34 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.8.rb +127 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.9.rb +131 -0
- data/lib/ass_launcher/enterprise/cli_def.rb +46 -0
- data/lib/ass_launcher/enterprise/cli_defs_loader.rb +36 -0
- data/lib/ass_launcher/enterprise/ole/ole_binaries.rb +9 -2
- data/lib/ass_launcher/enterprise/ole/win32ole.rb +1 -1
- data/lib/ass_launcher/enterprise/ole.rb +17 -1
- data/lib/ass_launcher/enterprise/web_client.rb +164 -0
- data/lib/ass_launcher/enterprise.rb +33 -6
- data/lib/ass_launcher/support/connection_string.rb +33 -8
- data/lib/ass_launcher/support/linux.rb +88 -0
- data/lib/ass_launcher/support/platforms.rb +42 -10
- data/lib/ass_launcher/support/shell.rb +33 -6
- data/lib/ass_launcher/support/v8i_file.rb +3 -1
- data/lib/ass_launcher/support/v8i_section.rb +88 -40
- data/lib/ass_launcher/support.rb +1 -0
- data/lib/ass_launcher/version.rb +8 -1
- data/lib/ass_launcher.rb +1 -0
- metadata +79 -17
- data/lib/ass_launcher/enterprise/cli/cli.spec +0 -256
- data/lib/ass_launcher/enterprise/web_clients.rb +0 -59
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'example_helper'
|
2
|
+
|
3
|
+
module Examples
|
4
|
+
module ConnectionString
|
5
|
+
require 'ass_launcher'
|
6
|
+
|
7
|
+
describe 'Parse connection string from string: Api.cs method' do
|
8
|
+
it 'File infobase connection string' do
|
9
|
+
extend AssLauncher::Api
|
10
|
+
conns = cs 'File="path";Usr="user name";Pwd="pass"'
|
11
|
+
|
12
|
+
conns.must_be_instance_of AssLauncher::Support::ConnectionString::File
|
13
|
+
conns.is?(:file) .must_equal true
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'Server connection string' do
|
17
|
+
extend AssLauncher::Api
|
18
|
+
conns = cs 'srvr="host";ref="infibase";usr="user name";pwd="pass"'
|
19
|
+
|
20
|
+
conns.must_be_instance_of AssLauncher::Support::ConnectionString::Server
|
21
|
+
conns.is?(:server) .must_equal true
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'HTTP connection string' do
|
25
|
+
extend AssLauncher::Api
|
26
|
+
conns = cs 'ws="http://example.org/ib";usr="user name";pwd="pass"'
|
27
|
+
|
28
|
+
conns.must_be_instance_of AssLauncher::Support::ConnectionString::Http
|
29
|
+
conns.is?(:http) .must_equal true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'New connection string' do
|
34
|
+
it 'File connection string: Api.cs_file method' do
|
35
|
+
extend AssLauncher::Api
|
36
|
+
conns = cs_file file: 'path', usr: 'user name', pwd: 'pass'
|
37
|
+
|
38
|
+
conns.must_be_instance_of AssLauncher::Support::ConnectionString::File
|
39
|
+
conns.is?(:file) .must_equal true
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'Server connection string Api.cs_srv method' do
|
43
|
+
extend AssLauncher::Api
|
44
|
+
conns = cs_srv srvr: 'host', ref: 'infibase', usr: 'user name', pwd: 'pass'
|
45
|
+
|
46
|
+
conns.must_be_instance_of AssLauncher::Support::ConnectionString::Server
|
47
|
+
conns.is?(:server) .must_equal true
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'HTTP connection string: Api.cs_http method' do
|
51
|
+
extend AssLauncher::Api
|
52
|
+
conns = cs_http ws: 'http://example.org/ib', usr: 'user name', pwd: 'pass'
|
53
|
+
|
54
|
+
conns.must_be_instance_of AssLauncher::Support::ConnectionString::Http
|
55
|
+
conns.is?(:http) .must_equal true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'example_helper'
|
2
|
+
|
3
|
+
module Examples
|
4
|
+
module CreateInfobase
|
5
|
+
require 'ass_launcher'
|
6
|
+
|
7
|
+
describe 'Create new 1C:Enterprise application aka "information base"' do
|
8
|
+
extend AssLauncher::Api
|
9
|
+
|
10
|
+
# Get 1C:Enterprise binary wrapper or fail
|
11
|
+
binary = thicks(PLATFORM_VER).last
|
12
|
+
fail "Enterprise v #{PLATFORM_VER} not installed" if binary.nil?
|
13
|
+
|
14
|
+
# Build connection string for new infobase.
|
15
|
+
# In this case uses file 1C:Enterprise application type but
|
16
|
+
# we can create infobase on 1C:Enterprise server. For it we should use
|
17
|
+
# Api.cs_srv method which returns server connection string
|
18
|
+
conns = cs_file(file: File.join(Dir.tmpdir,'examples.create_infobase.ib'))
|
19
|
+
# 1C:Enterprise application Template
|
20
|
+
template = Examples::TEMPLATES::CF
|
21
|
+
|
22
|
+
# Build command whith ArgumentsBuilder
|
23
|
+
command = binary.command(:createinfobase) do
|
24
|
+
connection_string conns
|
25
|
+
useTemplate template
|
26
|
+
_L 'en'
|
27
|
+
end
|
28
|
+
|
29
|
+
# Running and waiting until process executing
|
30
|
+
# because it executing in forked process
|
31
|
+
process_holder = command.run.wait
|
32
|
+
|
33
|
+
it 'New infobase created whithout errors' do
|
34
|
+
# verify execution result
|
35
|
+
process_holder.result.verify!
|
36
|
+
# 1C:Enterprise application directory really exists
|
37
|
+
File.directory?(conns.file).must_equal true
|
38
|
+
end
|
39
|
+
|
40
|
+
after do
|
41
|
+
FileUtils.rm_rf conns.file if File.exists?(conns.file)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,238 @@
|
|
1
|
+
require 'example_helper'
|
2
|
+
|
3
|
+
module Examples
|
4
|
+
module EnterpriseOle
|
5
|
+
fail 'OLE in UNIX??? :)' if PLATFORM::LINUX
|
6
|
+
module HRESULT
|
7
|
+
RPC_SERVER_UNAVALIBLE = '0x800706ba'
|
8
|
+
end
|
9
|
+
|
10
|
+
# 1C:Enterprise provides three OLE servers:
|
11
|
+
# v8x.Application - thick client standalone OLE server
|
12
|
+
# v8xC.Application - thin client standalone OLE server
|
13
|
+
# v8x.ComConnector - inproc ole server for connect to:
|
14
|
+
# - 1C:Enterprise application aka infobases
|
15
|
+
# - 1C:Enterprise server agent
|
16
|
+
# - 1C:Enterprise server working process
|
17
|
+
|
18
|
+
describe 'AssLauncher provides wrappers for 1C:Enterprise Ole servers' do
|
19
|
+
extend AssLauncher::Api
|
20
|
+
|
21
|
+
# Wrappers returned AssLauncher::Api#ole method
|
22
|
+
|
23
|
+
thick_app = ole(:thick, PLATFORM_VER)
|
24
|
+
it 'Wrapper for "Thick application ole server" (aka v83.Application)' do
|
25
|
+
thick_app.must_be_instance_of AssLauncher::Enterprise::Ole::ThickApplication
|
26
|
+
end
|
27
|
+
|
28
|
+
thin_app = ole(:thin, PLATFORM_VER)
|
29
|
+
it 'Wrapper for "Thin application ole server" (aka v83c.Application)' do
|
30
|
+
thin_app.must_be_instance_of AssLauncher::Enterprise::Ole::ThinApplication
|
31
|
+
end
|
32
|
+
|
33
|
+
external = ole(:external, PLATFORM_VER)
|
34
|
+
it 'Wrapper for "External connection with infobase" (childe v83.ComConnector)' do
|
35
|
+
external.must_be_instance_of AssLauncher::Enterprise::Ole::IbConnection
|
36
|
+
end
|
37
|
+
|
38
|
+
wpconn = ole(:wprocess, PLATFORM_VER)
|
39
|
+
it 'Wrapper for "1C:Enterprise server working process connection" (childe v83.ComConnector)' do
|
40
|
+
wpconn.must_be_instance_of AssLauncher::Enterprise::Ole::WpConnection
|
41
|
+
end
|
42
|
+
|
43
|
+
saconn = ole(:sagent, PLATFORM_VER)
|
44
|
+
it 'Wrapper for "1C:Enterprise server agent connection" (childe v83.ComConnector)' do
|
45
|
+
saconn.must_be_instance_of AssLauncher::Enterprise::Ole::AgentConnection
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'Example for basic to use' do
|
50
|
+
extend AssLauncher::Api
|
51
|
+
|
52
|
+
# Get ole wrapper
|
53
|
+
external = ole(:external, PLATFORM_VER)
|
54
|
+
|
55
|
+
it 'Example' do
|
56
|
+
# Open connection with connection string
|
57
|
+
# For WpConnection and AgentConnection __connect__
|
58
|
+
# expects URI string
|
59
|
+
external.__open__ TMP::EMPTY_IB_CS
|
60
|
+
|
61
|
+
# Call 1C:Enterprise method #InfoBaseConnectionString
|
62
|
+
external.InfoBaseConnectionString.must_equal\
|
63
|
+
TMP::EMPTY_IB_CS.to_ole_string
|
64
|
+
|
65
|
+
# Close connection
|
66
|
+
external.__close__
|
67
|
+
end
|
68
|
+
|
69
|
+
after do
|
70
|
+
external.__close__
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'Closing connection' do
|
75
|
+
describe 'For standalone server it working perfect' do
|
76
|
+
extend AssLauncher::Api
|
77
|
+
thick_app = ole(:thick, PLATFORM_VER)
|
78
|
+
|
79
|
+
it 'Connection realy closed of thick_app' do
|
80
|
+
thick_app.__open__ TMP::EMPTY_IB_CS
|
81
|
+
|
82
|
+
ole_array = thick_app.newObject('Array')
|
83
|
+
ole_array.Count.must_equal 0
|
84
|
+
|
85
|
+
thick_app.__close__
|
86
|
+
|
87
|
+
# Fails because OLE server is down
|
88
|
+
e = proc {
|
89
|
+
ole_array.Count
|
90
|
+
}.must_raise NoMethodError
|
91
|
+
|
92
|
+
e.message.must_match %r{error code:#{HRESULT::RPC_SERVER_UNAVALIBLE}}
|
93
|
+
end
|
94
|
+
|
95
|
+
after do
|
96
|
+
thick_app.__close__
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe 'For inproc server close connection working with restrictions' do
|
101
|
+
# 1C inproc OLE servers haven't method for closing connection!
|
102
|
+
# Connection keep alive while live ruby process.
|
103
|
+
#
|
104
|
+
# If in one ruby script we want to use inproc connection for some work
|
105
|
+
# do in the infobase and after them we want run other connection
|
106
|
+
# or application or designer with flag of exclusive mode, in this case
|
107
|
+
# opened inproc connection doesn't give us to do it
|
108
|
+
#
|
109
|
+
# AssLauncher provide feature for closing inproc connection but
|
110
|
+
# it working with restrictions.
|
111
|
+
#
|
112
|
+
# AssLauncher patching WIN32OLE and collect all ole objects which
|
113
|
+
# generated and try kill refs calling #ole_free method for them when
|
114
|
+
# #__close__ method call.
|
115
|
+
#
|
116
|
+
# But it works not always. Connection keep alive while have any alive
|
117
|
+
# WIN32OLE refs generated this connection
|
118
|
+
|
119
|
+
describe 'Case when inproc server connection realy closed' do
|
120
|
+
extend AssLauncher::Api
|
121
|
+
|
122
|
+
# Get standalone ole server wrapper
|
123
|
+
# It is service connector
|
124
|
+
thick_app = ole(:thick, PLATFORM_VER)
|
125
|
+
|
126
|
+
# Get inproc ole server wrapper
|
127
|
+
# It object under test
|
128
|
+
external = ole(:external, PLATFORM_VER)
|
129
|
+
|
130
|
+
it 'External connection realy closed' do
|
131
|
+
thick_app.__open__ TMP::EMPTY_IB_CS
|
132
|
+
external.__open__ TMP::EMPTY_IB_CS
|
133
|
+
|
134
|
+
# We have two working sessions
|
135
|
+
thick_app.GetInfoBaseSessions.Count.must_equal 2
|
136
|
+
|
137
|
+
ole_array = external.newObject('Array')
|
138
|
+
ole_array.Count.must_equal 0
|
139
|
+
|
140
|
+
external.__close__
|
141
|
+
|
142
|
+
# External connection was closed
|
143
|
+
# and only one working session is alive
|
144
|
+
thick_app.GetInfoBaseSessions.Count.must_equal 1
|
145
|
+
|
146
|
+
# Fails 'failed to get Dispatch Interface'
|
147
|
+
# because #ole_free was called while external.__close__
|
148
|
+
e = proc {
|
149
|
+
ole_array.Count
|
150
|
+
}.must_raise RuntimeError
|
151
|
+
e.message.must_match %r{failed to get Dispatch Interface}i
|
152
|
+
end
|
153
|
+
|
154
|
+
after do
|
155
|
+
thick_app.__close__
|
156
|
+
external.__close__
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe 'We can chose version of 1C:Enterprise ole server' do
|
163
|
+
# We can choosing 1C ole server's version.
|
164
|
+
# AssLauncher automatically register needed server version
|
165
|
+
# and returns suitable wrapper.
|
166
|
+
#
|
167
|
+
# Registration version of ole server working correct only for standalone
|
168
|
+
# servers such as Thin and Thick applications.
|
169
|
+
#
|
170
|
+
# We don't get new version of inproc ole server until old version
|
171
|
+
# is loaded in memory
|
172
|
+
|
173
|
+
it "Fail if 1C:Enterprise version doesn't instaled" do
|
174
|
+
extend AssLauncher::Api
|
175
|
+
external = ole(:external, '~> 999')
|
176
|
+
e = proc {
|
177
|
+
external.__open__ ''
|
178
|
+
}.must_raise RuntimeError
|
179
|
+
e.message.must_match %r{Platform version `~> 999' not instaled}
|
180
|
+
end
|
181
|
+
|
182
|
+
describe 'Choosing version of standalone ole server working perfect' do
|
183
|
+
extend AssLauncher::Api
|
184
|
+
|
185
|
+
thick_app = ole(:thick, PLATFORM_VER)
|
186
|
+
|
187
|
+
it 'Ole server have suitable version' do
|
188
|
+
thick_app.__open__ TMP::EMPTY_IB_CS
|
189
|
+
system_info = thick_app.newObject('SystemInfo')
|
190
|
+
|
191
|
+
real_ole_app_version = Gem::Version.new(system_info.AppVersion)
|
192
|
+
|
193
|
+
real_ole_app_version.must_equal\
|
194
|
+
thick_app.instance_variable_get(:@__ole_binary__).version
|
195
|
+
|
196
|
+
thick_app.__close__
|
197
|
+
end
|
198
|
+
|
199
|
+
after do
|
200
|
+
thick_app.__close__
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
describe 'AssLauncher patching WIN32OLE for some reason' do
|
206
|
+
describe 'Getting real Ruby objects from WIN32OLE wrapper' do
|
207
|
+
|
208
|
+
# Ruby WIN32OLE automatically convert Ruby objects into IDispatch
|
209
|
+
# when they passed as parameter in to OLE server's side.
|
210
|
+
# When such objects returns on the Ruby's side they will keep as WIN32OLE
|
211
|
+
# AssLauncher provides feature for getting real Ruby object
|
212
|
+
|
213
|
+
it 'Example' do
|
214
|
+
ole_server = WIN32OLE.new('Scripting.Dictionary')
|
215
|
+
|
216
|
+
ruby_obj = Object.new
|
217
|
+
|
218
|
+
skip 'It Segmentation fault in:'\
|
219
|
+
' ruby 2.0.0p645 (2015-04-13 revision 50299)'\
|
220
|
+
' [i386-cygwin]' if RUBY_VERSION == '2.0.0'
|
221
|
+
|
222
|
+
# Call OLE server
|
223
|
+
ole_server.add(1, ruby_obj)
|
224
|
+
wrapped_obj = ole_server.items[0]
|
225
|
+
|
226
|
+
# Ruby object wrapped into WIN32OLE
|
227
|
+
wrapped_obj.must_be_instance_of WIN32OLE
|
228
|
+
|
229
|
+
# Ask: Is it Ryuby object?
|
230
|
+
wrapped_obj.__ruby__?.must_equal true
|
231
|
+
|
232
|
+
# Get Ruby object
|
233
|
+
wrapped_obj.__real_obj__.must_equal ruby_obj
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'example_helper'
|
2
|
+
|
3
|
+
module Examples
|
4
|
+
module EneterpriseOut
|
5
|
+
# 1C:Enterprise not work with stdout and stderr
|
6
|
+
# For out 1C use /OUT"file" parameter and write message into. Message
|
7
|
+
# encoding 'cp1251' for windows and 'utf-8' for Linux
|
8
|
+
|
9
|
+
describe 'AssLauncher provides automaticaly capturing 1C:Enterprise out' do
|
10
|
+
enterprise = CLIENTS::THICK.command :enterprise do
|
11
|
+
connection_string TMP::EMPTY_IB_CS
|
12
|
+
_Execute TEMPLATES::HELLO_EPF
|
13
|
+
_C 'Hello World'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'Out Hello World' do
|
17
|
+
enterprise.run.wait
|
18
|
+
enterprise_output = enterprise.process_holder.result.assout
|
19
|
+
enterprise_output.strip.must_equal 'Hello World'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "AssLauncher checks duplication of /OUT parameter and fails if it's true" do
|
24
|
+
it 'Fails' do
|
25
|
+
e = proc {
|
26
|
+
enterprise = CLIENTS::THICK.command :enterprise, ['/OUT', 'path']
|
27
|
+
}.must_raise ArgumentError
|
28
|
+
e.message.must_match %r{set option capture_assout: false}i
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'Arguments builder checks for /OUT file exists' do
|
33
|
+
it 'Fails' do
|
34
|
+
e = proc {
|
35
|
+
enterprise = CLIENTS::THICK.command :enterprise do
|
36
|
+
connection_string TMP::EMPTY_IB_CS
|
37
|
+
_OUT './fake_out_file'
|
38
|
+
end
|
39
|
+
}.must_raise ArgumentError
|
40
|
+
e.message.must_match %r{fake_out_file not exists}i
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'We can define owner /OUT file but we must set :capture_assout => false' do
|
46
|
+
# method #command having option :capture_assout which
|
47
|
+
# control automatically capturing behavior.
|
48
|
+
# On default :capture_assout => true
|
49
|
+
|
50
|
+
out_file = File.join(Dir.tmpdir, 'enterprise_out_example.out')
|
51
|
+
FileUtils.touch out_file
|
52
|
+
|
53
|
+
enterprise = CLIENTS::THICK\
|
54
|
+
.command :enterprise, [], capture_assout: false do
|
55
|
+
connection_string TMP::EMPTY_IB_CS
|
56
|
+
_Execute TEMPLATES::HELLO_EPF
|
57
|
+
_OUT out_file
|
58
|
+
_C 'Hello World'
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'Out Hello World' do
|
62
|
+
enterprise.run.wait
|
63
|
+
enterprise_output = File.read(out_file)
|
64
|
+
enterprise_output.strip.must_equal 'Hello World'
|
65
|
+
end
|
66
|
+
|
67
|
+
def after
|
68
|
+
FileUtils.rm_f out_file if Fail.exists? out_file
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "1C:Enterprise thin client doesn't puts messages into /OUT :(" do
|
73
|
+
enterprise = CLIENTS::THIN.command do
|
74
|
+
connection_string TMP::EMPTY_IB_CS
|
75
|
+
_Execute TEMPLATES::HELLO_EPF
|
76
|
+
_C 'Hello World'
|
77
|
+
end
|
78
|
+
|
79
|
+
it "Out empty" do
|
80
|
+
enterprise.run.wait
|
81
|
+
|
82
|
+
enterprise_output = enterprise.process_holder.result.assout
|
83
|
+
enterprise_output.strip.must_equal ''
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'example_helper'
|
2
|
+
|
3
|
+
module Examples
|
4
|
+
module EnterpriseRun
|
5
|
+
describe 'Basic examples for running 1C:Enterprise' do
|
6
|
+
it 'Running thick client in :designer run mode' do
|
7
|
+
# 1) Get AssLauncher::Api helper
|
8
|
+
extend AssLauncher::Api
|
9
|
+
|
10
|
+
# 2) Get 1C:Enterprise binary wrappers which satisfied by version
|
11
|
+
# requirement and choose last version from them
|
12
|
+
thick_client = thicks('~> 8.3').last
|
13
|
+
|
14
|
+
# 3) Fail if required 1C:Enterprise installation not found
|
15
|
+
fail '1C:Enterprise ~> 8.3 not found' if thick_client.nil?
|
16
|
+
|
17
|
+
# 4) Build command for required run mode.
|
18
|
+
designer = thick_client.command(:designer) do
|
19
|
+
# This block writes on DSL and
|
20
|
+
# will be passed to arguments builder instance
|
21
|
+
connection_string "File=\"#{TMP::EMPTY_IB}\";"
|
22
|
+
checkModules do
|
23
|
+
_Server
|
24
|
+
end
|
25
|
+
_L 'en'
|
26
|
+
end
|
27
|
+
|
28
|
+
# 5) Running 1C:Enterprise and waiting
|
29
|
+
designer.run.wait
|
30
|
+
|
31
|
+
# 6) Verify result
|
32
|
+
designer.process_holder.result.verify!
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'Running thin client' do
|
36
|
+
# 1) Get AssLauncher::Api helper
|
37
|
+
extend AssLauncher::Api
|
38
|
+
|
39
|
+
# 2) Get 1C:Enterprise binary wrappers which satisfied by version
|
40
|
+
# requirement and choose last version from them
|
41
|
+
thin_client = thins('~> 8.3').last
|
42
|
+
|
43
|
+
# 3) Fail if required 1C:Enterprise installation not found
|
44
|
+
fail '1C:Enterprise ~> 8.3 not found' if thin_client.nil?
|
45
|
+
|
46
|
+
# 4) Build command
|
47
|
+
enterprise = thin_client.command do
|
48
|
+
# This block writes on DSL and
|
49
|
+
# will be passed to arguments builder instance
|
50
|
+
connection_string "File=\"#{TMP::EMPTY_IB}\";"
|
51
|
+
_L 'en'
|
52
|
+
_Debug
|
53
|
+
_DebuggerUrl 'tcp://localhost'
|
54
|
+
end
|
55
|
+
|
56
|
+
# 5) Run enterprise
|
57
|
+
enterprise.run
|
58
|
+
|
59
|
+
# 6) Kill enterprise
|
60
|
+
enterprise.process_holder.kill
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'Running web client' do
|
64
|
+
# 1) Get AssLauncher::Api helper
|
65
|
+
extend AssLauncher::Api
|
66
|
+
|
67
|
+
# 2) Get wrapper for specified 1C:Enterprise version
|
68
|
+
wc = web_client('http://host/path/infobase', '8.3.6')
|
69
|
+
|
70
|
+
# 3) Build URI
|
71
|
+
loc = wc.location do
|
72
|
+
# Buld arguments
|
73
|
+
_N 'user name'
|
74
|
+
_P 'pass'
|
75
|
+
_L 'en'
|
76
|
+
testClientID 'id'
|
77
|
+
debuggerURL 'http://debugger:5668'
|
78
|
+
end
|
79
|
+
|
80
|
+
# 4) Navigate to location
|
81
|
+
# `firefox #{loc}`
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'Running ole sever' do
|
85
|
+
# 1) Get AssLauncher::Api helper
|
86
|
+
extend AssLauncher::Api
|
87
|
+
|
88
|
+
# 2) Get wrapper for last version of 1C:Enterprise
|
89
|
+
# which satisfied by version requirement
|
90
|
+
external_connection = ole(:external, '~> 8.3.0')
|
91
|
+
|
92
|
+
# 3) Open connection
|
93
|
+
begin
|
94
|
+
external_connection.__open__ 'connection_string'
|
95
|
+
rescue
|
96
|
+
end
|
97
|
+
|
98
|
+
# 4) Close connection
|
99
|
+
external_connection.__close__
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|