xmlconv 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/.gemtest +0 -0
  2. data/History.txt +6 -0
  3. data/LICENSE +339 -0
  4. data/README.txt +29 -0
  5. data/Rakefile +37 -0
  6. data/bin/admin +68 -0
  7. data/bin/xmlconvd +38 -0
  8. data/data/grammar/i2.grammar +73 -0
  9. data/lib/xmlconv/config.rb +61 -0
  10. data/lib/xmlconv/custom/lookandfeel.rb +50 -0
  11. data/lib/xmlconv/i2/address.rb +35 -0
  12. data/lib/xmlconv/i2/date.rb +41 -0
  13. data/lib/xmlconv/i2/document.rb +27 -0
  14. data/lib/xmlconv/i2/header.rb +32 -0
  15. data/lib/xmlconv/i2/order.rb +61 -0
  16. data/lib/xmlconv/i2/parser.rb +23 -0
  17. data/lib/xmlconv/i2/position.rb +45 -0
  18. data/lib/xmlconv/i2/record.rb +11 -0
  19. data/lib/xmlconv/model/address.rb +20 -0
  20. data/lib/xmlconv/model/agreement.rb +10 -0
  21. data/lib/xmlconv/model/bdd.rb +37 -0
  22. data/lib/xmlconv/model/bsr.rb +16 -0
  23. data/lib/xmlconv/model/delivery.rb +15 -0
  24. data/lib/xmlconv/model/delivery_item.rb +24 -0
  25. data/lib/xmlconv/model/document.rb +25 -0
  26. data/lib/xmlconv/model/freetext_container.rb +26 -0
  27. data/lib/xmlconv/model/id_container.rb +22 -0
  28. data/lib/xmlconv/model/invoice.rb +18 -0
  29. data/lib/xmlconv/model/invoice_item.rb +11 -0
  30. data/lib/xmlconv/model/item.rb +19 -0
  31. data/lib/xmlconv/model/item_container.rb +15 -0
  32. data/lib/xmlconv/model/name.rb +27 -0
  33. data/lib/xmlconv/model/part_info.rb +10 -0
  34. data/lib/xmlconv/model/part_info_container.rb +15 -0
  35. data/lib/xmlconv/model/party.rb +20 -0
  36. data/lib/xmlconv/model/party_container.rb +20 -0
  37. data/lib/xmlconv/model/price.rb +10 -0
  38. data/lib/xmlconv/model/price_container.rb +18 -0
  39. data/lib/xmlconv/model/transaction.rb +28 -0
  40. data/lib/xmlconv/state/global.rb +28 -0
  41. data/lib/xmlconv/state/global_predefine.rb +11 -0
  42. data/lib/xmlconv/state/login.rb +39 -0
  43. data/lib/xmlconv/state/transaction.rb +13 -0
  44. data/lib/xmlconv/state/transactions.rb +130 -0
  45. data/lib/xmlconv/util/application.rb +142 -0
  46. data/lib/xmlconv/util/autoload.rb +35 -0
  47. data/lib/xmlconv/util/destination.rb +249 -0
  48. data/lib/xmlconv/util/invoicer.rb +71 -0
  49. data/lib/xmlconv/util/known_user.rb +16 -0
  50. data/lib/xmlconv/util/mail.rb +31 -0
  51. data/lib/xmlconv/util/polling_manager.rb +198 -0
  52. data/lib/xmlconv/util/session.rb +23 -0
  53. data/lib/xmlconv/util/transaction.rb +133 -0
  54. data/lib/xmlconv/util/validator.rb +20 -0
  55. data/lib/xmlconv/view/foot.rb +27 -0
  56. data/lib/xmlconv/view/head.rb +13 -0
  57. data/lib/xmlconv/view/login.rb +36 -0
  58. data/lib/xmlconv/view/navigation.rb +30 -0
  59. data/lib/xmlconv/view/navigationlink.rb +21 -0
  60. data/lib/xmlconv/view/pager.rb +73 -0
  61. data/lib/xmlconv/view/preformatted.rb +54 -0
  62. data/lib/xmlconv/view/template.rb +17 -0
  63. data/lib/xmlconv/view/transaction.rb +42 -0
  64. data/lib/xmlconv/view/transactions.rb +90 -0
  65. data/lib/xmlconv.rb +3 -0
  66. data/test/config.rb +12 -0
  67. data/test/mock.rb +149 -0
  68. data/test/suite.rb +16 -0
  69. data/test/test_i2/address.rb +88 -0
  70. data/test/test_i2/date.rb +50 -0
  71. data/test/test_i2/document.rb +62 -0
  72. data/test/test_i2/header.rb +39 -0
  73. data/test/test_i2/order.rb +94 -0
  74. data/test/test_i2/parser.rb +312 -0
  75. data/test/test_i2/position.rb +65 -0
  76. data/test/test_model/address.rb +35 -0
  77. data/test/test_model/agreement.rb +22 -0
  78. data/test/test_model/bdd.rb +55 -0
  79. data/test/test_model/bsr.rb +38 -0
  80. data/test/test_model/delivery.rb +79 -0
  81. data/test/test_model/delivery_item.rb +52 -0
  82. data/test/test_model/freetext_container.rb +45 -0
  83. data/test/test_model/invoice.rb +65 -0
  84. data/test/test_model/invoice_item.rb +41 -0
  85. data/test/test_model/name.rb +57 -0
  86. data/test/test_model/part_info.rb +24 -0
  87. data/test/test_model/party.rb +96 -0
  88. data/test/test_model/price.rb +24 -0
  89. data/test/test_util/application.rb +168 -0
  90. data/test/test_util/destination.rb +415 -0
  91. data/test/test_util/invoicer.rb +42 -0
  92. data/test/test_util/polling_manager.rb +299 -0
  93. data/test/test_util/transaction.rb +130 -0
  94. metadata +178 -0
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+ # Model::TestFreeTextContainer -- xmlconv2 -- 29.06.2004 -- hwyss@ywesee.com
3
+
4
+ $: << File.dirname(__FILE__)
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'xmlconv/model/invoice_item'
9
+
10
+ module XmlConv
11
+ module Model
12
+ class Container
13
+ include FreeTextContainer
14
+ end
15
+ class TestFreeTextContainer < Test::Unit::TestCase
16
+ def setup
17
+ @container = Container.new
18
+ end
19
+ def test_attr_readers
20
+ assert_respond_to(@container, :free_text)
21
+ end
22
+ def test_add_free_text
23
+ txt = @container.add_free_text('Description', 'Foo, Bar and Baz')
24
+ assert_instance_of(FreeText, @container.free_text)
25
+ assert_equal(@container.free_text, txt)
26
+ assert_equal('Foo, Bar and Baz', txt)
27
+ assert_equal('Description', txt.type)
28
+ end
29
+ end
30
+ class TestFreeText < Test::Unit::TestCase
31
+ def setup
32
+ @text = FreeText.new
33
+ end
34
+ def test_append
35
+ assert_equal('', @text)
36
+ @text << "Foo, Bar and Baz"
37
+ assert_equal('Foo, Bar and Baz', @text)
38
+ @text << "with a newline"
39
+ assert_equal("Foo, Bar and Baz\nwith a newline", @text)
40
+ @text << ""
41
+ assert_equal("Foo, Bar and Baz\nwith a newline", @text)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env ruby
2
+ # Model::TestInvoice -- xmlconv2 -- 22.06.2004 -- hwyss@ywesee.com
3
+
4
+ $: << File.dirname(__FILE__)
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'xmlconv/model/invoice'
9
+ require 'mock'
10
+
11
+ module XmlConv
12
+ module Model
13
+ class TestInvoice < Test::Unit::TestCase
14
+ def setup
15
+ @invoice = Invoice.new
16
+ end
17
+ def test_attr_readers
18
+ assert_respond_to(@invoice, :ids)
19
+ assert_respond_to(@invoice, :items)
20
+ assert_respond_to(@invoice, :parties)
21
+ assert_respond_to(@invoice, :prices)
22
+ assert_respond_to(@invoice, :delivery_id)
23
+ end
24
+ def test_attr_accessors
25
+ assert_respond_to(@invoice, :free_text)
26
+ assert_respond_to(@invoice, :free_text=)
27
+ assert_respond_to(@invoice, :agreement)
28
+ assert_respond_to(@invoice, :agreement=)
29
+ assert_respond_to(@invoice, :status)
30
+ assert_respond_to(@invoice, :status=)
31
+ assert_respond_to(@invoice, :status_date)
32
+ assert_respond_to(@invoice, :status_date=)
33
+ end
34
+ def test_add_free_text
35
+ assert_respond_to(@invoice, :add_free_text)
36
+ end
37
+ def test_add_item
38
+ item = Mock.new
39
+ @invoice.add_item(item)
40
+ assert_equal([item], @invoice.items)
41
+ item.__verify
42
+ end
43
+ def test_add_delivery_id
44
+ @invoice.add_delivery_id('Domain', 'Id')
45
+ assert_equal(['Domain', 'Id'], @invoice.delivery_id)
46
+ end
47
+ def test_add_party__customer
48
+ party = Mock.new('Customer')
49
+ party.__next(:role) { 'Customer' }
50
+ @invoice.add_party(party)
51
+ assert_equal(party, @invoice.customer)
52
+ assert_equal([party], @invoice.parties)
53
+ party.__verify
54
+ end
55
+ def test_add_party__seller
56
+ party = Mock.new('Seller')
57
+ party.__next(:role) { 'Seller' }
58
+ @invoice.add_party(party)
59
+ assert_equal(party, @invoice.seller)
60
+ assert_equal([party], @invoice.parties)
61
+ party.__verify
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ # Model::TestInvoiceItem -- xmlconv2 -- 23.06.2004 -- hwyss@ywesee.com
3
+
4
+ $: << File.dirname(__FILE__)
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'xmlconv/model/invoice_item'
9
+ require 'mock'
10
+
11
+ module XmlConv
12
+ module Model
13
+ class TestInvoiceItem < Test::Unit::TestCase
14
+ def setup
15
+ @item = InvoiceItem.new
16
+ end
17
+ def test_attr_accessors
18
+ assert_respond_to(@item, :line_no)
19
+ assert_respond_to(@item, :line_no=)
20
+ assert_respond_to(@item, :qty)
21
+ assert_respond_to(@item, :qty=)
22
+ end
23
+ def test_attr_readers
24
+ assert_respond_to(@item, :part_infos)
25
+ assert_respond_to(@item, :ids)
26
+ assert_respond_to(@item, :free_text)
27
+ end
28
+ def test_add_id
29
+ assert_equal({}, @item.ids)
30
+ @item.add_id('ET-NUMMER', 'et_number')
31
+ assert_equal({'ET-NUMMER' => 'et_number'}, @item.ids)
32
+ end
33
+ def test_add_part_info
34
+ info = Mock.new('PartInfo')
35
+ assert_equal([], @item.part_infos)
36
+ @item.add_part_info(info)
37
+ assert_equal([info], @item.part_infos)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env ruby
2
+ # TestName -- xmlconv2 -- 01.06.2004 -- hwyss@ywesee.com
3
+
4
+ $: << File.dirname(__FILE__)
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'xmlconv/model/name'
9
+
10
+ module XmlConv
11
+ module Model
12
+ class TestName < Test::Unit::TestCase
13
+ def setup
14
+ @name = Name.new
15
+ end
16
+ def test_attr_accessors
17
+ assert_respond_to(@name, :first)
18
+ assert_respond_to(@name, :first=)
19
+ assert_respond_to(@name, :last)
20
+ assert_respond_to(@name, :last=)
21
+ assert_respond_to(@name, :text)
22
+ assert_respond_to(@name, :text=)
23
+ end
24
+ def test_to_s
25
+ @name.first = 'First'
26
+ assert_equal('First', @name.to_s)
27
+ @name.last = 'Last'
28
+ assert_equal('First Last', @name.to_s)
29
+ @name.text = 'Text'
30
+ assert_equal('First Text Last', @name.to_s)
31
+ end
32
+ def test_attr_writers
33
+ assert_nil(@name.first)
34
+ @name.first = nil
35
+ assert_nil(@name.first)
36
+ @name.first = 'first'
37
+ assert_equal('first', @name.first)
38
+ @name.first = ''
39
+ assert_nil(@name.first)
40
+ assert_nil(@name.last)
41
+ @name.last = nil
42
+ assert_nil(@name.last)
43
+ @name.last = 'last'
44
+ assert_equal('last', @name.last)
45
+ @name.last = ''
46
+ assert_nil(@name.last)
47
+ assert_nil(@name.text)
48
+ @name.text = nil
49
+ assert_nil(@name.text)
50
+ @name.text = 'text'
51
+ assert_equal('text', @name.text)
52
+ @name.text = ''
53
+ assert_nil(@name.text)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # Model::TestPartInfo -- xmlconv2 -- 23.06.2004 -- hwyss@ywesee.com
3
+
4
+ $: << File.dirname(__FILE__)
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'xmlconv/model/part_info'
9
+
10
+ module XmlConv
11
+ module Model
12
+ class TestPartInfo < Test::Unit::TestCase
13
+ def setup
14
+ @part_info = PartInfo.new
15
+ end
16
+ def test_attr_accessors
17
+ assert_respond_to(@part_info, :dimension)
18
+ assert_respond_to(@part_info, :dimension=)
19
+ assert_respond_to(@part_info, :value)
20
+ assert_respond_to(@part_info, :value=)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env ruby
2
+ # TestParty -- xmlconv2 -- 01.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/model/party'
9
+ require 'mock'
10
+
11
+ module XmlConv
12
+ module Model
13
+ class TestParty < Test::Unit::TestCase
14
+ class ToSMock < Mock
15
+ def to_s
16
+ true
17
+ end
18
+ end
19
+ def setup
20
+ @party = Party.new
21
+ end
22
+ def test_attr_accessors
23
+ assert_respond_to(@party, :role)
24
+ assert_respond_to(@party, :role=)
25
+ assert_respond_to(@party, :name)
26
+ assert_respond_to(@party, :name=)
27
+ assert_respond_to(@party, :employee)
28
+ assert_respond_to(@party, :employee=)
29
+ assert_respond_to(@party, :address)
30
+ assert_respond_to(@party, :address=)
31
+ end
32
+ def test_attr_readers
33
+ assert_respond_to(@party, :ids)
34
+ assert_respond_to(@party, :acc_id)
35
+ end
36
+ def test_add_id
37
+ assert_equal({}, @party.ids)
38
+ @party.add_id('ACC', 'id_string')
39
+ assert_equal({'ACC' => 'id_string'}, @party.ids)
40
+ assert_equal('id_string', @party.acc_id)
41
+ end
42
+ def test_add_party
43
+ employee = Mock.new('Employee')
44
+ employee.__next(:role) { 'Employee' }
45
+ @party.add_party(employee)
46
+ assert_equal(employee, @party.employee)
47
+ assert_equal([employee], @party.parties)
48
+ ship_to = Mock.new('ShipTo')
49
+ ship_to.__next(:role) { 'ShipTo' }
50
+ @party.add_party(ship_to)
51
+ assert_equal(employee, @party.employee)
52
+ assert_equal(ship_to, @party.ship_to)
53
+ assert_equal([employee, ship_to], @party.parties)
54
+ bill_to = Mock.new('BillTo')
55
+ bill_to.__next(:role) { 'BillTo' }
56
+ @party.add_party(bill_to)
57
+ assert_equal(employee, @party.employee)
58
+ assert_equal(bill_to, @party.bill_to)
59
+ assert_equal([employee, ship_to, bill_to], @party.parties)
60
+ end
61
+ def test_party_id
62
+ assert_nil(@party.party_id)
63
+ @party.add_id('ACC', 'id_string')
64
+ assert_equal('id_string', @party.party_id)
65
+ end
66
+ def test_name
67
+ assert_nil(@party.name)
68
+ @party.name = 'a_string'
69
+ assert_equal('a_string', @party.name)
70
+ name = ToSMock.new('Name')
71
+ @party.name = name
72
+ assert_equal(name, @party.name)
73
+ name.__verify
74
+ end
75
+ def test_employee
76
+ employee = Mock.new('Employee')
77
+ employee.__next(:role) { 'Employee' }
78
+ @party.add_party(employee)
79
+ assert_equal(employee, @party.employee)
80
+ assert_equal([employee], @party.parties)
81
+ ship_to = Mock.new('ShipTo')
82
+ ship_to.__next(:role) { 'ShipTo' }
83
+ @party.add_party(ship_to)
84
+ assert_equal(employee, @party.employee)
85
+ assert_equal(ship_to, @party.ship_to)
86
+ assert_equal([employee, ship_to], @party.parties)
87
+ bill_to = Mock.new('BillTo')
88
+ bill_to.__next(:role) { 'BillTo' }
89
+ @party.add_party(bill_to)
90
+ assert_equal(employee, @party.employee)
91
+ assert_equal(bill_to, @party.bill_to)
92
+ assert_equal([employee, ship_to, bill_to], @party.parties)
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # TestPrice -- xmlconv2 -- 21.06.2004 -- hwyss@ywesee.com
3
+
4
+ $: << File.dirname(__FILE__)
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'xmlconv/model/price'
9
+
10
+ module XmlConv
11
+ module Model
12
+ class TestPrice < Test::Unit::TestCase
13
+ def setup
14
+ @price = Price.new
15
+ end
16
+ def test_attr_accessors
17
+ assert_respond_to(@price, :purpose)
18
+ assert_respond_to(@price, :purpose=)
19
+ assert_respond_to(@price, :amount)
20
+ assert_respond_to(@price, :amount=)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,168 @@
1
+ #!/usr/bin/env ruby
2
+ # XmlConv::TestApplication -- xmlconv2 -- 07.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/application'
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
+ class TestApplication < Test::Unit::TestCase
25
+ def setup
26
+ @app = Util::Application.new
27
+ @app.init
28
+ end
29
+ def test_attr_readers
30
+ assert_respond_to(@app, :transactions)
31
+ assert_respond_to(@app, :failed_transactions)
32
+ end
33
+ def test_execute
34
+ transaction = Mock.new('Transaction')
35
+ cache = Mock.new('Cache')
36
+ cache.__next(:transaction) { |block|
37
+ block.call
38
+ }
39
+ cache.__next(:store) { |transactions|
40
+ assert_equal(@app.transactions, transactions)
41
+ }
42
+ ODBA.cache = cache
43
+ transaction.__next(:transaction_id=) { |id|
44
+ assert_equal(1, id)
45
+ }
46
+ transaction.__next(:execute) { }
47
+ transaction.__next(:notify) { }
48
+ assert_equal([], @app.transactions)
49
+ assert_equal(0, @app.transactions.size)
50
+ @app.execute(transaction)
51
+ assert_equal([transaction], @app.transactions)
52
+ transaction.__verify
53
+ cache.__verify
54
+ ensure
55
+ ODBA.cache = nil
56
+ end
57
+ def test_execute__survive_notification_failure
58
+ transaction = Mock.new('Transaction')
59
+ cache = Mock.new('Cache')
60
+ cache.__next(:transaction) { |block|
61
+ block.call
62
+ }
63
+ cache.__next(:store) { |transactions|
64
+ assert_equal(@app.transactions, transactions)
65
+ }
66
+ ODBA.cache = cache
67
+ transaction.__next(:transaction_id=) { |id|
68
+ assert_equal(1, id)
69
+ }
70
+ transaction.__next(:execute) { }
71
+ transaction.__next(:notify) {
72
+ raise Net::SMTPFatalError, 'could not send email'
73
+ }
74
+ assert_equal([], @app.transactions)
75
+ assert_equal(0, @app.transactions.size)
76
+ @app.execute(transaction)
77
+ assert_equal([transaction], @app.transactions)
78
+ transaction.__verify
79
+ cache.__verify
80
+ ensure
81
+ ODBA.cache = nil
82
+ end
83
+ def test_execute__notify_errors
84
+ transaction = Mock.new('Transaction')
85
+ cache = Mock.new('Cache')
86
+ cache.__next(:transaction) { |block|
87
+ block.call
88
+ }
89
+ cache.__next(:store) { |transactions|
90
+ assert_equal(@app.transactions, transactions)
91
+ }
92
+ ODBA.cache = cache
93
+ transaction.__next(:transaction_id=) { |id|
94
+ assert_equal(1, id)
95
+ }
96
+ transaction.__next(:execute) {
97
+ raise 'oops, something went wrong'
98
+ }
99
+ transaction.__next(:error=) { }
100
+ transaction.__next(:notify) { }
101
+ assert_equal([], @app.transactions)
102
+ assert_equal(0, @app.transactions.size)
103
+ @app.execute(transaction)
104
+ assert_equal([transaction], @app.transactions)
105
+ transaction.__verify
106
+ cache.__verify
107
+ ensure
108
+ ODBA.cache = nil
109
+ end
110
+ def test_dumpable
111
+ assert_nothing_raised { Marshal.dump(@app) }
112
+ end
113
+ def test_next_transaction_id
114
+ assert_equal([], @app.transactions)
115
+ assert_equal(1, @app.next_transaction_id)
116
+ assert_equal(2, @app.next_transaction_id)
117
+ assert_equal(3, @app.next_transaction_id)
118
+ trans1 = Mock.new('Transaction1')
119
+ trans2 = Mock.new('Transaction2')
120
+ @app.transactions.push(trans1)
121
+ @app.transactions.push(trans2)
122
+ @app.instance_variable_set('@next_transaction_id', nil)
123
+ trans1.__next(:transaction_id) { 6 }
124
+ trans2.__next(:transaction_id) { 3 }
125
+ assert_equal(7, @app.next_transaction_id)
126
+ trans1.__verify
127
+ trans2.__verify
128
+ end
129
+ def test_odba_exclude_vars
130
+ @app.instance_variable_set('@next_transaction_id', 10)
131
+ @app.instance_eval('odba_replace_excluded!')
132
+ assert_nil(@app.instance_variable_get('@next_transaction_id'))
133
+ end
134
+ def test_transaction
135
+ trans1 = Mock.new('Transaction1')
136
+ trans2 = Mock.new('Transaction2')
137
+ trans3 = Mock.new('Transaction2')
138
+ @app.transactions.push(trans1)
139
+ @app.transactions.push(trans2)
140
+ trans2.__next(:transaction_id) { 2 }
141
+ trans1.__next(:transaction_id) { 1 }
142
+ assert_equal(trans1, @app.transaction(1))
143
+ trans1.__verify
144
+ trans2.__verify
145
+ @app.transactions.push(trans3)
146
+ trans3.__next(:transaction_id) { 5 }
147
+ trans1.__next(:transaction_id) { 1 }
148
+ trans2.__next(:transaction_id) { 2 }
149
+ assert_equal(trans2, @app.transaction(2))
150
+ trans1.__verify
151
+ trans2.__verify
152
+ trans3.__verify
153
+ trans3.__next(:transaction_id) { 5 }
154
+ trans3.__next(:transaction_id) { 5 }
155
+ assert_equal(trans3, @app.transaction(5))
156
+ trans1.__verify
157
+ trans2.__verify
158
+ trans3.__verify
159
+ trans3.__next(:transaction_id) { 5 }
160
+ trans3.__next(:transaction_id) { 5 }
161
+ assert_equal(trans3, @app.transaction('5'))
162
+ trans1.__verify
163
+ trans2.__verify
164
+ trans3.__verify
165
+ end
166
+ end
167
+ end
168
+ end