data_active 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/features/step_definitions/sync_books_with_xml.rb +56 -1
- data/features/support/fixtures/xml/books_fresh_without_ids.xml +142 -0
- data/features/support/fixtures/xml/ms_access/books_fresh_without_ids.xml +169 -0
- data/features/sync_one_to_many.feature +12 -0
- data/lib/data_active.rb +12 -12
- data/lib/data_active/version.rb +1 -1
- metadata +7 -3
data/README.rdoc
CHANGED
@@ -9,6 +9,8 @@ Rails has some really fantastic features for serialisation of ActiveRecord to XM
|
|
9
9
|
* Choose to combine update, create and remove actions
|
10
10
|
* Synchronise your database with an XML Document
|
11
11
|
|
12
|
+
(NB: This gem was based on xml_active (https://github.com/michael-harrison/xml_active) which has been retired)
|
13
|
+
|
12
14
|
== The Background
|
13
15
|
|
14
16
|
== XML Documents
|
@@ -73,6 +73,27 @@ Then /^the books in the database will be identical to those in "([^"]*)"$/ do |x
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
Then /^the books in the database will be identical to those in "([^"]*)" with new ids$/ do |xml_document_file|
|
77
|
+
books_in_database = Book.all
|
78
|
+
books_xml_document = Nokogiri::XML(File.open(Rails.root.join(xml_document_file)).read)
|
79
|
+
|
80
|
+
# Ensure that all books in the xml document have been recorded
|
81
|
+
book_elements = books_xml_document.xpath("//book")
|
82
|
+
book_elements.each do |book_element|
|
83
|
+
book_name = book_element.xpath("//book/name")[0].text
|
84
|
+
book = Book.where(:name => book_name).first
|
85
|
+
if book == nil
|
86
|
+
fail "Books for #{book_name} is missing"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Ensure there are not extra books
|
91
|
+
books_in_xml = books_xml_document.xpath("//book")
|
92
|
+
if books_in_database.count != books_in_xml.count
|
93
|
+
fail "There number of books in the database (#{books_in_database.count}) doesn't match the number of books in the xml document (#{books_in_xml.count})"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
76
97
|
When /^the book price will be identical to those in "([^"]*)"$/ do |xml_document_file|
|
77
98
|
book_prices_in_database = BookPrice.all
|
78
99
|
if book_prices_in_database.count > 0
|
@@ -162,6 +183,40 @@ When /^the chapters will be identical to those in "([^"]*)"$/ do |xml_document_f
|
|
162
183
|
end
|
163
184
|
end
|
164
185
|
|
186
|
+
When /^the chapters will be identical to those in "([^"]*)" with new ids$/ do |xml_document_file|
|
187
|
+
xml_document = Nokogiri::XML(File.open(Rails.root.join(xml_document_file)).read)
|
188
|
+
|
189
|
+
# Ensure that all chapters in the xml document have been recorded
|
190
|
+
xml_document.xpath("//book").each do |book_element|
|
191
|
+
book = Book.where(:name => book_element.xpath("name")[0].text).first
|
192
|
+
book_id = book.id
|
193
|
+
xml_document.xpath("//book[name[text()='#{book_id}']]/chapters/chapter").each do |chapter_element|
|
194
|
+
chapter_title = chapter_element.xpath("title")[0].text
|
195
|
+
chapter_introduction = chapter_element.xpath("introduction")[0].text
|
196
|
+
chapter = book.chapters.where(:title => chapter_title)
|
197
|
+
|
198
|
+
if chapter == nil
|
199
|
+
fail "Chapters #{chapter_title} is missing"
|
200
|
+
else
|
201
|
+
if chapter_introduction != chapter.introduction
|
202
|
+
fail "Chapter introduction in database doesn't match chapter introduction in xml for chapter #{chapter_title}, XML: #{chapter_introduction}, Database: #{chapter.introduction}"
|
203
|
+
end
|
204
|
+
if book_id != chapter.book_id.to_s
|
205
|
+
fail "Chapter book_id in database doesn't match chapter book_id in xml for chapter #{chapter_title}, XML: #{book_id}, Database: #{chapter.book_id}"
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
|
212
|
+
# Ensure there are not extra chapters
|
213
|
+
chapters_in_xml = xml_document.xpath("//chapter")
|
214
|
+
chapter_count = Chapter.count
|
215
|
+
if chapter_count != chapters_in_xml.count
|
216
|
+
fail "There number of chapters in the database (#{chapter_count}) doesn't match the number of chapters in the xml document (#{chapters_in_xml.count})"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
165
220
|
When /^the database will contain identical pages for the chapters as those in "([^"]*)"$/ do |xml_document_file|
|
166
221
|
chapters_in_database = Chapter.all
|
167
222
|
if chapters_in_database.count > 0
|
@@ -173,7 +228,7 @@ When /^the database will contain identical pages for the chapters as those in "(
|
|
173
228
|
xml_document.xpath("//book[id[text()='#{book_id}']]/chapters/chapter").each do |chapter_element|
|
174
229
|
chapter_id = chapter_element.xpath("id")[0].text
|
175
230
|
pages = Page.where(:chapter_id => chapter_id)
|
176
|
-
if
|
231
|
+
if pages.count > 0
|
177
232
|
xml_document.xpath("//chapter[id[text()='#{chapter_id}']]/pages/page").each do |page_element|
|
178
233
|
page_id = page_element.xpath("id")[0].text
|
179
234
|
page_content = page_element.xpath("content")[0].text
|
@@ -0,0 +1,142 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<books type="array">
|
3
|
+
<book>
|
4
|
+
<name>Book 1</name>
|
5
|
+
<book_price>
|
6
|
+
<sell>50.00</sell>
|
7
|
+
<educational>35.00</educational>
|
8
|
+
<cost>20.00</cost>
|
9
|
+
</book_price>
|
10
|
+
<chapters type="array">
|
11
|
+
<chapter>
|
12
|
+
<title>Chapter 1</title>
|
13
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</introduction>
|
14
|
+
<pages type="array">
|
15
|
+
<page>
|
16
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
17
|
+
<number>1</number>
|
18
|
+
</page>
|
19
|
+
<page>
|
20
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
21
|
+
<number>2</number>
|
22
|
+
</page>
|
23
|
+
<page>
|
24
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
25
|
+
<number>3</number>
|
26
|
+
</page>
|
27
|
+
<page>
|
28
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
29
|
+
<number>4</number>
|
30
|
+
</page>
|
31
|
+
</pages>
|
32
|
+
</chapter>
|
33
|
+
<chapter>
|
34
|
+
<title>Chapter 2</title>
|
35
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</introduction>
|
36
|
+
<pages type="array">
|
37
|
+
<page>
|
38
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
39
|
+
<number>1</number>
|
40
|
+
</page>
|
41
|
+
<page>
|
42
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
43
|
+
<number>2</number>
|
44
|
+
</page>
|
45
|
+
<page>
|
46
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
47
|
+
<number>3</number>
|
48
|
+
</page>
|
49
|
+
<page>
|
50
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
51
|
+
<number>4</number>
|
52
|
+
</page>
|
53
|
+
</pages>
|
54
|
+
</chapter>
|
55
|
+
<chapter>
|
56
|
+
<title>Chapter 3</title>
|
57
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</introduction>
|
58
|
+
<pages type="array">
|
59
|
+
<page>
|
60
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
61
|
+
<number>1</number>
|
62
|
+
</page>
|
63
|
+
<page>
|
64
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
65
|
+
<number>2</number>
|
66
|
+
</page>
|
67
|
+
<page>
|
68
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
69
|
+
<number>3</number>
|
70
|
+
</page>
|
71
|
+
</pages>
|
72
|
+
</chapter>
|
73
|
+
</chapters>
|
74
|
+
</book>
|
75
|
+
<book>
|
76
|
+
<name>Book 1</name>
|
77
|
+
<chapters type="array">
|
78
|
+
<chapter>
|
79
|
+
<title>Chapter 1</title>
|
80
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</introduction>
|
81
|
+
<pages type="array">
|
82
|
+
<page>
|
83
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
84
|
+
<number>1</number>
|
85
|
+
</page>
|
86
|
+
<page>
|
87
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
88
|
+
<number>2</number>
|
89
|
+
</page>
|
90
|
+
<page>
|
91
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
92
|
+
<number>3</number>
|
93
|
+
</page>
|
94
|
+
<page>
|
95
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
96
|
+
<number>4</number>
|
97
|
+
</page>
|
98
|
+
</pages>
|
99
|
+
</chapter>
|
100
|
+
<chapter>
|
101
|
+
<title>Chapter 2</title>
|
102
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</introduction>
|
103
|
+
<pages type="array">
|
104
|
+
<page>
|
105
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
106
|
+
<number>1</number>
|
107
|
+
</page>
|
108
|
+
<page>
|
109
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
110
|
+
<number>2</number>
|
111
|
+
</page>
|
112
|
+
<page>
|
113
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
114
|
+
<number>3</number>
|
115
|
+
</page>
|
116
|
+
<page>
|
117
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
118
|
+
<number>4</number>
|
119
|
+
</page>
|
120
|
+
</pages>
|
121
|
+
</chapter>
|
122
|
+
<chapter>
|
123
|
+
<title>Chapter 3</title>
|
124
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</introduction>
|
125
|
+
<pages type="array">
|
126
|
+
<page>
|
127
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
128
|
+
<number>1</number>
|
129
|
+
</page>
|
130
|
+
<page>
|
131
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
132
|
+
<number>2</number>
|
133
|
+
</page>
|
134
|
+
<page>
|
135
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.</content>
|
136
|
+
<number>3</number>
|
137
|
+
</page>
|
138
|
+
</pages>
|
139
|
+
</chapter>
|
140
|
+
</chapters>
|
141
|
+
</book>
|
142
|
+
</books>
|
@@ -0,0 +1,169 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
+
xsi:noNamespaceSchemaLocation="book.xsd" generated="2012-07-11T16:01:54">
|
4
|
+
<book>
|
5
|
+
<name>Book 1</name>
|
6
|
+
<book_price>
|
7
|
+
<sell>50</sell>
|
8
|
+
<educational>35</educational>
|
9
|
+
<cost>29</cost>
|
10
|
+
</book_price>
|
11
|
+
<chapter>
|
12
|
+
<title>B1 Chapter 1</title>
|
13
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
14
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
15
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
16
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec
|
17
|
+
auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie
|
18
|
+
purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus
|
19
|
+
sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
20
|
+
</introduction>
|
21
|
+
<page>
|
22
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
23
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
24
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
25
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
26
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
27
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
28
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
29
|
+
</content>
|
30
|
+
<number>1</number>
|
31
|
+
</page>
|
32
|
+
<page>
|
33
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
34
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
35
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
36
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
37
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
38
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
39
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
40
|
+
</content>
|
41
|
+
<number>2</number>
|
42
|
+
</page>
|
43
|
+
<page>
|
44
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
45
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
46
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
47
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
48
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
49
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
50
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
51
|
+
</content>
|
52
|
+
<number>3</number>
|
53
|
+
</page>
|
54
|
+
</chapter>
|
55
|
+
<chapter>
|
56
|
+
<title>B1 Chapter 2</title>
|
57
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
58
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
59
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
60
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec
|
61
|
+
auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie
|
62
|
+
purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus
|
63
|
+
sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
64
|
+
</introduction>
|
65
|
+
<page>
|
66
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
67
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
68
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
69
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
70
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
71
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
72
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
73
|
+
</content>
|
74
|
+
<number>1</number>
|
75
|
+
</page>
|
76
|
+
<page>
|
77
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
78
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
79
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
80
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
81
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
82
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
83
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
84
|
+
</content>
|
85
|
+
<number>2</number>
|
86
|
+
</page>
|
87
|
+
<page>
|
88
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
89
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
90
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
91
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
92
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
93
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
94
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
95
|
+
</content>
|
96
|
+
<number>3</number>
|
97
|
+
</page>
|
98
|
+
<page>
|
99
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
100
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
101
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
102
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
103
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
104
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
105
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
106
|
+
</content>
|
107
|
+
<number>4</number>
|
108
|
+
</page>
|
109
|
+
</chapter>
|
110
|
+
</book>
|
111
|
+
<book>
|
112
|
+
<name>Book 2</name>
|
113
|
+
<chapter>
|
114
|
+
<title>B2 Chapter 1</title>
|
115
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
116
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
117
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
118
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec
|
119
|
+
auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie
|
120
|
+
purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus
|
121
|
+
sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
122
|
+
</introduction>
|
123
|
+
<page>
|
124
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
125
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
126
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
127
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
128
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
129
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
130
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
131
|
+
</content>
|
132
|
+
<number>1</number>
|
133
|
+
</page>
|
134
|
+
<page>
|
135
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
136
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
137
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
138
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
139
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
140
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
141
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
142
|
+
</content>
|
143
|
+
<number>2</number>
|
144
|
+
</page>
|
145
|
+
<page>
|
146
|
+
<content>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
147
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
148
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
149
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui.
|
150
|
+
Donec auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur
|
151
|
+
molestie purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat
|
152
|
+
eget dapibus sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
153
|
+
</content>
|
154
|
+
<number>3</number>
|
155
|
+
</page>
|
156
|
+
</chapter>
|
157
|
+
<chapter>
|
158
|
+
<title>B2 Chapter 2</title>
|
159
|
+
<introduction>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus purus nulla, condimentum vitae
|
160
|
+
hendrerit nec, blandit et felis. Suspendisse vulputate mollis suscipit. Vivamus non libero quis urna gravida
|
161
|
+
euismod quis in nisi. Morbi turpis orci, posuere nec ultrices ut, egestas ac purus. Morbi id pretium erat. In
|
162
|
+
ullamcorper, ligula id porta pellentesque, sem turpis ultricies libero, non elementum ipsum neque at dui. Donec
|
163
|
+
auctor nulla id mi dapibus id faucibus felis mollis. Curabitur imperdiet tristique nisi, consectetur molestie
|
164
|
+
purus accumsan id. Curabitur lacinia diam et nisl iaculis eleifend. Quisque turpis elit, volutpat eget dapibus
|
165
|
+
sed, egestas nec leo. Mauris dignissim tellus non lorem fringilla pharetra.
|
166
|
+
</introduction>
|
167
|
+
</chapter>
|
168
|
+
</book>
|
169
|
+
</dataroot>
|
@@ -38,3 +38,15 @@ Feature: Synchronise one to many relationships
|
|
38
38
|
And I have the "features/support/fixtures/xml/books_changed_bad.xml" file
|
39
39
|
When I synchronise with "features/support/fixtures/xml/books_changed_bad.xml" using the "fail_on_invalid" option
|
40
40
|
Then I should have a failure
|
41
|
+
|
42
|
+
Scenario Outline: Providing a set of record with no ids
|
43
|
+
Given I have no books
|
44
|
+
And I have the "<xml_file>" file
|
45
|
+
When I synchronise with "<xml_file>"
|
46
|
+
Then the books in the database will be identical to those in "<xml_file>" with new ids
|
47
|
+
And the chapters will be identical to those in "<xml_file>" with new ids
|
48
|
+
|
49
|
+
Examples:
|
50
|
+
| xml_file |
|
51
|
+
| features/support/fixtures/xml/ms_access/books_fresh_without_ids.xml |
|
52
|
+
| features/support/fixtures/xml/books_fresh_without_ids.xml |
|
data/lib/data_active.rb
CHANGED
@@ -40,16 +40,6 @@ module DataActive
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
# Save the record
|
44
|
-
if options.include? :sync
|
45
|
-
# Doing complete synchronisation with XML
|
46
|
-
active_record.save
|
47
|
-
elsif options.include?(:create) and active_record.new_record?
|
48
|
-
active_record.save
|
49
|
-
elsif options.include?(:update) and not active_record.new_record?
|
50
|
-
active_record.save
|
51
|
-
end
|
52
|
-
|
53
43
|
# Check through associations and apply sync appropriately
|
54
44
|
self.reflect_on_all_associations.each do |association|
|
55
45
|
foreign_key = foreign_key_from(association)
|
@@ -124,6 +114,16 @@ module DataActive
|
|
124
114
|
raise "unsupported association #{association.macro} for #{association.name } on #{self.name}"
|
125
115
|
end
|
126
116
|
end
|
117
|
+
|
118
|
+
# Save the record
|
119
|
+
if options.include? :sync
|
120
|
+
# Doing complete synchronisation with XML
|
121
|
+
active_record.save
|
122
|
+
elsif options.include?(:create) and active_record.new_record?
|
123
|
+
active_record.save
|
124
|
+
elsif options.include?(:update) and not active_record.new_record?
|
125
|
+
active_record.save
|
126
|
+
end
|
127
127
|
end
|
128
128
|
|
129
129
|
active_record
|
@@ -192,7 +192,7 @@ module DataActive
|
|
192
192
|
# </book>
|
193
193
|
# </books>
|
194
194
|
if active_record.new_record?
|
195
|
-
results = current_node.xpath("
|
195
|
+
results = current_node.xpath("#{association.name}")
|
196
196
|
else
|
197
197
|
results = current_node.xpath("//#{self.name.underscore}[#{self.primary_key}=#{active_record.attributes[self.primary_key.to_s]}]/#{association.name}")
|
198
198
|
end
|
@@ -204,7 +204,7 @@ module DataActive
|
|
204
204
|
# ...
|
205
205
|
# </book>
|
206
206
|
if active_record.new_record?
|
207
|
-
results = current_node.xpath("
|
207
|
+
results = current_node.xpath("#{association.name.to_s.singularize}")
|
208
208
|
else
|
209
209
|
results = current_node.xpath("//#{self.name.underscore}[#{self.primary_key}=#{active_record.attributes[self.primary_key.to_s]}]/#{association.name.to_s.singularize}")
|
210
210
|
end
|
data/lib/data_active/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_active
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- features/support/fixtures/xml/books_changed.xml
|
96
96
|
- features/support/fixtures/xml/books_changed_bad.xml
|
97
97
|
- features/support/fixtures/xml/books_fresh.xml
|
98
|
+
- features/support/fixtures/xml/books_fresh_without_ids.xml
|
98
99
|
- features/support/fixtures/xml/books_one_to_one_changed.xml
|
99
100
|
- features/support/fixtures/xml/books_one_to_one_mismatch.xml
|
100
101
|
- features/support/fixtures/xml/books_one_to_one_removed.xml
|
@@ -113,6 +114,7 @@ files:
|
|
113
114
|
- features/support/fixtures/xml/ms_access/books_changed.xml
|
114
115
|
- features/support/fixtures/xml/ms_access/books_changed_bad.xml
|
115
116
|
- features/support/fixtures/xml/ms_access/books_fresh.xml
|
117
|
+
- features/support/fixtures/xml/ms_access/books_fresh_without_ids.xml
|
116
118
|
- features/support/fixtures/xml/ms_access/books_one_to_one_changed.xml
|
117
119
|
- features/support/fixtures/xml/ms_access/books_one_to_one_mismatch.xml
|
118
120
|
- features/support/fixtures/xml/ms_access/books_one_to_one_removed.xml
|
@@ -278,7 +280,7 @@ rubyforge_project: data_active
|
|
278
280
|
rubygems_version: 1.8.22
|
279
281
|
signing_key:
|
280
282
|
specification_version: 3
|
281
|
-
summary: data_active 0.0.
|
283
|
+
summary: data_active 0.0.4
|
282
284
|
test_files:
|
283
285
|
- features/remove_records_missing_in_xml.feature
|
284
286
|
- features/step_definitions/remove_records_missing_in_xml.rb
|
@@ -302,6 +304,7 @@ test_files:
|
|
302
304
|
- features/support/fixtures/xml/books_changed.xml
|
303
305
|
- features/support/fixtures/xml/books_changed_bad.xml
|
304
306
|
- features/support/fixtures/xml/books_fresh.xml
|
307
|
+
- features/support/fixtures/xml/books_fresh_without_ids.xml
|
305
308
|
- features/support/fixtures/xml/books_one_to_one_changed.xml
|
306
309
|
- features/support/fixtures/xml/books_one_to_one_mismatch.xml
|
307
310
|
- features/support/fixtures/xml/books_one_to_one_removed.xml
|
@@ -320,6 +323,7 @@ test_files:
|
|
320
323
|
- features/support/fixtures/xml/ms_access/books_changed.xml
|
321
324
|
- features/support/fixtures/xml/ms_access/books_changed_bad.xml
|
322
325
|
- features/support/fixtures/xml/ms_access/books_fresh.xml
|
326
|
+
- features/support/fixtures/xml/ms_access/books_fresh_without_ids.xml
|
323
327
|
- features/support/fixtures/xml/ms_access/books_one_to_one_changed.xml
|
324
328
|
- features/support/fixtures/xml/ms_access/books_one_to_one_mismatch.xml
|
325
329
|
- features/support/fixtures/xml/ms_access/books_one_to_one_removed.xml
|