xmlconv 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/History.txt +6 -0
- data/LICENSE +339 -0
- data/README.txt +29 -0
- data/Rakefile +37 -0
- data/bin/admin +68 -0
- data/bin/xmlconvd +38 -0
- data/data/grammar/i2.grammar +73 -0
- data/lib/xmlconv/config.rb +61 -0
- data/lib/xmlconv/custom/lookandfeel.rb +50 -0
- data/lib/xmlconv/i2/address.rb +35 -0
- data/lib/xmlconv/i2/date.rb +41 -0
- data/lib/xmlconv/i2/document.rb +27 -0
- data/lib/xmlconv/i2/header.rb +32 -0
- data/lib/xmlconv/i2/order.rb +61 -0
- data/lib/xmlconv/i2/parser.rb +23 -0
- data/lib/xmlconv/i2/position.rb +45 -0
- data/lib/xmlconv/i2/record.rb +11 -0
- data/lib/xmlconv/model/address.rb +20 -0
- data/lib/xmlconv/model/agreement.rb +10 -0
- data/lib/xmlconv/model/bdd.rb +37 -0
- data/lib/xmlconv/model/bsr.rb +16 -0
- data/lib/xmlconv/model/delivery.rb +15 -0
- data/lib/xmlconv/model/delivery_item.rb +24 -0
- data/lib/xmlconv/model/document.rb +25 -0
- data/lib/xmlconv/model/freetext_container.rb +26 -0
- data/lib/xmlconv/model/id_container.rb +22 -0
- data/lib/xmlconv/model/invoice.rb +18 -0
- data/lib/xmlconv/model/invoice_item.rb +11 -0
- data/lib/xmlconv/model/item.rb +19 -0
- data/lib/xmlconv/model/item_container.rb +15 -0
- data/lib/xmlconv/model/name.rb +27 -0
- data/lib/xmlconv/model/part_info.rb +10 -0
- data/lib/xmlconv/model/part_info_container.rb +15 -0
- data/lib/xmlconv/model/party.rb +20 -0
- data/lib/xmlconv/model/party_container.rb +20 -0
- data/lib/xmlconv/model/price.rb +10 -0
- data/lib/xmlconv/model/price_container.rb +18 -0
- data/lib/xmlconv/model/transaction.rb +28 -0
- data/lib/xmlconv/state/global.rb +28 -0
- data/lib/xmlconv/state/global_predefine.rb +11 -0
- data/lib/xmlconv/state/login.rb +39 -0
- data/lib/xmlconv/state/transaction.rb +13 -0
- data/lib/xmlconv/state/transactions.rb +130 -0
- data/lib/xmlconv/util/application.rb +142 -0
- data/lib/xmlconv/util/autoload.rb +35 -0
- data/lib/xmlconv/util/destination.rb +249 -0
- data/lib/xmlconv/util/invoicer.rb +71 -0
- data/lib/xmlconv/util/known_user.rb +16 -0
- data/lib/xmlconv/util/mail.rb +31 -0
- data/lib/xmlconv/util/polling_manager.rb +198 -0
- data/lib/xmlconv/util/session.rb +23 -0
- data/lib/xmlconv/util/transaction.rb +133 -0
- data/lib/xmlconv/util/validator.rb +20 -0
- data/lib/xmlconv/view/foot.rb +27 -0
- data/lib/xmlconv/view/head.rb +13 -0
- data/lib/xmlconv/view/login.rb +36 -0
- data/lib/xmlconv/view/navigation.rb +30 -0
- data/lib/xmlconv/view/navigationlink.rb +21 -0
- data/lib/xmlconv/view/pager.rb +73 -0
- data/lib/xmlconv/view/preformatted.rb +54 -0
- data/lib/xmlconv/view/template.rb +17 -0
- data/lib/xmlconv/view/transaction.rb +42 -0
- data/lib/xmlconv/view/transactions.rb +90 -0
- data/lib/xmlconv.rb +3 -0
- data/test/config.rb +12 -0
- data/test/mock.rb +149 -0
- data/test/suite.rb +16 -0
- data/test/test_i2/address.rb +88 -0
- data/test/test_i2/date.rb +50 -0
- data/test/test_i2/document.rb +62 -0
- data/test/test_i2/header.rb +39 -0
- data/test/test_i2/order.rb +94 -0
- data/test/test_i2/parser.rb +312 -0
- data/test/test_i2/position.rb +65 -0
- data/test/test_model/address.rb +35 -0
- data/test/test_model/agreement.rb +22 -0
- data/test/test_model/bdd.rb +55 -0
- data/test/test_model/bsr.rb +38 -0
- data/test/test_model/delivery.rb +79 -0
- data/test/test_model/delivery_item.rb +52 -0
- data/test/test_model/freetext_container.rb +45 -0
- data/test/test_model/invoice.rb +65 -0
- data/test/test_model/invoice_item.rb +41 -0
- data/test/test_model/name.rb +57 -0
- data/test/test_model/part_info.rb +24 -0
- data/test/test_model/party.rb +96 -0
- data/test/test_model/price.rb +24 -0
- data/test/test_util/application.rb +168 -0
- data/test/test_util/destination.rb +415 -0
- data/test/test_util/invoicer.rb +42 -0
- data/test/test_util/polling_manager.rb +299 -0
- data/test/test_util/transaction.rb +130 -0
- metadata +178 -0
@@ -0,0 +1,299 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Util::TestPollingManager -- xmlconv2 -- 29.06.2004 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
$: << File.expand_path('..', File.dirname(__FILE__))
|
5
|
+
$: << File.expand_path('../../lib', File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require 'xmlconv/util/polling_manager'
|
9
|
+
require 'mock'
|
10
|
+
require 'flexmock'
|
11
|
+
require 'rexml/document'
|
12
|
+
require 'config'
|
13
|
+
|
14
|
+
module XmlConv
|
15
|
+
module Util
|
16
|
+
module Mail
|
17
|
+
SMTP_HANDLER = FlexMock.new('SMTP-Handler')
|
18
|
+
end
|
19
|
+
class TestPollingMission < Test::Unit::TestCase
|
20
|
+
def setup
|
21
|
+
@mission = PollingMission.new
|
22
|
+
@dir = File.expand_path('data/i2',
|
23
|
+
File.dirname(__FILE__))
|
24
|
+
FileUtils.mkdir_p(@dir)
|
25
|
+
@file1 = File.expand_path('file1.txt', @dir)
|
26
|
+
File.open(@file1, 'w') { |fh| fh << "File 1\n" }
|
27
|
+
end
|
28
|
+
def teardown
|
29
|
+
FileUtils.rm_rf(@dir)
|
30
|
+
end
|
31
|
+
def test_file_paths
|
32
|
+
@mission.directory = @dir
|
33
|
+
file2 = File.expand_path('file2.txt', @dir)
|
34
|
+
File.open(file2, 'w') { |fh| fh << "File 2\n" }
|
35
|
+
assert_equal([@file1, file2], @mission.file_paths.sort)
|
36
|
+
@mission.glob_pattern = "file2*"
|
37
|
+
assert_equal([file2], @mission.file_paths.sort)
|
38
|
+
end
|
39
|
+
def test_poll
|
40
|
+
backup_dir = File.expand_path('../data', File.dirname(__FILE__))
|
41
|
+
@mission.directory = @dir
|
42
|
+
@mission.glob_pattern = '*'
|
43
|
+
@mission.partner = 'Partner'
|
44
|
+
@mission.reader = 'Reader'
|
45
|
+
@mission.writer = 'Writer'
|
46
|
+
@mission.destination = 'http://foo.bar.baz:2345'
|
47
|
+
@mission.debug_recipients = nil
|
48
|
+
@mission.error_recipients = nil
|
49
|
+
@mission.backup_dir = backup_dir
|
50
|
+
@mission.poll { |transaction|
|
51
|
+
assert_instance_of(Util::Transaction, transaction)
|
52
|
+
assert_equal("File 1\n", transaction.input)
|
53
|
+
assert_equal('file:' << @file1, transaction.origin)
|
54
|
+
assert_equal('Reader', transaction.reader)
|
55
|
+
assert_equal('Writer', transaction.writer)
|
56
|
+
dest = transaction.destination
|
57
|
+
assert_instance_of(Util::DestinationHttp, dest)
|
58
|
+
assert_equal('http://foo.bar.baz:2345', dest.uri.to_s)
|
59
|
+
}
|
60
|
+
end
|
61
|
+
def test_poll_filtered__match
|
62
|
+
backup_dir = File.expand_path('../data', File.dirname(__FILE__))
|
63
|
+
@mission.directory = @dir
|
64
|
+
@mission.glob_pattern = '*'
|
65
|
+
@mission.partner = 'Partner'
|
66
|
+
@mission.reader = 'Reader'
|
67
|
+
@mission.writer = 'Writer'
|
68
|
+
@mission.destination = 'http://foo.bar.baz:2345'
|
69
|
+
@mission.debug_recipients = nil
|
70
|
+
@mission.error_recipients = nil
|
71
|
+
@mission.backup_dir = backup_dir
|
72
|
+
@mission.filter = "^File\\s*\\d+"
|
73
|
+
@mission.poll { |transaction|
|
74
|
+
flunk "Block should not be called in Filtered Transaction"
|
75
|
+
}
|
76
|
+
assert(true)
|
77
|
+
end
|
78
|
+
def test_poll_filtered__no_match
|
79
|
+
backup_dir = File.expand_path('../data', File.dirname(__FILE__))
|
80
|
+
@mission.directory = @dir
|
81
|
+
@mission.glob_pattern = '*'
|
82
|
+
@mission.partner = 'Partner'
|
83
|
+
@mission.reader = 'Reader'
|
84
|
+
@mission.writer = 'Writer'
|
85
|
+
@mission.destination = 'http://foo.bar.baz:2345'
|
86
|
+
@mission.debug_recipients = nil
|
87
|
+
@mission.error_recipients = nil
|
88
|
+
@mission.backup_dir = backup_dir
|
89
|
+
@mission.filter = "^File\\s*2"
|
90
|
+
@mission.poll { |transaction|
|
91
|
+
assert_instance_of(Util::Transaction, transaction)
|
92
|
+
assert_equal("File 1\n", transaction.input)
|
93
|
+
assert_equal('file:' << @file1, transaction.origin)
|
94
|
+
assert_equal('Reader', transaction.reader)
|
95
|
+
assert_equal('Writer', transaction.writer)
|
96
|
+
dest = transaction.destination
|
97
|
+
assert_instance_of(Util::DestinationHttp, dest)
|
98
|
+
assert_equal('http://foo.bar.baz:2345', dest.uri.to_s)
|
99
|
+
}
|
100
|
+
end
|
101
|
+
end
|
102
|
+
class TestPopMission < Test::Unit::TestCase
|
103
|
+
def setup
|
104
|
+
@popserver = TCPServer.new('127.0.0.1', 0)
|
105
|
+
addr = @popserver.addr
|
106
|
+
@mission = PopMission.new
|
107
|
+
@mission.host = 'localhost'
|
108
|
+
@mission.port = addr.at(1)
|
109
|
+
@mission.user = "testuser"
|
110
|
+
@mission.pass = "test"
|
111
|
+
@mission.content_type = "text/xml"
|
112
|
+
@datadir = File.expand_path('data', File.dirname(__FILE__))
|
113
|
+
@mission.backup_dir = File.join(@datadir, 'backup')
|
114
|
+
@mission.destination = File.join(@datadir, 'destination')
|
115
|
+
@mission.partner = 'Partner'
|
116
|
+
@mission.reader = 'Reader'
|
117
|
+
@mission.writer = 'Writer'
|
118
|
+
@mission.destination = 'http://foo.bar.baz:2345'
|
119
|
+
@mission.debug_recipients = nil
|
120
|
+
@mission.error_recipients = nil
|
121
|
+
end
|
122
|
+
def teardown
|
123
|
+
FileUtils.rm_r(@datadir)
|
124
|
+
end
|
125
|
+
def test_poll
|
126
|
+
message = RMail::Message.new
|
127
|
+
part1 = RMail::Message.new
|
128
|
+
part1.header.add("content-type", 'text/plain')
|
129
|
+
part1.body = "some senseless data"
|
130
|
+
message.add_part(part1)
|
131
|
+
|
132
|
+
part2 = RMail::Message.new
|
133
|
+
part2.header.add("content-type", 'text/xml', nil,
|
134
|
+
'encoding' => 'iso-8859-1')
|
135
|
+
doc = REXML::Document.new("<foo><bar /></foo>")
|
136
|
+
part2.body = doc.to_s
|
137
|
+
message.add_part(part2)
|
138
|
+
|
139
|
+
part3 = RMail::Message.new
|
140
|
+
part3.header.add("content-type", 'text/plain')
|
141
|
+
part3.body = "some more senseless data"
|
142
|
+
message.add_part(part3)
|
143
|
+
|
144
|
+
mail = message.to_s
|
145
|
+
|
146
|
+
@server = Thread.new {
|
147
|
+
Thread.start(@popserver.accept) do |socket|
|
148
|
+
socket.puts("+OK")
|
149
|
+
while line = socket.gets
|
150
|
+
case line[0,4]
|
151
|
+
when "USER"
|
152
|
+
assert_equal("USER testuser\r\n", line)
|
153
|
+
socket.print("+OK\r\n")
|
154
|
+
when "PASS"
|
155
|
+
assert_equal("PASS test\r\n", line)
|
156
|
+
socket.print("+OK\r\n")
|
157
|
+
when "STAT"
|
158
|
+
socket.print("+OK 1 1\r\n")
|
159
|
+
when "LIST"
|
160
|
+
socket.print("+OK\r\n")
|
161
|
+
socket.print("1 #{mail.size}\r\n")
|
162
|
+
socket.print(".\r\n")
|
163
|
+
when "RETR"
|
164
|
+
socket.print("+OK #{mail.size}\r\n")
|
165
|
+
socket.print(mail)
|
166
|
+
socket.print("\r\n.\r\n")
|
167
|
+
when "QUIT"
|
168
|
+
socket.print("+OK\r\n")
|
169
|
+
break
|
170
|
+
else
|
171
|
+
socket.print("+OK\r\n")
|
172
|
+
end
|
173
|
+
end
|
174
|
+
socket.close
|
175
|
+
end
|
176
|
+
}
|
177
|
+
counter = 0
|
178
|
+
@mission.poll { |transaction|
|
179
|
+
counter += 1
|
180
|
+
assert_instance_of(Util::Transaction, transaction)
|
181
|
+
assert_equal(doc.to_s, transaction.input)
|
182
|
+
assert_equal("pop3:testuser@localhost:#{@mission.port}",
|
183
|
+
transaction.origin)
|
184
|
+
assert_equal('Reader', transaction.reader)
|
185
|
+
assert_equal('Writer', transaction.writer)
|
186
|
+
dest = transaction.destination
|
187
|
+
assert_instance_of(Util::DestinationHttp, dest)
|
188
|
+
assert_equal('http://foo.bar.baz:2345', dest.uri.to_s)
|
189
|
+
}
|
190
|
+
assert_equal(1, counter,
|
191
|
+
"poll-block should have been called exactly once")
|
192
|
+
end
|
193
|
+
def teardown
|
194
|
+
@popserver.close
|
195
|
+
end
|
196
|
+
end
|
197
|
+
class TestPollingManager < Test::Unit::TestCase
|
198
|
+
include FlexMock::TestCase
|
199
|
+
def setup
|
200
|
+
@sys = Mock.new('System')
|
201
|
+
@polling = PollingManager.new(@sys)
|
202
|
+
@dir = File.expand_path('data/i2',
|
203
|
+
File.dirname(__FILE__))
|
204
|
+
FileUtils.mkdir_p(@dir)
|
205
|
+
@file1 = File.expand_path('file1.txt', @dir)
|
206
|
+
File.open(@file1, 'w') { |fh| fh << "File 1\n" }
|
207
|
+
end
|
208
|
+
def teardown
|
209
|
+
FileUtils.rm_rf(@dir)
|
210
|
+
@sys.__verify
|
211
|
+
super
|
212
|
+
end
|
213
|
+
def test_load_sources
|
214
|
+
File.open(CONFIG.polling_file, 'w') { |fh|
|
215
|
+
fh << <<-EOS
|
216
|
+
--- !ruby/object:XmlConv::Util::PollingMission
|
217
|
+
reader: I2Bdd
|
218
|
+
directory: "./test/test_util/data/i2"
|
219
|
+
writer: BddXml
|
220
|
+
destination: "http://example.com:12345"
|
221
|
+
--- !ruby/object:XmlConv::Util::PollingMission
|
222
|
+
directory: "./test/test_util/data/xml"
|
223
|
+
destination: "http://user:pass@foo.bar.baz"
|
224
|
+
writer: BddI2
|
225
|
+
reader: XmlBdd
|
226
|
+
EOS
|
227
|
+
}
|
228
|
+
block = nil
|
229
|
+
block3 = Proc.new { |source|
|
230
|
+
flunk "too many sources"
|
231
|
+
}
|
232
|
+
block2 = Proc.new { |source|
|
233
|
+
assert_instance_of(PollingMission, source)
|
234
|
+
assert_equal('XmlBdd', source.reader)
|
235
|
+
assert_equal('./test/test_util/data/xml', source.directory)
|
236
|
+
assert_equal('BddI2', source.writer)
|
237
|
+
assert_equal('http://user:pass@foo.bar.baz', source.destination)
|
238
|
+
block = block3
|
239
|
+
}
|
240
|
+
block1 = Proc.new { |source|
|
241
|
+
assert_instance_of(PollingMission, source)
|
242
|
+
assert_equal('I2Bdd', source.reader)
|
243
|
+
assert_equal('./test/test_util/data/i2', source.directory)
|
244
|
+
assert_equal('BddXml', source.writer)
|
245
|
+
assert_equal('http://example.com:12345', source.destination)
|
246
|
+
block = block2
|
247
|
+
}
|
248
|
+
block = block1
|
249
|
+
@polling.load_sources { |source|
|
250
|
+
block.call(source)
|
251
|
+
}
|
252
|
+
end
|
253
|
+
def test_poll__general_error
|
254
|
+
mission1 = flexmock(YAML.load <<-EOS)
|
255
|
+
--- !ruby/object:XmlConv::Util::PollingMission
|
256
|
+
reader: I2Bdd
|
257
|
+
directory: "./test/test_util/data/i2"
|
258
|
+
writer: BddXml
|
259
|
+
destination: "http://example.com:12345"
|
260
|
+
error_recipients:
|
261
|
+
- test@ywesee.com
|
262
|
+
EOS
|
263
|
+
mission2 = flexmock(YAML.load <<-EOS)
|
264
|
+
--- !ruby/object:XmlConv::Util::PollingMission
|
265
|
+
directory: "./test/test_util/data/xml"
|
266
|
+
destination: "http://user:pass@foo.bar.baz"
|
267
|
+
writer: BddI2
|
268
|
+
reader: XmlBdd
|
269
|
+
error_recipients:
|
270
|
+
- test@ywesee.com
|
271
|
+
EOS
|
272
|
+
|
273
|
+
flexmock(YAML).should_receive(:load_documents).and_return do |mission, block|
|
274
|
+
block.call(mission1)
|
275
|
+
block.call(mission2)
|
276
|
+
end
|
277
|
+
executed_mission2 = false
|
278
|
+
mission1.should_receive(:poll).times(1).and_return do
|
279
|
+
raise "Something went wrong (simulated Error)"
|
280
|
+
end
|
281
|
+
mission2.should_receive(:poll).times(1).and_return do
|
282
|
+
executed_mission2 = true
|
283
|
+
assert true # passed the test: the second mission was executed
|
284
|
+
end
|
285
|
+
flexmock(Util::Mail).should_receive(:notify).times(1)\
|
286
|
+
.and_return do |recipients, subject, body|
|
287
|
+
assert_equal [ 'test@ywesee.com' ], recipients
|
288
|
+
assert_equal 'XmlConv2 - Polling-Error', subject
|
289
|
+
assert_equal <<-EOS, body[0,52]
|
290
|
+
RuntimeError
|
291
|
+
Something went wrong (simulated Error)
|
292
|
+
EOS
|
293
|
+
end
|
294
|
+
@polling.poll_sources
|
295
|
+
assert executed_mission2, "Polling choked on Error"
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Util::TestTransaction -- xmlconv2 -- 04.06.2004 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
$: << File.dirname(__FILE__)
|
5
|
+
$: << File.expand_path('..', File.dirname(__FILE__))
|
6
|
+
$: << File.expand_path('../../lib', File.dirname(__FILE__))
|
7
|
+
|
8
|
+
require 'test/unit'
|
9
|
+
require 'xmlconv/util/transaction'
|
10
|
+
require 'mock'
|
11
|
+
|
12
|
+
module XmlConv
|
13
|
+
module Conversion
|
14
|
+
def const_get(symbol)
|
15
|
+
if(symbol.is_a?(Mock))
|
16
|
+
symbol
|
17
|
+
else
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
module_function :const_get
|
22
|
+
end
|
23
|
+
module Util
|
24
|
+
module Mail
|
25
|
+
SMTP_HANDLER = Mock.new('SMTP-Handler')
|
26
|
+
end
|
27
|
+
class TestTransaction < Test::Unit::TestCase
|
28
|
+
def setup
|
29
|
+
@transaction = Util::Transaction.new
|
30
|
+
end
|
31
|
+
def test_attr_accessors
|
32
|
+
assert_respond_to(@transaction, :input)
|
33
|
+
assert_respond_to(@transaction, :input=)
|
34
|
+
assert_respond_to(@transaction, :reader)
|
35
|
+
assert_respond_to(@transaction, :reader=)
|
36
|
+
assert_respond_to(@transaction, :writer)
|
37
|
+
assert_respond_to(@transaction, :writer=)
|
38
|
+
assert_respond_to(@transaction, :transaction_id)
|
39
|
+
assert_respond_to(@transaction, :transaction_id=)
|
40
|
+
assert_respond_to(@transaction, :error)
|
41
|
+
assert_respond_to(@transaction, :error=)
|
42
|
+
end
|
43
|
+
def test_attr_readers
|
44
|
+
assert_respond_to(@transaction, :output)
|
45
|
+
assert_respond_to(@transaction, :model)
|
46
|
+
assert_respond_to(@transaction, :start_time)
|
47
|
+
assert_respond_to(@transaction, :commit_time)
|
48
|
+
end
|
49
|
+
def test_execute
|
50
|
+
src = Mock.new('source')
|
51
|
+
input = Mock.new('input')
|
52
|
+
reader = Mock.new('reader')
|
53
|
+
model = Mock.new('model')
|
54
|
+
writer = Mock.new('writer')
|
55
|
+
output = Mock.new('output')
|
56
|
+
destination = Mock.new('destination')
|
57
|
+
@transaction.input = src
|
58
|
+
@transaction.reader = reader
|
59
|
+
@transaction.writer = writer
|
60
|
+
@transaction.destination = destination
|
61
|
+
reader.__next(:parse) { |read_src|
|
62
|
+
assert_equal(src, read_src)
|
63
|
+
input
|
64
|
+
}
|
65
|
+
reader.__next(:convert) { |read_input|
|
66
|
+
assert_equal(input, read_input)
|
67
|
+
model
|
68
|
+
}
|
69
|
+
writer.__next(:convert) { |write_input|
|
70
|
+
assert_equal(model, write_input)
|
71
|
+
output
|
72
|
+
}
|
73
|
+
destination.__next(:deliver) { |delivery|
|
74
|
+
assert_equal(output, delivery)
|
75
|
+
}
|
76
|
+
destination.__next(:forget_credentials!) { }
|
77
|
+
time1 = Time.now
|
78
|
+
result = @transaction.execute
|
79
|
+
time2 = Time.now
|
80
|
+
assert_equal(src, @transaction.input)
|
81
|
+
assert_equal(reader, @transaction.reader)
|
82
|
+
assert_equal(model, @transaction.model)
|
83
|
+
assert_equal(writer, @transaction.writer)
|
84
|
+
assert_equal(output.to_s, @transaction.output)
|
85
|
+
assert_equal(output.to_s, result)
|
86
|
+
assert_in_delta(time1, @transaction.start_time, 0.001)
|
87
|
+
assert_in_delta(time2, @transaction.commit_time, 0.001)
|
88
|
+
input.__verify
|
89
|
+
reader.__verify
|
90
|
+
model.__verify
|
91
|
+
writer.__verify
|
92
|
+
output.__verify
|
93
|
+
destination.__verify
|
94
|
+
end
|
95
|
+
def test_persistable
|
96
|
+
assert_kind_of(ODBA::Persistable, @transaction)
|
97
|
+
end
|
98
|
+
def test_dumpable
|
99
|
+
assert_nothing_raised { Marshal.dump(@transaction) }
|
100
|
+
end
|
101
|
+
def test_notify
|
102
|
+
@transaction.instance_variable_set('@start_time', Time.now)
|
103
|
+
@transaction.error_recipients = ['bar']
|
104
|
+
smtp = Mail::SMTP_HANDLER
|
105
|
+
@transaction.notify
|
106
|
+
@transaction.debug_recipients = ['foo']
|
107
|
+
mail = Mock.new('MailSession')
|
108
|
+
mail.__next(:sendmail) { |encoded, from, recipients|
|
109
|
+
assert_equal(['foo'], recipients)
|
110
|
+
|
111
|
+
}
|
112
|
+
smtp.__next(:start) { |block, server|
|
113
|
+
block.call(mail)
|
114
|
+
}
|
115
|
+
@transaction.notify
|
116
|
+
@transaction.error = 'error!'
|
117
|
+
mail.__next(:sendmail) { |encoded, from, recipients|
|
118
|
+
assert_equal(['foo', 'bar'], recipients)
|
119
|
+
|
120
|
+
}
|
121
|
+
smtp.__next(:start) { |block, server|
|
122
|
+
block.call(mail)
|
123
|
+
}
|
124
|
+
@transaction.notify
|
125
|
+
smtp.__verify
|
126
|
+
mail.__verify
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
metadata
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xmlconv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Masaomi Hatakeyama, Zeno R.R. Davatz
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-23 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: hoe
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 41
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 9
|
33
|
+
- 1
|
34
|
+
version: 2.9.1
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
description: xmlconverter, convert XML to flat files.
|
38
|
+
email:
|
39
|
+
- mhatakeyama@ywesee.com, zdavatz@ywesee.com
|
40
|
+
executables:
|
41
|
+
- admin
|
42
|
+
- xmlconvd
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files:
|
46
|
+
- History.txt
|
47
|
+
- README.txt
|
48
|
+
files:
|
49
|
+
- History.txt
|
50
|
+
- LICENSE
|
51
|
+
- README.txt
|
52
|
+
- Rakefile
|
53
|
+
- bin/admin
|
54
|
+
- bin/xmlconvd
|
55
|
+
- data/grammar/i2.grammar
|
56
|
+
- lib/xmlconv.rb
|
57
|
+
- lib/xmlconv/config.rb
|
58
|
+
- lib/xmlconv/custom/lookandfeel.rb
|
59
|
+
- lib/xmlconv/i2/address.rb
|
60
|
+
- lib/xmlconv/i2/date.rb
|
61
|
+
- lib/xmlconv/i2/document.rb
|
62
|
+
- lib/xmlconv/i2/header.rb
|
63
|
+
- lib/xmlconv/i2/order.rb
|
64
|
+
- lib/xmlconv/i2/parser.rb
|
65
|
+
- lib/xmlconv/i2/position.rb
|
66
|
+
- lib/xmlconv/i2/record.rb
|
67
|
+
- lib/xmlconv/model/address.rb
|
68
|
+
- lib/xmlconv/model/agreement.rb
|
69
|
+
- lib/xmlconv/model/bdd.rb
|
70
|
+
- lib/xmlconv/model/bsr.rb
|
71
|
+
- lib/xmlconv/model/delivery.rb
|
72
|
+
- lib/xmlconv/model/delivery_item.rb
|
73
|
+
- lib/xmlconv/model/document.rb
|
74
|
+
- lib/xmlconv/model/freetext_container.rb
|
75
|
+
- lib/xmlconv/model/id_container.rb
|
76
|
+
- lib/xmlconv/model/invoice.rb
|
77
|
+
- lib/xmlconv/model/invoice_item.rb
|
78
|
+
- lib/xmlconv/model/item.rb
|
79
|
+
- lib/xmlconv/model/item_container.rb
|
80
|
+
- lib/xmlconv/model/name.rb
|
81
|
+
- lib/xmlconv/model/part_info.rb
|
82
|
+
- lib/xmlconv/model/part_info_container.rb
|
83
|
+
- lib/xmlconv/model/party.rb
|
84
|
+
- lib/xmlconv/model/party_container.rb
|
85
|
+
- lib/xmlconv/model/price.rb
|
86
|
+
- lib/xmlconv/model/price_container.rb
|
87
|
+
- lib/xmlconv/model/transaction.rb
|
88
|
+
- lib/xmlconv/state/global.rb
|
89
|
+
- lib/xmlconv/state/global_predefine.rb
|
90
|
+
- lib/xmlconv/state/login.rb
|
91
|
+
- lib/xmlconv/state/transaction.rb
|
92
|
+
- lib/xmlconv/state/transactions.rb
|
93
|
+
- lib/xmlconv/util/application.rb
|
94
|
+
- lib/xmlconv/util/autoload.rb
|
95
|
+
- lib/xmlconv/util/destination.rb
|
96
|
+
- lib/xmlconv/util/invoicer.rb
|
97
|
+
- lib/xmlconv/util/known_user.rb
|
98
|
+
- lib/xmlconv/util/mail.rb
|
99
|
+
- lib/xmlconv/util/polling_manager.rb
|
100
|
+
- lib/xmlconv/util/session.rb
|
101
|
+
- lib/xmlconv/util/transaction.rb
|
102
|
+
- lib/xmlconv/util/validator.rb
|
103
|
+
- lib/xmlconv/view/foot.rb
|
104
|
+
- lib/xmlconv/view/head.rb
|
105
|
+
- lib/xmlconv/view/login.rb
|
106
|
+
- lib/xmlconv/view/navigation.rb
|
107
|
+
- lib/xmlconv/view/navigationlink.rb
|
108
|
+
- lib/xmlconv/view/pager.rb
|
109
|
+
- lib/xmlconv/view/preformatted.rb
|
110
|
+
- lib/xmlconv/view/template.rb
|
111
|
+
- lib/xmlconv/view/transaction.rb
|
112
|
+
- lib/xmlconv/view/transactions.rb
|
113
|
+
- test/config.rb
|
114
|
+
- test/mock.rb
|
115
|
+
- test/suite.rb
|
116
|
+
- test/test_i2/address.rb
|
117
|
+
- test/test_i2/date.rb
|
118
|
+
- test/test_i2/document.rb
|
119
|
+
- test/test_i2/header.rb
|
120
|
+
- test/test_i2/order.rb
|
121
|
+
- test/test_i2/parser.rb
|
122
|
+
- test/test_i2/position.rb
|
123
|
+
- test/test_model/address.rb
|
124
|
+
- test/test_model/agreement.rb
|
125
|
+
- test/test_model/bdd.rb
|
126
|
+
- test/test_model/bsr.rb
|
127
|
+
- test/test_model/delivery.rb
|
128
|
+
- test/test_model/delivery_item.rb
|
129
|
+
- test/test_model/freetext_container.rb
|
130
|
+
- test/test_model/invoice.rb
|
131
|
+
- test/test_model/invoice_item.rb
|
132
|
+
- test/test_model/name.rb
|
133
|
+
- test/test_model/part_info.rb
|
134
|
+
- test/test_model/party.rb
|
135
|
+
- test/test_model/price.rb
|
136
|
+
- test/test_util/application.rb
|
137
|
+
- test/test_util/destination.rb
|
138
|
+
- test/test_util/invoicer.rb
|
139
|
+
- test/test_util/polling_manager.rb
|
140
|
+
- test/test_util/transaction.rb
|
141
|
+
- .gemtest
|
142
|
+
has_rdoc: true
|
143
|
+
homepage: http://scm.ywesee.com/?p=xmlconv/.git;a=summary
|
144
|
+
licenses: []
|
145
|
+
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options:
|
148
|
+
- --main
|
149
|
+
- README.txt
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
hash: 3
|
158
|
+
segments:
|
159
|
+
- 0
|
160
|
+
version: "0"
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
hash: 3
|
167
|
+
segments:
|
168
|
+
- 0
|
169
|
+
version: "0"
|
170
|
+
requirements: []
|
171
|
+
|
172
|
+
rubyforge_project: xmlconv
|
173
|
+
rubygems_version: 1.4.2
|
174
|
+
signing_key:
|
175
|
+
specification_version: 3
|
176
|
+
summary: xmlconverter, convert XML to flat files.
|
177
|
+
test_files: []
|
178
|
+
|