ro-bundle 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +11 -0
  3. data/.ruby-env +1 -0
  4. data/.ruby-gemset +2 -0
  5. data/.ruby-version +2 -0
  6. data/.travis.yml +11 -0
  7. data/Changes.rdoc +129 -0
  8. data/Gemfile +11 -0
  9. data/Licence.rdoc +29 -0
  10. data/Rakefile +29 -0
  11. data/ReadMe.rdoc +57 -0
  12. data/bin/dir2ro +48 -0
  13. data/bin/ro-bundle-info +45 -0
  14. data/bin/verify-ro-bundle +27 -0
  15. data/bin/zip2ro +57 -0
  16. data/lib/ro-bundle.rb +45 -0
  17. data/lib/ro-bundle/exceptions.rb +30 -0
  18. data/lib/ro-bundle/file.rb +323 -0
  19. data/lib/ro-bundle/ro/agent.rb +73 -0
  20. data/lib/ro-bundle/ro/aggregate.rb +107 -0
  21. data/lib/ro-bundle/ro/annotation.rb +89 -0
  22. data/lib/ro-bundle/ro/directory.rb +120 -0
  23. data/lib/ro-bundle/ro/manifest.rb +338 -0
  24. data/lib/ro-bundle/ro/provenance.rb +153 -0
  25. data/lib/ro-bundle/util.rb +57 -0
  26. data/lib/ro-bundle/version.rb +13 -0
  27. data/ro-bundle.gemspec +43 -0
  28. data/test/data/HelloAnyone.robundle +0 -0
  29. data/test/data/empty-manifest.json +1 -0
  30. data/test/data/example3-manifest.json +40 -0
  31. data/test/data/invalid-manifest.json +5 -0
  32. data/test/data/invalid-manifest.robundle +0 -0
  33. data/test/helpers/fake_manifest.rb +23 -0
  34. data/test/helpers/fake_provenance.rb +32 -0
  35. data/test/helpers/list_tests.rb +22 -0
  36. data/test/tc_add_annotation.rb +571 -0
  37. data/test/tc_agent.rb +63 -0
  38. data/test/tc_aggregate.rb +116 -0
  39. data/test/tc_annotation.rb +84 -0
  40. data/test/tc_create.rb +170 -0
  41. data/test/tc_manifest.rb +221 -0
  42. data/test/tc_provenance.rb +121 -0
  43. data/test/tc_read.rb +66 -0
  44. data/test/tc_remove.rb +140 -0
  45. data/test/tc_util.rb +64 -0
  46. data/test/ts_ro_bundle.rb +28 -0
  47. metadata +217 -0
data/test/tc_agent.rb ADDED
@@ -0,0 +1,63 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2014 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Author: Robert Haines
7
+ #------------------------------------------------------------------------------
8
+
9
+ require 'test/unit'
10
+ require "ro-bundle"
11
+
12
+ class TestAgent < Test::Unit::TestCase
13
+
14
+ def setup
15
+ @name = "Robert Haines"
16
+ @uri = "https://github.com/hainesr"
17
+ @orcid = "http://orcid.org/0000-0002-9538-7919"
18
+
19
+ @json = { :name => @name, :uri => @uri, :orcid => @orcid }
20
+ end
21
+
22
+ def test_create_from_json_hash
23
+ agent = ROBundle::Agent.new(@json)
24
+
25
+ assert_equal @name, agent.name
26
+ assert_equal @uri, agent.uri
27
+ assert_equal @orcid, agent.orcid
28
+ end
29
+
30
+ def test_create_from_empty_json_hash
31
+ agent = ROBundle::Agent.new({})
32
+
33
+ assert_nil agent.name
34
+ assert_nil agent.uri
35
+ assert_nil agent.orcid
36
+ end
37
+
38
+ def test_create_from_parameters
39
+ agent = ROBundle::Agent.new(@name, @uri, @orcid)
40
+
41
+ assert_equal @name, agent.name
42
+ assert_equal @uri, agent.uri
43
+ assert_equal @orcid, agent.orcid
44
+ end
45
+
46
+ def test_create_from_parameters_with_uris
47
+ agent = ROBundle::Agent.new(@name, URI.parse(@uri), URI.parse(@orcid))
48
+
49
+ assert_equal @name, agent.name
50
+ assert_equal @uri, agent.uri
51
+ assert_equal @orcid, agent.orcid
52
+ end
53
+
54
+ def test_json_output
55
+ agent = ROBundle::Agent.new(@json)
56
+ json = JSON.parse(JSON.generate(agent))
57
+
58
+ assert_equal @name, json["name"]
59
+ assert_equal @uri, json["uri"]
60
+ assert_equal @orcid, json["orcid"]
61
+ end
62
+
63
+ end
@@ -0,0 +1,116 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2014 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Author: Robert Haines
7
+ #------------------------------------------------------------------------------
8
+
9
+
10
+ require 'test/unit'
11
+ require "ro-bundle"
12
+
13
+ class TestAggregate < Test::Unit::TestCase
14
+
15
+ def test_simple_file
16
+ assert_nothing_raised(ROBundle::InvalidAggregateError) do
17
+ file = "/good.txt"
18
+ type = "text/plain"
19
+ agg = ROBundle::Aggregate.new(file, type)
20
+
21
+ assert_nil agg.uri
22
+ assert_equal file, agg.file
23
+ assert_equal type, agg.mediatype
24
+ end
25
+ end
26
+
27
+ def test_simple_uri
28
+ assert_nothing_raised(ROBundle::InvalidAggregateError) do
29
+ uri = "http://example.com/good.txt"
30
+ agg = ROBundle::Aggregate.new(uri)
31
+
32
+ assert_nil agg.file
33
+ assert_nil agg.mediatype
34
+ assert_equal uri, agg.uri
35
+ end
36
+ end
37
+
38
+ def test_simple_uri_object
39
+ assert_nothing_raised(ROBundle::InvalidAggregateError) do
40
+ uri = URI.parse("http://example.com/good.txt")
41
+ agg = ROBundle::Aggregate.new(uri)
42
+
43
+ assert_nil agg.file
44
+ assert_nil agg.mediatype
45
+ assert_equal uri.to_s, agg.uri
46
+ end
47
+ end
48
+
49
+ def test_bad_aggregates
50
+ assert_raise(ROBundle::InvalidAggregateError) do
51
+ ROBundle::Aggregate.new([])
52
+ end
53
+
54
+ assert_raise(ROBundle::InvalidAggregateError) do
55
+ ROBundle::Aggregate.new({})
56
+ end
57
+ end
58
+
59
+ def test_complex_file
60
+ assert_nothing_raised(ROBundle::InvalidAggregateError) do
61
+ file = "/good.txt"
62
+ type = "text/plain"
63
+
64
+ json = {
65
+ :file => file,
66
+ :mediatype => type,
67
+ :createdOn => "2013-02-12T19:37:32.939Z",
68
+ :createdBy => { "name" => "Robert Haines" }
69
+ }
70
+
71
+ agg = ROBundle::Aggregate.new(json)
72
+
73
+ assert_nil agg.uri
74
+ assert_equal file, agg.file
75
+ assert_equal type, agg.mediatype
76
+ assert agg.created_on.instance_of?(Time)
77
+ assert agg.created_by.instance_of?(ROBundle::Agent)
78
+ end
79
+ end
80
+
81
+ def test_complex_uri
82
+ assert_nothing_raised(ROBundle::InvalidAggregateError) do
83
+ uri = "http://example.com/good.txt"
84
+
85
+ json = {
86
+ :uri => uri
87
+ }
88
+
89
+ agg = ROBundle::Aggregate.new(json)
90
+
91
+ assert_nil agg.file
92
+ assert_nil agg.mediatype
93
+ assert_equal uri, agg.uri
94
+ end
95
+ end
96
+
97
+ def test_json_output_file
98
+ file = "/good.txt"
99
+ type = "text/plain"
100
+ time = "2013-02-12T19:37:32.939Z"
101
+ json = {
102
+ :file => file,
103
+ :mediatype => type,
104
+ :createdOn => time,
105
+ :createdBy => { :name => "Robert Haines" }
106
+ }
107
+
108
+ agg = ROBundle::Aggregate.new(json)
109
+ json = JSON.parse(JSON.generate(agg))
110
+
111
+ assert_equal file, json["file"]
112
+ assert_equal type, json["mediatype"]
113
+ assert_equal time, json["createdOn"]
114
+ end
115
+
116
+ end
@@ -0,0 +1,84 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2014 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Author: Robert Haines
7
+ #------------------------------------------------------------------------------
8
+
9
+ require 'test/unit'
10
+ require "ro-bundle"
11
+
12
+ class TestAnnotation < Test::Unit::TestCase
13
+
14
+ def setup
15
+ @target = [ "/", "/file.txt" ]
16
+ @content = "http://www.example.com/example.txt"
17
+ @id = UUID.generate(:urn)
18
+ @creator = "Robert Haines"
19
+ @time = "2014-08-20T11:30:00+01:00"
20
+
21
+ @json = {
22
+ :about => @target,
23
+ :content => @content,
24
+ :annotation => @id,
25
+ :createdBy => { :name => @creator },
26
+ :createdOn => @time
27
+ }
28
+ end
29
+
30
+ def test_create
31
+ an = ROBundle::Annotation.new(@target)
32
+
33
+ assert_equal @target, an.target
34
+ assert_nil an.content
35
+ assert_not_nil an.annotation_id
36
+ end
37
+
38
+ def test_create_with_content
39
+ an = ROBundle::Annotation.new(@target, @content)
40
+
41
+ assert_equal @target, an.target
42
+ assert_equal @content, an.content
43
+ assert_not_nil an.annotation_id
44
+ end
45
+
46
+ def test_create_from_json
47
+ an = ROBundle::Annotation.new(@json)
48
+
49
+ assert_equal @target, an.target
50
+ assert_equal @content, an.content
51
+ assert_equal @id, an.annotation_id
52
+ assert an.created_on.instance_of?(Time)
53
+ assert an.created_by.instance_of?(ROBundle::Agent)
54
+ end
55
+
56
+ def test_change_content
57
+ an = ROBundle::Annotation.new(@json)
58
+ new_content = "/file.txt"
59
+ an.content = new_content
60
+
61
+ assert_equal new_content, an.content
62
+ end
63
+
64
+ def test_generate_annotation_id
65
+ an = ROBundle::Annotation.new(@target)
66
+ id = an.annotation_id
67
+
68
+ assert id.instance_of?(String)
69
+ assert id.start_with?("urn:uuid:")
70
+ assert_same id, an.annotation_id
71
+ end
72
+
73
+ def test_json_output
74
+ agent = ROBundle::Annotation.new(@json)
75
+ json = JSON.parse(JSON.generate(agent))
76
+
77
+ assert_equal @target, json["about"]
78
+ assert_equal @content, json["content"]
79
+ assert_equal @id, json["annotation"]
80
+ assert_equal @time, json["createdOn"]
81
+ assert_equal @creator, json["createdBy"]["name"]
82
+ end
83
+
84
+ end
data/test/tc_create.rb ADDED
@@ -0,0 +1,170 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2014 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Author: Robert Haines
7
+ #------------------------------------------------------------------------------
8
+
9
+ require "test/unit"
10
+ require "tmpdir"
11
+ require "ro-bundle"
12
+
13
+ require "helpers/list_tests"
14
+
15
+ class TestCreation < Test::Unit::TestCase
16
+
17
+ def test_create_empty_bundle
18
+ Dir.mktmpdir do |dir|
19
+ filename = File.join(dir, "test.bundle")
20
+
21
+ assert_nothing_raised do
22
+ ROBundle::File.create(filename) do |b|
23
+ assert(b.on_disk?)
24
+ refute(b.in_memory?)
25
+ refute b.commit_required?
26
+
27
+ assert(b.find_entry("mimetype").local_header_offset == 0)
28
+ assert_equal("application/vnd.wf4ever.robundle+zip", b.mimetype)
29
+
30
+ # Try and get something from the manifest before it exists
31
+ assert_nothing_raised(Errno::ENOENT) do
32
+ b.id
33
+ end
34
+
35
+ # Manifest has been accessed so has been populated with defaults.
36
+ assert b.commit_required?
37
+
38
+ b.file.open(".ro/manifest.json", "w") do |m|
39
+ m.puts "{ }"
40
+ end
41
+ end
42
+ end
43
+
44
+ assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::ZipError) do
45
+ ROBundle::File.verify!(filename)
46
+ end
47
+ end
48
+ end
49
+
50
+ def test_add_file_aggregates
51
+ Dir.mktmpdir do |dir|
52
+ filename = File.join(dir, "test.bundle")
53
+
54
+ entry1 = "test1.json"
55
+ entry2 = "test2.json"
56
+ entry3 = "test3.json"
57
+
58
+ assert_nothing_raised do
59
+ ROBundle::File.create(filename) do |b|
60
+ assert b.aggregates.empty?
61
+ assert_nil b.find_entry(entry1)
62
+ assert b.commit_required?
63
+
64
+ agg = b.add(entry1, $man_ex3, :aggregate => false)
65
+ assert b.aggregates.empty?
66
+ assert_not_nil b.find_entry(entry1)
67
+ assert b.commit_required?
68
+ assert_nil agg
69
+
70
+ agg = b.add(entry2, $man_ex3)
71
+ assert b.aggregate?(entry2)
72
+ assert_not_nil b.find_entry(entry2)
73
+ assert agg.instance_of?(ROBundle::Aggregate)
74
+
75
+ b.add_aggregate(entry3, $man_ex3)
76
+ assert b.aggregate?(entry3)
77
+ assert_not_nil b.find_entry(entry3)
78
+
79
+ new_agg = ROBundle::Aggregate.new("/#{entry1}")
80
+ b.add_aggregate(new_agg)
81
+ assert b.aggregate?(entry1)
82
+ end
83
+ end
84
+
85
+ ROBundle::File.open(filename) do |b|
86
+ refute b.aggregates.empty?
87
+ refute b.commit_required?
88
+
89
+ assert b.aggregate?(entry1)
90
+ assert_not_nil b.find_entry(entry1)
91
+
92
+ assert b.aggregate?(entry2)
93
+ assert_not_nil b.find_entry(entry2)
94
+
95
+ assert b.aggregate?(entry3)
96
+ assert_not_nil b.find_entry(entry3)
97
+ end
98
+ end
99
+ end
100
+
101
+ def test_add_uri_aggregates
102
+ Dir.mktmpdir do |dir|
103
+ filename = File.join(dir, "test.bundle")
104
+
105
+ entry1 = "http://www.example.com/example"
106
+ entry2 = URI.parse(entry1)
107
+
108
+ assert_nothing_raised do
109
+ ROBundle::File.create(filename) do |b|
110
+ agg = b.add_aggregate(entry1)
111
+ assert b.aggregate?(entry1)
112
+ assert_nil b.find_entry(entry1)
113
+ assert agg.instance_of?(ROBundle::Aggregate)
114
+
115
+ b.add_aggregate(entry2)
116
+ assert b.aggregate?(entry2)
117
+ assert_nil b.find_entry(entry2)
118
+ end
119
+ end
120
+
121
+ ROBundle::File.open(filename) do |b|
122
+ refute b.aggregates.empty?
123
+ refute b.commit_required?
124
+
125
+ assert b.aggregate?(entry1)
126
+ assert_nil b.find_entry(entry1)
127
+
128
+ assert b.aggregate?(entry2)
129
+ assert_nil b.find_entry(entry2)
130
+ end
131
+ end
132
+ end
133
+
134
+ def test_add_history
135
+ Dir.mktmpdir do |dir|
136
+ filename = File.join(dir, "test.bundle")
137
+
138
+ entry1 = "test1.json"
139
+ entry2 = ".ro/test2.json"
140
+
141
+ assert_nothing_raised do
142
+ ROBundle::File.create(filename) do |b|
143
+ assert b.history.empty?
144
+ assert_nil b.find_entry(entry1)
145
+
146
+ b.add(entry1, $man_ex3, :aggregate => false)
147
+ assert_not_nil b.find_entry(entry1)
148
+
149
+ b.add_history(entry2, $man_ex3)
150
+ assert_not_nil b.find_entry(entry2)
151
+ assert entry_in_history_list(entry2, b.history)
152
+
153
+ b.add_history(entry1)
154
+ assert entry_in_history_list(entry1, b.history)
155
+ end
156
+ end
157
+
158
+ ROBundle::File.open(filename) do |b|
159
+ refute b.history.empty?
160
+
161
+ assert entry_in_history_list(entry1, b.history)
162
+ assert_not_nil b.find_entry(entry1)
163
+
164
+ assert_not_nil b.find_entry(entry2)
165
+ assert entry_in_history_list(entry2, b.history)
166
+ end
167
+ end
168
+ end
169
+
170
+ end
@@ -0,0 +1,221 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2014 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Author: Robert Haines
7
+ #------------------------------------------------------------------------------
8
+
9
+ require 'test/unit'
10
+ require "ro-bundle"
11
+ require "helpers/fake_manifest"
12
+
13
+ class TestManifest < Test::Unit::TestCase
14
+
15
+ def setup
16
+ @manifest = FakeManifest.new($man_ex3)
17
+ end
18
+
19
+ def test_top_level
20
+ assert @manifest.context.instance_of?(Array)
21
+
22
+ assert_equal("/", @manifest.id)
23
+
24
+ assert @manifest.created_on.instance_of?(Time)
25
+ assert_nil @manifest.authored_on
26
+
27
+ creator = @manifest.created_by
28
+ assert creator.instance_of?(ROBundle::Agent)
29
+
30
+ authors = @manifest.authored_by
31
+ assert authors.instance_of?(Array)
32
+
33
+ history = @manifest.history
34
+ assert history.instance_of?(Array)
35
+ history.each do |h|
36
+ assert h.instance_of?(String)
37
+ end
38
+
39
+ aggregates = @manifest.aggregates
40
+ assert aggregates.instance_of?(Array)
41
+ aggregates.each do |a|
42
+ assert a.instance_of?(ROBundle::Aggregate)
43
+ end
44
+
45
+ annotations = @manifest.annotations
46
+ assert annotations.instance_of?(Array)
47
+ annotations.each do |a|
48
+ assert a.instance_of?(ROBundle::Annotation)
49
+ end
50
+ end
51
+
52
+ def test_ensure_copied_lists
53
+ %w(authored_by history aggregates annotations).map(&:to_sym).each do |m|
54
+ list = @manifest.send(m)
55
+ list << "new item"
56
+ assert_not_equal list, @manifest.send(m)
57
+ end
58
+ end
59
+
60
+ def test_change_context
61
+ old = @manifest.context
62
+ context = "http://example.com/context"
63
+ @manifest.add_context(context)
64
+
65
+ assert @manifest.context.include?(context)
66
+ assert @manifest.context.include?(old[0])
67
+ assert_equal old[0], @manifest.context[1]
68
+ assert @manifest.edited?
69
+ end
70
+
71
+ def test_change_id
72
+ old = @manifest.id
73
+ @manifest.id = "/new"
74
+
75
+ assert_equal "/new", @manifest.id
76
+ assert_not_equal old, @manifest.id
77
+ assert @manifest.edited?
78
+ end
79
+
80
+ def test_remove_annotation_by_object
81
+ remove = @manifest.annotations[0]
82
+ assert_equal 3, @manifest.annotations.length
83
+
84
+ @manifest.remove_annotation(remove)
85
+ assert_equal 1, @manifest.annotations.length
86
+ assert @manifest.edited?
87
+
88
+ @manifest.remove_annotation(remove)
89
+ assert_equal 1, @manifest.annotations.length
90
+ assert @manifest.edited?
91
+ end
92
+
93
+ def test_remove_annotation_by_id
94
+ id = "urn:uuid:d67466b4-3aeb-4855-8203-90febe71abdf"
95
+ assert_equal 3, @manifest.annotations.length
96
+
97
+ @manifest.remove_annotation(id)
98
+ assert_equal 1, @manifest.annotations.length
99
+ assert @manifest.edited?
100
+
101
+ @manifest.remove_annotation(id)
102
+ assert_equal 1, @manifest.annotations.length
103
+ assert @manifest.edited?
104
+ end
105
+
106
+ def test_remove_annotation_by_about
107
+ about = "/folder/soup.jpeg"
108
+ assert_equal 3, @manifest.annotations.length
109
+
110
+ @manifest.remove_annotation(about)
111
+ assert_equal 1, @manifest.annotations.length
112
+ assert @manifest.edited?
113
+
114
+ @manifest.remove_annotation(about)
115
+ assert_equal 1, @manifest.annotations.length
116
+ assert @manifest.edited?
117
+ end
118
+
119
+ def test_remove_non_existent_annotations
120
+ about = "not-here!"
121
+ id = about
122
+ assert_equal 3, @manifest.annotations.length
123
+
124
+ @manifest.remove_annotation(about)
125
+ assert_equal 3, @manifest.annotations.length
126
+ refute @manifest.edited?
127
+
128
+ @manifest.remove_annotation(id)
129
+ assert_equal 3, @manifest.annotations.length
130
+ refute @manifest.edited?
131
+ end
132
+
133
+ def test_remove_aggregate_by_object
134
+ remove = @manifest.aggregates[0]
135
+ assert_equal 4, @manifest.aggregates.length
136
+ assert_equal 3, @manifest.annotations.length
137
+
138
+ @manifest.remove_aggregate(remove)
139
+ assert_equal 3, @manifest.aggregates.length
140
+ assert_equal 1, @manifest.annotations.length
141
+ assert @manifest.edited?
142
+
143
+ @manifest.remove_aggregate(remove)
144
+ assert_equal 3, @manifest.aggregates.length
145
+ assert_equal 1, @manifest.annotations.length
146
+ assert @manifest.edited?
147
+ end
148
+
149
+ def test_remove_aggregate_by_file
150
+ remove = "/folder/soup.jpeg"
151
+ assert_equal 4, @manifest.aggregates.length
152
+ assert_equal 3, @manifest.annotations.length
153
+
154
+ @manifest.remove_aggregate(remove)
155
+ assert_equal 3, @manifest.aggregates.length
156
+ assert_equal 1, @manifest.annotations.length
157
+ assert @manifest.edited?
158
+
159
+ @manifest.remove_aggregate(remove)
160
+ assert_equal 3, @manifest.aggregates.length
161
+ assert_equal 1, @manifest.annotations.length
162
+ assert @manifest.edited?
163
+ end
164
+
165
+ def test_remove_aggregate_by_uri
166
+ remove = "http://example.com/blog/"
167
+ assert_equal 4, @manifest.aggregates.length
168
+ assert_equal 3, @manifest.annotations.length
169
+
170
+ @manifest.remove_aggregate(remove)
171
+ assert_equal 3, @manifest.aggregates.length
172
+ assert_equal 3, @manifest.annotations.length
173
+ assert @manifest.edited?
174
+
175
+ @manifest.remove_aggregate(remove)
176
+ assert_equal 3, @manifest.aggregates.length
177
+ assert_equal 3, @manifest.annotations.length
178
+ assert @manifest.edited?
179
+ end
180
+
181
+ def test_remove_non_existent_aggregates
182
+ file = "not-here!"
183
+ uri = "http://example.com/not-here"
184
+ assert_equal 4, @manifest.aggregates.length
185
+
186
+ @manifest.remove_aggregate(file)
187
+ assert_equal 4, @manifest.aggregates.length
188
+ refute @manifest.edited?
189
+
190
+ @manifest.remove_aggregate(uri)
191
+ assert_equal 4, @manifest.aggregates.length
192
+ refute @manifest.edited?
193
+ end
194
+
195
+ def test_empty_manifest
196
+ manifest = FakeManifest.new($man_empty)
197
+
198
+ assert manifest.context.instance_of?(Array)
199
+ assert manifest.edited?
200
+
201
+ assert_equal("/", manifest.id)
202
+
203
+ assert_nil manifest.created_on
204
+ assert_nil manifest.authored_on
205
+ assert_nil manifest.created_by
206
+ assert manifest.authored_by.instance_of?(Array)
207
+
208
+ assert manifest.history.instance_of?(Array)
209
+ assert manifest.aggregates.instance_of?(Array)
210
+ assert manifest.annotations.instance_of?(Array)
211
+ end
212
+
213
+ def test_invalid_manifest
214
+ manifest = FakeManifest.new($man_invalid)
215
+
216
+ assert_raises(JSON::ParserError) do
217
+ assert manifest.context.instance_of?(Array)
218
+ end
219
+ end
220
+
221
+ end