ass_launcher 0.1.1.alpha → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,122 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'ass_launcher'
|
3
|
+
|
4
|
+
module Examples
|
5
|
+
MIN_PLATFORM_VERSION = '8.3.8'
|
6
|
+
|
7
|
+
PLATFORM_VER = "~> #{MIN_PLATFORM_VERSION}"
|
8
|
+
OLE_V8 = '83'
|
9
|
+
|
10
|
+
# Examples executing control
|
11
|
+
# Be careful with them!!!!
|
12
|
+
module TROUBLES_EXECUTE_CONTROL
|
13
|
+
# Will be executed examples which show GUI dialogs.
|
14
|
+
# It is require human interaction!!!
|
15
|
+
SHOW_STUPID_GUI = !ENV['SHOW_STUPID_GUI'].nil?
|
16
|
+
# Will be executed examples which create infobases not where you need
|
17
|
+
SHOW_TROBLES_WITH_CREATEINFOBASE = !ENV['SHOW_TROBLES_WITH_CREATEINFOBASE'].nil?
|
18
|
+
end
|
19
|
+
|
20
|
+
module PLATFORM
|
21
|
+
extend AssLauncher::Support::Platforms
|
22
|
+
LINUX = linux?
|
23
|
+
CYGWIN = cygwin?
|
24
|
+
WINDOWS = windows?
|
25
|
+
end
|
26
|
+
|
27
|
+
module CLIENTS
|
28
|
+
extend AssLauncher::Api
|
29
|
+
THICK = thicks(Examples::PLATFORM_VER).last
|
30
|
+
fail "1C:Enterprise thick client v.#{Examples::PLATFORM_VER} not found" if\
|
31
|
+
THICK.nil?
|
32
|
+
THIN = thins(Examples::PLATFORM_VER).last
|
33
|
+
fail "1C:Enterprise thin client v.#{Examples::PLATFORM_VER} not found" if\
|
34
|
+
THIN.nil?
|
35
|
+
WEB = web_client('http://example.org', MIN_PLATFORM_VERSION)
|
36
|
+
end
|
37
|
+
|
38
|
+
module TEMPLATES
|
39
|
+
CF = File.expand_path('../templates/example_template.cf', __FILE__)
|
40
|
+
V8I = File.expand_path('../templates/example_template.v8i', __FILE__)
|
41
|
+
HELLO_EPF = File.expand_path('../templates/hello.epf', __FILE__)
|
42
|
+
end
|
43
|
+
|
44
|
+
module IbMaker
|
45
|
+
include AssLauncher::Api
|
46
|
+
|
47
|
+
def ibases
|
48
|
+
@ibases ||= {}
|
49
|
+
end
|
50
|
+
|
51
|
+
def rm(name)
|
52
|
+
fail 'Abstract method call'
|
53
|
+
end
|
54
|
+
|
55
|
+
def exists?(name)
|
56
|
+
File.exists? ib_file_path(name)
|
57
|
+
end
|
58
|
+
|
59
|
+
def ib_file_path(name)
|
60
|
+
File.join ib_dir(name), '1Cv8.1CD'
|
61
|
+
end
|
62
|
+
|
63
|
+
def ib_dir(name)
|
64
|
+
File.join ibases_root, name
|
65
|
+
end
|
66
|
+
|
67
|
+
def ibases_root
|
68
|
+
fail 'Abstract method call'
|
69
|
+
end
|
70
|
+
|
71
|
+
def make(name)
|
72
|
+
ibases[name] = make_ib(name)
|
73
|
+
end
|
74
|
+
|
75
|
+
def cl
|
76
|
+
CLIENTS::THICK
|
77
|
+
end
|
78
|
+
|
79
|
+
def make_ib(name)
|
80
|
+
conns = cs_file file: ib_dir(name)
|
81
|
+
build_ib(conns) unless exists? name
|
82
|
+
conns.path.to_s
|
83
|
+
end
|
84
|
+
private :make_ib
|
85
|
+
|
86
|
+
def build_ib(conns)
|
87
|
+
command = cl.command(:createinfobase) do
|
88
|
+
connection_string conns
|
89
|
+
end
|
90
|
+
command.run.wait.result.verify!
|
91
|
+
end
|
92
|
+
private :build_ib
|
93
|
+
|
94
|
+
def rm_all
|
95
|
+
ibases.keys.each do |name|
|
96
|
+
rm name
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
module TMP
|
102
|
+
extend AssLauncher::Api
|
103
|
+
module TmpIb
|
104
|
+
extend IbMaker
|
105
|
+
def self.rm(name)
|
106
|
+
FileUtils.rm_rf ibases[name] if File.exists? ibases[name]
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.ibases_root
|
110
|
+
Dir.tmpdir
|
111
|
+
end
|
112
|
+
|
113
|
+
at_exit do
|
114
|
+
TmpIb.rm_all
|
115
|
+
end
|
116
|
+
end
|
117
|
+
EMPTY_IB = TmpIb.make('AssLauncher_Examples_EMPTY_IB')
|
118
|
+
EMPTY_IB_CS = cs_file file: EMPTY_IB
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
require "minitest/autorun"
|
Binary file
|
Binary file
|
@@ -0,0 +1,408 @@
|
|
1
|
+
require 'example_helper'
|
2
|
+
|
3
|
+
module Examples
|
4
|
+
module TroublesWithCreateFileinfobase
|
5
|
+
describe "CREATEINFOBASE doesn't check self argument for valid connection string" do
|
6
|
+
extend AssLauncher::Api
|
7
|
+
# 1C:Enterprise thick client runned in CREATEINFOBASE mode
|
8
|
+
# not veryfies self argument for valid connection string and
|
9
|
+
# creates default infobase in user profile directory.
|
10
|
+
# It's buf or feature? I'm suppose it's bug.
|
11
|
+
conns = cs_file file: File.join(Dir.tmpdir, 'create_default_infobase.ib')
|
12
|
+
|
13
|
+
it 'Creates default infobase in user profile' do
|
14
|
+
command = CLIENTS::THICK.command :createinfobase do
|
15
|
+
connection_string conns
|
16
|
+
end
|
17
|
+
|
18
|
+
command.args.insert(1, '/L','en')
|
19
|
+
|
20
|
+
command.args[0].must_equal 'CREATEINFOBASE'
|
21
|
+
# Argument for CREATEINFOBASE is /L
|
22
|
+
command.args[1].must_equal '/L'
|
23
|
+
command.args[2].must_equal 'en'
|
24
|
+
# Nex is connection string
|
25
|
+
command.args[3].must_equal conns.createinfobase_args[0]
|
26
|
+
|
27
|
+
skip unless TROUBLES_EXECUTE_CONTROL::SHOW_TROBLES_WITH_CREATEINFOBASE
|
28
|
+
command.run.wait
|
29
|
+
|
30
|
+
# Infobase which we want not exists
|
31
|
+
File.exists?(conns.file).must_equal false
|
32
|
+
|
33
|
+
# But created infobase which we don't want
|
34
|
+
command.process_holder.result.success?.must_equal true
|
35
|
+
command.process_holder.result.assout =~\
|
36
|
+
/Creation of infobase \("File\s?=\s?"([^"]+)/i
|
37
|
+
created = Regexp.last_match[1]
|
38
|
+
created.must_match(/InfoBase\D?/i)
|
39
|
+
|
40
|
+
File.exists?(created).must_equal true
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'Creates infobase which we want' do
|
44
|
+
command = CLIENTS::THICK.command :createinfobase do
|
45
|
+
connection_string conns
|
46
|
+
_L 'en'
|
47
|
+
end
|
48
|
+
|
49
|
+
command.args[0].must_equal 'CREATEINFOBASE'
|
50
|
+
# Argument for CREATEINFOBASE is connection string
|
51
|
+
command.args[1].must_equal conns.createinfobase_args[0]
|
52
|
+
# Nex is other
|
53
|
+
command.args[2].must_equal '/L'
|
54
|
+
command.args[3].must_equal 'en'
|
55
|
+
|
56
|
+
command.run.wait
|
57
|
+
|
58
|
+
# Created infobase which we want
|
59
|
+
command.process_holder.result.success?.must_equal true
|
60
|
+
command.process_holder.result.assout =~\
|
61
|
+
/Creation of infobase \("File\s?=\s?'([^']+)/i
|
62
|
+
created = Regexp.last_match[1]
|
63
|
+
command.args[1].must_include created
|
64
|
+
File.exists?(conns.file).must_equal true
|
65
|
+
end
|
66
|
+
|
67
|
+
after do
|
68
|
+
FileUtils.rm_rf conns.file if File.exists? conns.file
|
69
|
+
end
|
70
|
+
|
71
|
+
describe 'Solution with AssLauncher' do
|
72
|
+
it 'ThckClient verifies of argument for CREATEINFOBASE mode' do
|
73
|
+
e = proc {
|
74
|
+
CLIENTS::THICK.command(:createinfobase, ['bad connection srtring'])
|
75
|
+
}.must_raise ArgumentError
|
76
|
+
e.message.must_match(
|
77
|
+
/:createinfobase expects file or server connection string/i
|
78
|
+
)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe 'CREATEINFOBASE fails if file connection string having double quote' do
|
84
|
+
infobasedir = File.join(Dir.tmpdir,
|
85
|
+
'example_connection_string_with_double_quote.ib')
|
86
|
+
infobasedir = AssLauncher::Support::Platforms\
|
87
|
+
.path(infobasedir).win_string
|
88
|
+
|
89
|
+
before do
|
90
|
+
FileUtils.rm_rf infobasedir if File.exists? infobasedir
|
91
|
+
end
|
92
|
+
|
93
|
+
it "Fails if connection string double quoted" do
|
94
|
+
conns = "File=\"#{infobasedir}\""
|
95
|
+
|
96
|
+
# Path like C:\tempdir\infobase
|
97
|
+
infobasedir.wont_match(/\//)
|
98
|
+
# Double quoted path
|
99
|
+
conns.must_match(/File="(.+)"/i)
|
100
|
+
|
101
|
+
command = CLIENTS::THICK.command :createinfobase,
|
102
|
+
[conns, '/L', 'en']
|
103
|
+
|
104
|
+
command.run.wait
|
105
|
+
|
106
|
+
command.process_holder.result.exitstatus.wont_equal 0
|
107
|
+
command.process_holder.result.assout.must_match(
|
108
|
+
/Invalid path to file '1Cv8\.cdn'/i)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'Solution with ConnectionString::File' do
|
112
|
+
# ConnectionString::File converts connection string
|
113
|
+
# for CREATEINFOBASE mode from double quoted:
|
114
|
+
# 'File="pat";' to single quoted: "File='path';" string
|
115
|
+
extend AssLauncher::Api
|
116
|
+
conns = cs("File=\"#{infobasedir}\"")
|
117
|
+
# Like File='path'
|
118
|
+
conns.createinfobase_args[0].must_match(/File\s?=\s?'[^']+/)
|
119
|
+
|
120
|
+
command = CLIENTS::THICK.command :createinfobase,
|
121
|
+
conns.createinfobase_args + ['/L', 'en']
|
122
|
+
|
123
|
+
command.run.wait
|
124
|
+
|
125
|
+
# Created infobase which we want
|
126
|
+
command.process_holder.result.success?.must_equal true
|
127
|
+
command.process_holder.result.assout =~\
|
128
|
+
/Creation of infobase \("File\s?=\s?'([^']+)/i
|
129
|
+
created = Regexp.last_match[1]
|
130
|
+
|
131
|
+
conns.file.must_equal created
|
132
|
+
File.exists?(conns.file).must_equal true
|
133
|
+
end
|
134
|
+
|
135
|
+
after do
|
136
|
+
FileUtils.rm_rf infobasedir if File.exists? infobasedir
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
describe "CREATEINFOBASE doesn't understand paths with right slashes" do
|
141
|
+
# This case doesn't actual in Linux
|
142
|
+
|
143
|
+
infobasedir = File.join(Dir.tmpdir,
|
144
|
+
'example_create_infobase_with_right_slashes.ib')
|
145
|
+
|
146
|
+
before do
|
147
|
+
FileUtils.rm_rf infobasedir if File.exists? infobasedir
|
148
|
+
end
|
149
|
+
|
150
|
+
describe 'Using single quote in connection string' do
|
151
|
+
conns = "File=\'#{infobasedir}\'"
|
152
|
+
|
153
|
+
it 'Fails CREATEINFOBASE' do
|
154
|
+
skip 'Not actual in Linux' if PLATFORM::LINUX
|
155
|
+
|
156
|
+
command = CLIENTS::THICK.command :createinfobase,
|
157
|
+
[conns, '/L', 'en']
|
158
|
+
|
159
|
+
command.run.wait
|
160
|
+
|
161
|
+
command.process_holder.result.success?.must_equal false
|
162
|
+
command.process_holder.result.assout.must_match(
|
163
|
+
/Invalid or missing parameters for connection to the Infobase/i)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe 'Using double quote in connection string' do
|
168
|
+
conns = "File=\"#{infobasedir}\""
|
169
|
+
|
170
|
+
it 'Infobase is created not where you need' do
|
171
|
+
skip 'Not actual in Linux' if PLATFORM::LINUX
|
172
|
+
# Path like C:/tempdir/infobase
|
173
|
+
infobasedir.wont_match(/\\/)
|
174
|
+
|
175
|
+
command = CLIENTS::THICK.command :createinfobase,
|
176
|
+
[conns, '/L', 'en']
|
177
|
+
|
178
|
+
# This command creates or finds existing infobase files like 1Cv8.1CD
|
179
|
+
# in a root of the file system.
|
180
|
+
# On the machine where i'm writing this test, infobase was
|
181
|
+
# created in root of drive C:!!!
|
182
|
+
skip unless TROUBLES_EXECUTE_CONTROL::SHOW_TROBLES_WITH_CREATEINFOBASE
|
183
|
+
command.run.wait
|
184
|
+
|
185
|
+
# Exit status and assout:
|
186
|
+
if command.process_holder.result.exitstatus == 0
|
187
|
+
# First run test: created new infobase in root filesystem
|
188
|
+
command.process_holder.result.assout.must_match(
|
189
|
+
/Creation of infobase \("File=\\;.+\) completed successfully/i)
|
190
|
+
else
|
191
|
+
# Next runs test: found infobase files in root the file system
|
192
|
+
command.process_holder.result.assout.must_match(
|
193
|
+
/The Infobase specified already exists/i)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Realy infobase not exists
|
197
|
+
File.exists?(infobasedir).must_equal false
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
after do
|
202
|
+
FileUtils.rm_rf infobasedir if File.exists? infobasedir
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe "CREATEINFOBASE doesn't understand relative paths beginning from `..'" do
|
207
|
+
require 'pathname'
|
208
|
+
infobasedir = File.join('..',
|
209
|
+
'trouble_not_undersnant_relative_path.ib',
|
210
|
+
)
|
211
|
+
infobasedir = infobasedir.gsub('/','\\')\
|
212
|
+
|
213
|
+
describe 'Using single quoted connection string' do
|
214
|
+
it 'Infobase is created not where you need' do
|
215
|
+
conns = "File='#{infobasedir}'"
|
216
|
+
Pathname.new(infobasedir).relative?.must_equal true
|
217
|
+
|
218
|
+
command = CLIENTS::THICK.command :createinfobase,
|
219
|
+
[conns, '/L', 'en']
|
220
|
+
|
221
|
+
skip unless TROUBLES_EXECUTE_CONTROL::SHOW_TROBLES_WITH_CREATEINFOBASE
|
222
|
+
|
223
|
+
# This command creates or finds existing infobase
|
224
|
+
# in a current directory not a parent!.
|
225
|
+
command.run.wait
|
226
|
+
|
227
|
+
# Exit status and assout:
|
228
|
+
if command.process_holder.result.exitstatus == 0
|
229
|
+
# First run test: created new infobase in the current directory
|
230
|
+
command.process_holder.result.assout.must_match(
|
231
|
+
/Creation of infobase \("File='\.\.\\trouble_.+\) \S+ successfully/i)
|
232
|
+
else
|
233
|
+
# Next runs test: found infobase files in the current directory
|
234
|
+
command.process_holder.result.assout.must_match(
|
235
|
+
/The Infobase specified already exists/i)
|
236
|
+
end
|
237
|
+
|
238
|
+
# Realy infobase not exists
|
239
|
+
File.exists?(infobasedir).must_equal false
|
240
|
+
# Infobase created in the current directory created
|
241
|
+
File.exists?(infobasedir.gsub('..','.')).must_equal true
|
242
|
+
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
describe 'Using double quoted connection string' do
|
247
|
+
it "Fails if connection string double quoted" do
|
248
|
+
conns = "File=\"#{infobasedir}\""
|
249
|
+
Pathname.new(infobasedir).relative?.must_equal true
|
250
|
+
|
251
|
+
command = CLIENTS::THICK.command :createinfobase,
|
252
|
+
[conns, '/L', 'en']
|
253
|
+
|
254
|
+
command.run.wait
|
255
|
+
|
256
|
+
command.process_holder.result.exitstatus.wont_equal 0
|
257
|
+
command.process_holder.result.assout.must_match(
|
258
|
+
/Invalid path to file '1Cv8\.cdn'/i)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
it 'Solution with ConnectionString::File' do
|
263
|
+
require 'pathname'
|
264
|
+
extend AssLauncher::Api
|
265
|
+
# ConnectionString::File converts relative path
|
266
|
+
# to absolute for CREATEINFOBASE argument
|
267
|
+
|
268
|
+
conns = cs_file file: infobasedir
|
269
|
+
Pathname.new(conns.file).relative?.must_equal true
|
270
|
+
|
271
|
+
newcs = cs(conns.createinfobase_args[0].tr('\'','"'))
|
272
|
+
|
273
|
+
Pathname.new(newcs.file).absolute?.must_equal true
|
274
|
+
end
|
275
|
+
|
276
|
+
after do
|
277
|
+
FileUtils.rm_rf infobasedir if File.exists? infobasedir
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
describe "CREATEINFOBASE doesn't understand paths having `-'" do
|
282
|
+
extend AssLauncher::Support::Platforms
|
283
|
+
root = FileUtils.mkdir_p(File.join(Dir.tmpdir,'trouble-create-infobase'))[0]
|
284
|
+
|
285
|
+
infobasedir = File.join(root, 'tmp.ib')
|
286
|
+
infobasedir = AssLauncher::Support::Platforms\
|
287
|
+
.path(infobasedir).win_string
|
288
|
+
|
289
|
+
describe 'Using single quoted connection' do
|
290
|
+
it 'Fails CREATEINFOBASE' do
|
291
|
+
extend AssLauncher::Api
|
292
|
+
|
293
|
+
File.exists?(root).must_equal true
|
294
|
+
conns = cs_file file: infobasedir
|
295
|
+
|
296
|
+
command = CLIENTS::THICK.command :createinfobase,
|
297
|
+
conns.createinfobase_args + ['/L', 'en']
|
298
|
+
|
299
|
+
command.run.wait
|
300
|
+
|
301
|
+
command.process_holder.result.success?.must_equal false
|
302
|
+
command.process_holder.result.assout.must_match(
|
303
|
+
/Invalid or missing parameters for connection to the Infobase/i)
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
describe 'Using double quoted connection string' do
|
308
|
+
it 'Infobase is created not where you need' do
|
309
|
+
File.exists?(root).must_equal true
|
310
|
+
conns = "File=\"#{infobasedir}\""
|
311
|
+
|
312
|
+
command = CLIENTS::THICK.command :createinfobase,
|
313
|
+
[conns, '/L', 'en']
|
314
|
+
|
315
|
+
# This command creates or finds existng infobase files like 1Cv8.1CD
|
316
|
+
# in a root of the file system.
|
317
|
+
# On the machine where i'm writing this test, infobase was
|
318
|
+
# created in root of drive C:!!!
|
319
|
+
skip unless TROUBLES_EXECUTE_CONTROL::SHOW_TROBLES_WITH_CREATEINFOBASE
|
320
|
+
command.run.wait
|
321
|
+
|
322
|
+
# Exit status and assout:
|
323
|
+
if command.process_holder.result.exitstatus == 0
|
324
|
+
# First run test: created new infobase in root filesystem
|
325
|
+
command.process_holder.result.assout.must_match(
|
326
|
+
/Creation of infobase \("File=\\;.+\) completed successfully/i)
|
327
|
+
else
|
328
|
+
# Next runs test: found infobase files in root of the file system
|
329
|
+
command.process_holder.result.assout.must_match(
|
330
|
+
/The Infobase specified already exists/i)
|
331
|
+
end
|
332
|
+
|
333
|
+
# Realy infobase not exists
|
334
|
+
File.exists?(infobasedir).must_equal false
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
before do
|
339
|
+
FileUtils.rm_rf infobasedir if File.exists? infobasedir
|
340
|
+
end
|
341
|
+
|
342
|
+
after do
|
343
|
+
FileUtils.rm_rf infobasedir if File.exists? infobasedir
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
describe "CREATEINFOBASE doesn't understand paths having spaces" do
|
348
|
+
extend AssLauncher::Support::Platforms
|
349
|
+
root = FileUtils.mkdir_p(File.join(Dir.tmpdir,'trouble create infobase'))[0]
|
350
|
+
|
351
|
+
infobasedir = File.join(root, 'tmp.ib')
|
352
|
+
infobasedir = AssLauncher::Support::Platforms\
|
353
|
+
.path(infobasedir).win_string
|
354
|
+
|
355
|
+
it 'Solution with ConnectionString::File' do
|
356
|
+
extend AssLauncher::Api
|
357
|
+
|
358
|
+
File.exists?(root).must_equal true
|
359
|
+
# ConnectionString::File converts connection string
|
360
|
+
# for CREATEINFOBASE mode from double quoted:
|
361
|
+
# 'File="pat";' to single quoted: "File='path';" string
|
362
|
+
conns = cs_file file: infobasedir
|
363
|
+
|
364
|
+
command = CLIENTS::THICK.command :createinfobase,
|
365
|
+
conns.createinfobase_args + ['/L', 'en']
|
366
|
+
|
367
|
+
command.run.wait
|
368
|
+
|
369
|
+
# Created infobase which we want
|
370
|
+
command.process_holder.result.success?.must_equal true
|
371
|
+
command.process_holder.result.assout =~\
|
372
|
+
/Creation of infobase \("File\s?=\s?'([^']+)/i
|
373
|
+
created = Regexp.last_match[1]
|
374
|
+
|
375
|
+
conns.file.must_equal created
|
376
|
+
File.exists?(conns.file).must_equal true
|
377
|
+
end
|
378
|
+
|
379
|
+
describe 'Using double quoted connection string' do
|
380
|
+
it 'Fails CREATEINFOBASE' do
|
381
|
+
File.exists?(root).must_equal true
|
382
|
+
conns = "File=\"#{infobasedir}\""
|
383
|
+
|
384
|
+
command = CLIENTS::THICK.command :createinfobase,
|
385
|
+
[conns, '/L', 'en']
|
386
|
+
|
387
|
+
# This command creates or finds existng infobase files like 1Cv8.1CD
|
388
|
+
# in a root of the file system.
|
389
|
+
# On the machine where i'm writing this test, infobase was
|
390
|
+
# created in root of drive C:!!!
|
391
|
+
command.run.wait
|
392
|
+
|
393
|
+
command.process_holder.result.success?.must_equal false
|
394
|
+
command.process_holder.result.assout.must_match(
|
395
|
+
/Invalid or missing parameters for connection to the Infobase/i)
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
before do
|
400
|
+
FileUtils.rm_rf infobasedir if File.exists? infobasedir
|
401
|
+
end
|
402
|
+
|
403
|
+
after do
|
404
|
+
FileUtils.rm_rf infobasedir if File.exists? infobasedir
|
405
|
+
end
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|