pho 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +9 -0
- data/Rakefile +2 -1
- data/bin/talis_store +263 -0
- data/doc/rdoc/classes/Pho.html +3 -21
- data/doc/rdoc/classes/Pho/Analyzers.html +22 -0
- data/doc/rdoc/classes/Pho/DatatypeProperty.html +42 -10
- data/doc/rdoc/classes/Pho/Etags.html +102 -30
- data/doc/rdoc/classes/Pho/Facet/Results.html +81 -7
- data/doc/rdoc/classes/Pho/Facet/Term.html +13 -2
- data/doc/rdoc/classes/Pho/FieldPredicateMap.html +233 -30
- data/doc/rdoc/classes/Pho/FieldWeighting.html +38 -10
- data/doc/rdoc/classes/Pho/Job.html +488 -9
- data/doc/rdoc/classes/Pho/JobUpdate.html +141 -0
- data/doc/rdoc/classes/Pho/Jobs.html +538 -0
- data/doc/rdoc/classes/Pho/Namespaces.html +33 -2
- data/doc/rdoc/classes/Pho/QueryProfile.html +162 -20
- data/doc/rdoc/classes/Pho/RDFCollection.html +200 -60
- data/doc/rdoc/classes/Pho/Snapshot.html +162 -36
- data/doc/rdoc/classes/Pho/Status.html +59 -8
- data/doc/rdoc/classes/Pho/Store.html +589 -253
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/CHANGES.html +24 -1
- data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/job_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/snapshot_rb.html +2 -1
- data/doc/rdoc/files/lib/pho/status_rb.html +1 -1
- data/doc/rdoc/files/lib/pho/store_rb.html +1 -1
- data/doc/rdoc/files/lib/pho_rb.html +2 -1
- data/doc/rdoc/fr_class_index.html +2 -0
- data/doc/rdoc/fr_method_index.html +85 -68
- data/lib/pho.rb +18 -10
- data/lib/pho/field_predicate_map.rb +6 -1
- data/lib/pho/job.rb +326 -6
- data/lib/pho/snapshot.rb +46 -19
- data/lib/pho/store.rb +22 -56
- data/tests/tc_job.rb +262 -0
- data/tests/tc_jobcontrol.rb +159 -12
- data/tests/tc_snapshots.rb +57 -28
- data/tests/ts_pho.rb +1 -0
- metadata +9 -110
- data/doc/rdoc/classes/Pho/DatatypeProperty.src/M000034.html +0 -21
- data/doc/rdoc/classes/Pho/DatatypeProperty.src/M000035.html +0 -29
- data/doc/rdoc/classes/Pho/Etags.src/M000088.html +0 -23
- data/doc/rdoc/classes/Pho/Etags.src/M000089.html +0 -28
- data/doc/rdoc/classes/Pho/Etags.src/M000090.html +0 -21
- data/doc/rdoc/classes/Pho/Etags.src/M000091.html +0 -18
- data/doc/rdoc/classes/Pho/Etags.src/M000092.html +0 -18
- data/doc/rdoc/classes/Pho/Etags.src/M000093.html +0 -18
- data/doc/rdoc/classes/Pho/Facet/Results.src/M000001.html +0 -20
- data/doc/rdoc/classes/Pho/Facet/Results.src/M000002.html +0 -27
- data/doc/rdoc/classes/Pho/Facet/Results.src/M000003.html +0 -54
- data/doc/rdoc/classes/Pho/Facet/Term.src/M000004.html +0 -20
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000005.html +0 -38
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000006.html +0 -28
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000007.html +0 -20
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000008.html +0 -18
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000009.html +0 -23
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000010.html +0 -23
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000011.html +0 -18
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000012.html +0 -18
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000013.html +0 -18
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000014.html +0 -18
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000015.html +0 -18
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000016.html +0 -21
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000017.html +0 -21
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000018.html +0 -38
- data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000019.html +0 -18
- data/doc/rdoc/classes/Pho/FieldWeighting.src/M000075.html +0 -20
- data/doc/rdoc/classes/Pho/FieldWeighting.src/M000076.html +0 -26
- data/doc/rdoc/classes/Pho/Job.src/M000074.html +0 -21
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000024.html +0 -39
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000025.html +0 -24
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000026.html +0 -20
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000027.html +0 -18
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000028.html +0 -18
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000029.html +0 -21
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000030.html +0 -18
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000031.html +0 -18
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000032.html +0 -38
- data/doc/rdoc/classes/Pho/QueryProfile.src/M000033.html +0 -18
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000077.html +0 -23
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000078.html +0 -22
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000079.html +0 -24
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000080.html +0 -23
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000081.html +0 -18
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000082.html +0 -22
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000083.html +0 -22
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000084.html +0 -26
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000085.html +0 -23
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000086.html +0 -18
- data/doc/rdoc/classes/Pho/RDFCollection.src/M000087.html +0 -18
- data/doc/rdoc/classes/Pho/Snapshot.src/M000070.html +0 -31
- data/doc/rdoc/classes/Pho/Snapshot.src/M000071.html +0 -21
- data/doc/rdoc/classes/Pho/Snapshot.src/M000072.html +0 -18
- data/doc/rdoc/classes/Pho/Snapshot.src/M000073.html +0 -37
- data/doc/rdoc/classes/Pho/Status.src/M000020.html +0 -20
- data/doc/rdoc/classes/Pho/Status.src/M000021.html +0 -31
- data/doc/rdoc/classes/Pho/Status.src/M000022.html +0 -18
- data/doc/rdoc/classes/Pho/Status.src/M000023.html +0 -18
- data/doc/rdoc/classes/Pho/Store.src/M000036.html +0 -22
- data/doc/rdoc/classes/Pho/Store.src/M000037.html +0 -18
- data/doc/rdoc/classes/Pho/Store.src/M000038.html +0 -25
- data/doc/rdoc/classes/Pho/Store.src/M000039.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000040.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000041.html +0 -28
- data/doc/rdoc/classes/Pho/Store.src/M000042.html +0 -23
- data/doc/rdoc/classes/Pho/Store.src/M000043.html +0 -18
- data/doc/rdoc/classes/Pho/Store.src/M000044.html +0 -18
- data/doc/rdoc/classes/Pho/Store.src/M000045.html +0 -18
- data/doc/rdoc/classes/Pho/Store.src/M000046.html +0 -18
- data/doc/rdoc/classes/Pho/Store.src/M000047.html +0 -23
- data/doc/rdoc/classes/Pho/Store.src/M000048.html +0 -22
- data/doc/rdoc/classes/Pho/Store.src/M000049.html +0 -26
- data/doc/rdoc/classes/Pho/Store.src/M000050.html +0 -24
- data/doc/rdoc/classes/Pho/Store.src/M000051.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000052.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000053.html +0 -25
- data/doc/rdoc/classes/Pho/Store.src/M000054.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000055.html +0 -30
- data/doc/rdoc/classes/Pho/Store.src/M000056.html +0 -21
- data/doc/rdoc/classes/Pho/Store.src/M000057.html +0 -23
- data/doc/rdoc/classes/Pho/Store.src/M000058.html +0 -28
- data/doc/rdoc/classes/Pho/Store.src/M000059.html +0 -18
- data/doc/rdoc/classes/Pho/Store.src/M000060.html +0 -18
- data/doc/rdoc/classes/Pho/Store.src/M000061.html +0 -18
- data/doc/rdoc/classes/Pho/Store.src/M000062.html +0 -31
- data/doc/rdoc/classes/Pho/Store.src/M000063.html +0 -21
- data/doc/rdoc/classes/Pho/Store.src/M000064.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000065.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000066.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000067.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000068.html +0 -20
- data/doc/rdoc/classes/Pho/Store.src/M000069.html +0 -20
data/tests/tc_jobcontrol.rb
CHANGED
@@ -6,8 +6,8 @@ require 'mocha'
|
|
6
6
|
class JobControlTest < Test::Unit::TestCase
|
7
7
|
|
8
8
|
def test_build_job_request
|
9
|
-
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
10
|
-
job_req =
|
9
|
+
#store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass")
|
10
|
+
job_req = Pho::Jobs.build_job_request("http://www.example.org/ns/jobtype", "test label", Time.now)
|
11
11
|
|
12
12
|
assert_equal(true, job_req.index( "<rdfs:label>test label</rdfs:label>") != nil )
|
13
13
|
assert_equal(true, job_req.index( "rdf:resource=\"""http://www.example.org/ns/jobtype\"""/>") != nil )
|
@@ -30,36 +30,183 @@ class JobControlTest < Test::Unit::TestCase
|
|
30
30
|
set_expectations("http://api.talis.com/stores/testing", mc, "http://www.example.org/ns/jobtype", "test label" )
|
31
31
|
|
32
32
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
33
|
-
job_req =
|
33
|
+
job_req = Pho::Jobs.submit_job(store, "http://www.example.org/ns/jobtype", "test label")
|
34
34
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_reset
|
38
38
|
mc = mock()
|
39
|
-
set_expectations("http://api.talis.com/stores/testing", mc, Pho::
|
39
|
+
set_expectations("http://api.talis.com/stores/testing", mc, Pho::Jobs::RESET, "Reset my store" )
|
40
40
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
41
|
-
job_req =
|
41
|
+
job_req = Pho::Jobs.submit_reset(store)
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_reindex
|
45
45
|
mc = mock()
|
46
|
-
set_expectations("http://api.talis.com/stores/testing", mc, Pho::
|
46
|
+
set_expectations("http://api.talis.com/stores/testing", mc, Pho::Jobs::REINDEX, "Reindex my store" )
|
47
47
|
|
48
48
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
49
|
-
job_req =
|
49
|
+
job_req = Pho::Jobs.submit_reindex(store)
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_snapshot
|
53
53
|
mc = mock()
|
54
|
-
set_expectations("http://api.talis.com/stores/testing", mc, Pho::
|
54
|
+
set_expectations("http://api.talis.com/stores/testing", mc, Pho::Jobs::SNAPSHOT, "Snapshot my store" )
|
55
55
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
56
|
-
job_req =
|
56
|
+
job_req = Pho::Jobs.submit_snapshot(store)
|
57
57
|
end
|
58
58
|
|
59
59
|
def test_restore
|
60
60
|
mc = mock()
|
61
|
-
set_expectations("http://api.talis.com/stores/testing", mc, Pho::
|
61
|
+
set_expectations("http://api.talis.com/stores/testing", mc, Pho::Jobs::RESTORE, "Restore my snapshot" )
|
62
62
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
63
|
-
job_req =
|
64
|
-
end
|
63
|
+
job_req = Pho::Jobs.submit_restore(store,"http://www.example.com.tar")
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_yield_job_updates_requires_block
|
67
|
+
mc = mock()
|
68
|
+
updates = Pho::Jobs.yield_job_update(mc, 0)
|
69
|
+
assert_equal(0, updates)
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_yield_job_updates_does_not_yield_if_not_started
|
74
|
+
mc = mock()
|
75
|
+
mc.expects(:started?).returns(false)
|
76
|
+
|
77
|
+
updates = Pho::Jobs.yield_job_update(mc, 0) do |job, message, time|
|
78
|
+
raise
|
79
|
+
end
|
80
|
+
|
81
|
+
assert_equal(0, updates)
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_yield_job_updates_yields_if_started
|
86
|
+
mc = mock()
|
87
|
+
mc.expects(:started?).returns(true)
|
88
|
+
mc.expects(:start_message).returns("Started")
|
89
|
+
mc.expects(:actual_start_time).returns("2009-01-30T16:35:00Z")
|
90
|
+
mc.expects(:progress_updates).returns(Array.new)
|
91
|
+
mc.expects(:completed?).returns(false)
|
92
|
+
|
93
|
+
updates = Pho::Jobs.yield_job_update(mc, 0) do |job, message, time|
|
94
|
+
assert_equal("Started", message)
|
95
|
+
assert_equal("2009-01-30T16:35:00Z", time)
|
96
|
+
end
|
97
|
+
|
98
|
+
assert_equal(0, updates)
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_yield_job_updates_yields_progress_updates
|
103
|
+
mc = mock()
|
104
|
+
mc.expects(:started?).returns(true)
|
105
|
+
mc.expects(:start_message).returns("Started")
|
106
|
+
mc.expects(:actual_start_time).returns("2009-01-30T16:35:00Z")
|
107
|
+
|
108
|
+
updates = Array.new
|
109
|
+
update = Pho::JobUpdate.new
|
110
|
+
update.message = "Update"
|
111
|
+
update.time = "2009-01-30T16:40:00Z"
|
112
|
+
updates << update
|
113
|
+
|
114
|
+
mc.expects(:progress_updates).at_least_once().returns(updates)
|
115
|
+
mc.expects(:completed?).returns(false)
|
116
|
+
|
117
|
+
calls = 0
|
118
|
+
updates = Pho::Jobs.yield_job_update(mc, 0) do |job, message, time|
|
119
|
+
if calls == 0
|
120
|
+
assert_equal("Started", message)
|
121
|
+
assert_equal("2009-01-30T16:35:00Z", time)
|
122
|
+
calls += 1
|
123
|
+
elsif calls == 1
|
124
|
+
assert_equal("Update", message)
|
125
|
+
assert_equal("2009-01-30T16:40:00Z", time)
|
126
|
+
calls += 1
|
127
|
+
else
|
128
|
+
raise
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
assert_equal(1, updates)
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_yield_job_updates_yields_completion_message
|
137
|
+
mc = mock()
|
138
|
+
mc.expects(:started?).returns(true)
|
139
|
+
mc.expects(:start_message).returns("Started")
|
140
|
+
mc.expects(:actual_start_time).returns("2009-01-30T16:35:00Z")
|
141
|
+
|
142
|
+
updates = Array.new
|
143
|
+
update = Pho::JobUpdate.new
|
144
|
+
update.message = "Update"
|
145
|
+
update.time = "2009-01-30T16:40:00Z"
|
146
|
+
updates << update
|
147
|
+
|
148
|
+
mc.expects(:progress_updates).at_least_once().returns(updates)
|
149
|
+
mc.expects(:completed?).returns(true)
|
150
|
+
mc.expects(:completion_message).returns("Completed")
|
151
|
+
mc.expects(:end_time).returns("2009-01-30T16:45:00Z")
|
152
|
+
|
153
|
+
calls = 0
|
154
|
+
updates = Pho::Jobs.yield_job_update(mc, 0) do |job, message, time|
|
155
|
+
if calls == 0
|
156
|
+
assert_equal("Started", message)
|
157
|
+
assert_equal("2009-01-30T16:35:00Z", time)
|
158
|
+
calls += 1
|
159
|
+
elsif calls == 1
|
160
|
+
assert_equal("Update", message)
|
161
|
+
assert_equal("2009-01-30T16:40:00Z", time)
|
162
|
+
calls += 1
|
163
|
+
elsif calls == 2
|
164
|
+
assert_equal("Completed", message)
|
165
|
+
assert_equal("2009-01-30T16:45:00Z", time)
|
166
|
+
calls += 1
|
167
|
+
else
|
168
|
+
raise
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
assert_equal(1, updates)
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_yield_job_updates_yields_only_unseen_updates
|
177
|
+
mc = mock()
|
178
|
+
mc.expects(:started?).returns(true)
|
179
|
+
|
180
|
+
updates = Array.new
|
181
|
+
|
182
|
+
5.times do |i|
|
183
|
+
update = Pho::JobUpdate.new
|
184
|
+
update.message = "Update #{i+1}"
|
185
|
+
update.time = "2009-01-30T16:40:00Z"
|
186
|
+
updates << update
|
187
|
+
end
|
188
|
+
|
189
|
+
mc.expects(:progress_updates).at_least_once().returns(updates)
|
190
|
+
mc.expects(:completed?).returns(false)
|
191
|
+
|
192
|
+
calls = 0
|
193
|
+
msgs = Pho::Jobs.yield_job_update(mc, 2) do |job, message, time|
|
194
|
+
if calls == 0
|
195
|
+
assert_equal("Update 3", message)
|
196
|
+
calls += 1
|
197
|
+
elsif calls == 1
|
198
|
+
assert_equal("Update 4", message)
|
199
|
+
calls += 1
|
200
|
+
elsif calls == 2
|
201
|
+
assert_equal("Update 5", message)
|
202
|
+
calls += 1
|
203
|
+
else
|
204
|
+
raise
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
assert_equal(5, msgs)
|
209
|
+
|
210
|
+
end
|
211
|
+
|
65
212
|
end
|
data/tests/tc_snapshots.rb
CHANGED
@@ -6,23 +6,27 @@ require 'tmpdir'
|
|
6
6
|
|
7
7
|
class SnapshotsTest < Test::Unit::TestCase
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
SNAPSHOT = <<-EOL
|
10
|
+
<rdf:RDF
|
11
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
12
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
13
|
+
xmlns:j.0="http://schemas.talis.com/2006/bigfoot/configuration#" >
|
14
|
+
<rdf:Description rdf:about="http://api.talis.com/stores/testing">
|
15
|
+
<j.0:snapshot rdf:resource="http://api.talis.com/stores/testing/snapshots/20090222113727.tar"/>
|
16
|
+
</rdf:Description>
|
17
|
+
<rdf:Description rdf:about="http://api.talis.com/stores/testing/snapshots/20090222113727.tar">
|
18
|
+
<j.0:md5 rdf:resource="http://api.talis.com/stores/testing/snapshots/20090222113727.tar.md5"/>
|
19
|
+
<j.0:filesize>30 KB</j.0:filesize>
|
20
|
+
<dc:date>11:37 22-February-2009</dc:date>
|
21
|
+
</rdf:Description>
|
22
|
+
</rdf:RDF>
|
17
23
|
EOL
|
18
|
-
|
19
|
-
end
|
20
|
-
|
24
|
+
|
21
25
|
def teardown()
|
22
26
|
|
23
27
|
f = File.join(Dir.tmpdir, "2009022213727.tar")
|
24
28
|
if File.exists?(f)
|
25
|
-
|
29
|
+
File.delete(f)
|
26
30
|
end
|
27
31
|
|
28
32
|
end
|
@@ -30,46 +34,71 @@ EOL
|
|
30
34
|
def test_get_snapshots()
|
31
35
|
mc = mock()
|
32
36
|
mc.expects(:set_auth)
|
33
|
-
mc.expects(:get).with("http://api.talis.com/stores/testing/snapshots", nil,
|
37
|
+
mc.expects(:get).with("http://api.talis.com/stores/testing/snapshots", nil, Pho::ACCEPT_RDF)
|
34
38
|
|
35
39
|
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
36
40
|
response = store.get_snapshots()
|
37
41
|
end
|
38
42
|
|
39
|
-
def
|
43
|
+
def test_read_from_store()
|
40
44
|
|
41
45
|
mc = mock()
|
42
|
-
mc.expects(:
|
43
|
-
mc.expects(:
|
44
|
-
|
45
|
-
|
46
|
+
mc.expects(:set_auth)
|
47
|
+
mc.expects(:get).with("http://api.talis.com/stores/testing/snapshots",
|
48
|
+
anything, {"Accept" => "application/rdf+xml"}).returns(
|
49
|
+
HTTP::Message.new_response(SNAPSHOT) )
|
46
50
|
|
47
|
-
|
48
|
-
|
49
|
-
|
51
|
+
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
52
|
+
|
53
|
+
snapshot = Pho::Snapshot.read_from_store(store)
|
54
|
+
|
55
|
+
assert_equal("http://api.talis.com/stores/testing/snapshots/20090222113727.tar", snapshot.url)
|
56
|
+
assert_equal("http://api.talis.com/stores/testing/snapshots/20090222113727.tar.md5", snapshot.md5_url)
|
50
57
|
assert_equal("30", snapshot.size)
|
51
58
|
assert_equal("KB", snapshot.units)
|
59
|
+
|
52
60
|
end
|
53
61
|
|
54
|
-
def
|
62
|
+
def test_parse()
|
63
|
+
|
64
|
+
snapshot = Pho::Snapshot.parse("http://api.talis.com/stores/testing", SNAPSHOT)
|
65
|
+
|
66
|
+
assert_equal(true, snapshot != nil)
|
55
67
|
|
68
|
+
assert_equal("http://api.talis.com/stores/testing/snapshots/20090222113727.tar", snapshot.url)
|
69
|
+
assert_equal("http://api.talis.com/stores/testing/snapshots/20090222113727.tar.md5", snapshot.md5_url)
|
70
|
+
assert_equal("30", snapshot.size)
|
71
|
+
assert_equal("KB", snapshot.units)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_read_from_store_raises_exception()
|
75
|
+
|
76
|
+
msg = HTTP::Message.new_response("")
|
77
|
+
msg.status = 500
|
56
78
|
mc = mock()
|
57
|
-
mc.expects(:
|
79
|
+
mc.expects(:set_auth)
|
80
|
+
mc.expects(:get).with("http://api.talis.com/stores/testing/snapshots",
|
81
|
+
anything, {"Accept" => "application/rdf+xml"}).returns( msg )
|
58
82
|
|
83
|
+
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
84
|
+
|
59
85
|
assert_raise RuntimeError do
|
60
|
-
Pho::Snapshot.parse(mc)
|
61
86
|
end
|
87
|
+
snapshot = Pho::Snapshot.read_from_store(store)
|
62
88
|
end
|
63
89
|
|
64
90
|
end
|
65
91
|
|
66
|
-
def
|
92
|
+
def test_backup()
|
67
93
|
|
68
94
|
mc = mock()
|
95
|
+
mc.expects(:set_auth)
|
69
96
|
mc.expects(:get_content).with("http://api.talis.com/stores/test-store/snapshots/20090222113727.tar.md5").returns("4880c0340c65d142838ea33ace9b850a")
|
70
97
|
mc.expects(:get_content).with("http://api.talis.com/stores/test-store/snapshots/20090222113727.tar").returns("12345abcdef")
|
71
98
|
|
72
|
-
|
73
|
-
|
74
|
-
snapshot.
|
99
|
+
store = Pho::Store.new("http://api.talis.com/stores/testing", "user", "pass", mc)
|
100
|
+
|
101
|
+
snapshot = Pho::Snapshot.new("http://api.talis.com/stores/test-store/snapshots/20090222113727.tar", "http://api.talis.com/stores/test-store/snapshots/20090222113727.tar.md5", "1", "KB", "11:37 22-February-2009")
|
102
|
+
|
103
|
+
snapshot.backup(store, Dir.tmpdir)
|
75
104
|
|
76
105
|
assert_equal(true, File.exists?( File.join(Dir.tmpdir, "20090222113727.tar" ) ) )
|
77
106
|
end
|
data/tests/ts_pho.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.4"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leigh Dodds
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-06 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -44,8 +44,8 @@ dependencies:
|
|
44
44
|
version:
|
45
45
|
description: Ruby client for the Talis Platform
|
46
46
|
email: leigh.dodds@talis.com
|
47
|
-
executables:
|
48
|
-
|
47
|
+
executables:
|
48
|
+
- talis_store
|
49
49
|
extensions: []
|
50
50
|
|
51
51
|
extra_rdoc_files:
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- README
|
56
56
|
- Rakefile
|
57
57
|
- CHANGES
|
58
|
+
- bin/talis_store
|
58
59
|
- doc/index.html
|
59
60
|
- doc/rdoc
|
60
61
|
- doc/rdoc/fr_method_index.html
|
@@ -64,126 +65,23 @@ files:
|
|
64
65
|
- doc/rdoc/classes
|
65
66
|
- doc/rdoc/classes/Pho
|
66
67
|
- doc/rdoc/classes/Pho/Etags.html
|
68
|
+
- doc/rdoc/classes/Pho/Jobs.html
|
67
69
|
- doc/rdoc/classes/Pho/DatatypeProperty.html
|
68
70
|
- doc/rdoc/classes/Pho/Facet.html
|
69
|
-
- doc/rdoc/classes/Pho/
|
70
|
-
- doc/rdoc/classes/Pho/Etags.src/M000092.html
|
71
|
-
- doc/rdoc/classes/Pho/Etags.src/M000091.html
|
72
|
-
- doc/rdoc/classes/Pho/Etags.src/M000088.html
|
73
|
-
- doc/rdoc/classes/Pho/Etags.src/M000093.html
|
74
|
-
- doc/rdoc/classes/Pho/Etags.src/M000089.html
|
75
|
-
- doc/rdoc/classes/Pho/Etags.src/M000090.html
|
76
|
-
- doc/rdoc/classes/Pho/Snapshot.src
|
77
|
-
- doc/rdoc/classes/Pho/Snapshot.src/M000072.html
|
78
|
-
- doc/rdoc/classes/Pho/Snapshot.src/M000070.html
|
79
|
-
- doc/rdoc/classes/Pho/Snapshot.src/M000071.html
|
80
|
-
- doc/rdoc/classes/Pho/Snapshot.src/M000073.html
|
71
|
+
- doc/rdoc/classes/Pho/JobUpdate.html
|
81
72
|
- doc/rdoc/classes/Pho/RDFCollection.html
|
82
73
|
- doc/rdoc/classes/Pho/Job.html
|
83
|
-
- doc/rdoc/classes/Pho/QueryProfile.src
|
84
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000033.html
|
85
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000026.html
|
86
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000030.html
|
87
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000031.html
|
88
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000032.html
|
89
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000025.html
|
90
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000027.html
|
91
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000029.html
|
92
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000028.html
|
93
|
-
- doc/rdoc/classes/Pho/QueryProfile.src/M000024.html
|
94
74
|
- doc/rdoc/classes/Pho/Status.html
|
95
75
|
- doc/rdoc/classes/Pho/QueryProfile.html
|
96
76
|
- doc/rdoc/classes/Pho/Snapshot.html
|
97
77
|
- doc/rdoc/classes/Pho/FieldWeighting.html
|
98
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src
|
99
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000014.html
|
100
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000005.html
|
101
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000010.html
|
102
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000019.html
|
103
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000017.html
|
104
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000013.html
|
105
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000012.html
|
106
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000007.html
|
107
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000018.html
|
108
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000015.html
|
109
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000009.html
|
110
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000008.html
|
111
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000006.html
|
112
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000011.html
|
113
|
-
- doc/rdoc/classes/Pho/FieldPredicateMap.src/M000016.html
|
114
78
|
- doc/rdoc/classes/Pho/Namespaces.html
|
115
|
-
- doc/rdoc/classes/Pho/Store.src
|
116
|
-
- doc/rdoc/classes/Pho/Store.src/M000042.html
|
117
|
-
- doc/rdoc/classes/Pho/Store.src/M000051.html
|
118
|
-
- doc/rdoc/classes/Pho/Store.src/M000062.html
|
119
|
-
- doc/rdoc/classes/Pho/Store.src/M000055.html
|
120
|
-
- doc/rdoc/classes/Pho/Store.src/M000039.html
|
121
|
-
- doc/rdoc/classes/Pho/Store.src/M000044.html
|
122
|
-
- doc/rdoc/classes/Pho/Store.src/M000060.html
|
123
|
-
- doc/rdoc/classes/Pho/Store.src/M000049.html
|
124
|
-
- doc/rdoc/classes/Pho/Store.src/M000067.html
|
125
|
-
- doc/rdoc/classes/Pho/Store.src/M000063.html
|
126
|
-
- doc/rdoc/classes/Pho/Store.src/M000047.html
|
127
|
-
- doc/rdoc/classes/Pho/Store.src/M000057.html
|
128
|
-
- doc/rdoc/classes/Pho/Store.src/M000036.html
|
129
|
-
- doc/rdoc/classes/Pho/Store.src/M000061.html
|
130
|
-
- doc/rdoc/classes/Pho/Store.src/M000054.html
|
131
|
-
- doc/rdoc/classes/Pho/Store.src/M000045.html
|
132
|
-
- doc/rdoc/classes/Pho/Store.src/M000053.html
|
133
|
-
- doc/rdoc/classes/Pho/Store.src/M000069.html
|
134
|
-
- doc/rdoc/classes/Pho/Store.src/M000052.html
|
135
|
-
- doc/rdoc/classes/Pho/Store.src/M000065.html
|
136
|
-
- doc/rdoc/classes/Pho/Store.src/M000058.html
|
137
|
-
- doc/rdoc/classes/Pho/Store.src/M000048.html
|
138
|
-
- doc/rdoc/classes/Pho/Store.src/M000040.html
|
139
|
-
- doc/rdoc/classes/Pho/Store.src/M000037.html
|
140
|
-
- doc/rdoc/classes/Pho/Store.src/M000043.html
|
141
|
-
- doc/rdoc/classes/Pho/Store.src/M000050.html
|
142
|
-
- doc/rdoc/classes/Pho/Store.src/M000041.html
|
143
|
-
- doc/rdoc/classes/Pho/Store.src/M000066.html
|
144
|
-
- doc/rdoc/classes/Pho/Store.src/M000059.html
|
145
|
-
- doc/rdoc/classes/Pho/Store.src/M000064.html
|
146
|
-
- doc/rdoc/classes/Pho/Store.src/M000068.html
|
147
|
-
- doc/rdoc/classes/Pho/Store.src/M000038.html
|
148
|
-
- doc/rdoc/classes/Pho/Store.src/M000056.html
|
149
|
-
- doc/rdoc/classes/Pho/Store.src/M000046.html
|
150
|
-
- doc/rdoc/classes/Pho/Job.src
|
151
|
-
- doc/rdoc/classes/Pho/Job.src/M000074.html
|
152
|
-
- doc/rdoc/classes/Pho/RDFCollection.src
|
153
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000077.html
|
154
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000087.html
|
155
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000081.html
|
156
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000084.html
|
157
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000078.html
|
158
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000080.html
|
159
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000083.html
|
160
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000079.html
|
161
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000085.html
|
162
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000082.html
|
163
|
-
- doc/rdoc/classes/Pho/RDFCollection.src/M000086.html
|
164
79
|
- doc/rdoc/classes/Pho/Store.html
|
165
|
-
- doc/rdoc/classes/Pho/FieldWeighting.src
|
166
|
-
- doc/rdoc/classes/Pho/FieldWeighting.src/M000075.html
|
167
|
-
- doc/rdoc/classes/Pho/FieldWeighting.src/M000076.html
|
168
80
|
- doc/rdoc/classes/Pho/Facet
|
169
|
-
- doc/rdoc/classes/Pho/Facet/Term.src
|
170
|
-
- doc/rdoc/classes/Pho/Facet/Term.src/M000004.html
|
171
|
-
- doc/rdoc/classes/Pho/Facet/Results.src
|
172
|
-
- doc/rdoc/classes/Pho/Facet/Results.src/M000003.html
|
173
|
-
- doc/rdoc/classes/Pho/Facet/Results.src/M000001.html
|
174
|
-
- doc/rdoc/classes/Pho/Facet/Results.src/M000002.html
|
175
81
|
- doc/rdoc/classes/Pho/Facet/Results.html
|
176
82
|
- doc/rdoc/classes/Pho/Facet/Term.html
|
177
83
|
- doc/rdoc/classes/Pho/Analyzers.html
|
178
84
|
- doc/rdoc/classes/Pho/FieldPredicateMap.html
|
179
|
-
- doc/rdoc/classes/Pho/Status.src
|
180
|
-
- doc/rdoc/classes/Pho/Status.src/M000021.html
|
181
|
-
- doc/rdoc/classes/Pho/Status.src/M000020.html
|
182
|
-
- doc/rdoc/classes/Pho/Status.src/M000022.html
|
183
|
-
- doc/rdoc/classes/Pho/Status.src/M000023.html
|
184
|
-
- doc/rdoc/classes/Pho/DatatypeProperty.src
|
185
|
-
- doc/rdoc/classes/Pho/DatatypeProperty.src/M000035.html
|
186
|
-
- doc/rdoc/classes/Pho/DatatypeProperty.src/M000034.html
|
187
85
|
- doc/rdoc/classes/Pho.html
|
188
86
|
- doc/rdoc/files
|
189
87
|
- doc/rdoc/files/README.html
|
@@ -211,6 +109,7 @@ files:
|
|
211
109
|
- tests/ts_pho.rb
|
212
110
|
- tests/tc_jobcontrol.rb
|
213
111
|
- tests/tc_snapshots.rb
|
112
|
+
- tests/tc_job.rb
|
214
113
|
- tests/tc_search.rb
|
215
114
|
- tests/tc_status.rb
|
216
115
|
- tests/tc_etags.rb
|
@@ -256,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
155
|
requirements: []
|
257
156
|
|
258
157
|
rubyforge_project: pho
|
259
|
-
rubygems_version: 1.
|
158
|
+
rubygems_version: 1.3.1
|
260
159
|
signing_key:
|
261
160
|
specification_version: 2
|
262
161
|
summary: Ruby client for the Talis Platform
|