pho 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/CHANGES +9 -0
  2. data/Rakefile +2 -1
  3. data/bin/talis_store +263 -0
  4. data/doc/rdoc/classes/Pho.html +3 -21
  5. data/doc/rdoc/classes/Pho/Analyzers.html +22 -0
  6. data/doc/rdoc/classes/Pho/DatatypeProperty.html +42 -10
  7. data/doc/rdoc/classes/Pho/Etags.html +102 -30
  8. data/doc/rdoc/classes/Pho/Facet/Results.html +81 -7
  9. data/doc/rdoc/classes/Pho/Facet/Term.html +13 -2
  10. data/doc/rdoc/classes/Pho/FieldPredicateMap.html +233 -30
  11. data/doc/rdoc/classes/Pho/FieldWeighting.html +38 -10
  12. data/doc/rdoc/classes/Pho/Job.html +488 -9
  13. data/doc/rdoc/classes/Pho/JobUpdate.html +141 -0
  14. data/doc/rdoc/classes/Pho/Jobs.html +538 -0
  15. data/doc/rdoc/classes/Pho/Namespaces.html +33 -2
  16. data/doc/rdoc/classes/Pho/QueryProfile.html +162 -20
  17. data/doc/rdoc/classes/Pho/RDFCollection.html +200 -60
  18. data/doc/rdoc/classes/Pho/Snapshot.html +162 -36
  19. data/doc/rdoc/classes/Pho/Status.html +59 -8
  20. data/doc/rdoc/classes/Pho/Store.html +589 -253
  21. data/doc/rdoc/created.rid +1 -1
  22. data/doc/rdoc/files/CHANGES.html +24 -1
  23. data/doc/rdoc/files/lib/pho/field_predicate_map_rb.html +1 -1
  24. data/doc/rdoc/files/lib/pho/job_rb.html +1 -1
  25. data/doc/rdoc/files/lib/pho/snapshot_rb.html +2 -1
  26. data/doc/rdoc/files/lib/pho/status_rb.html +1 -1
  27. data/doc/rdoc/files/lib/pho/store_rb.html +1 -1
  28. data/doc/rdoc/files/lib/pho_rb.html +2 -1
  29. data/doc/rdoc/fr_class_index.html +2 -0
  30. data/doc/rdoc/fr_method_index.html +85 -68
  31. data/lib/pho.rb +18 -10
  32. data/lib/pho/field_predicate_map.rb +6 -1
  33. data/lib/pho/job.rb +326 -6
  34. data/lib/pho/snapshot.rb +46 -19
  35. data/lib/pho/store.rb +22 -56
  36. data/tests/tc_job.rb +262 -0
  37. data/tests/tc_jobcontrol.rb +159 -12
  38. data/tests/tc_snapshots.rb +57 -28
  39. data/tests/ts_pho.rb +1 -0
  40. metadata +9 -110
  41. data/doc/rdoc/classes/Pho/DatatypeProperty.src/M000034.html +0 -21
  42. data/doc/rdoc/classes/Pho/DatatypeProperty.src/M000035.html +0 -29
  43. data/doc/rdoc/classes/Pho/Etags.src/M000088.html +0 -23
  44. data/doc/rdoc/classes/Pho/Etags.src/M000089.html +0 -28
  45. data/doc/rdoc/classes/Pho/Etags.src/M000090.html +0 -21
  46. data/doc/rdoc/classes/Pho/Etags.src/M000091.html +0 -18
  47. data/doc/rdoc/classes/Pho/Etags.src/M000092.html +0 -18
  48. data/doc/rdoc/classes/Pho/Etags.src/M000093.html +0 -18
  49. data/doc/rdoc/classes/Pho/Facet/Results.src/M000001.html +0 -20
  50. data/doc/rdoc/classes/Pho/Facet/Results.src/M000002.html +0 -27
  51. data/doc/rdoc/classes/Pho/Facet/Results.src/M000003.html +0 -54
  52. data/doc/rdoc/classes/Pho/Facet/Term.src/M000004.html +0 -20
  53. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000005.html +0 -38
  54. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000006.html +0 -28
  55. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000007.html +0 -20
  56. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000008.html +0 -18
  57. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000009.html +0 -23
  58. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000010.html +0 -23
  59. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000011.html +0 -18
  60. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000012.html +0 -18
  61. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000013.html +0 -18
  62. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000014.html +0 -18
  63. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000015.html +0 -18
  64. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000016.html +0 -21
  65. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000017.html +0 -21
  66. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000018.html +0 -38
  67. data/doc/rdoc/classes/Pho/FieldPredicateMap.src/M000019.html +0 -18
  68. data/doc/rdoc/classes/Pho/FieldWeighting.src/M000075.html +0 -20
  69. data/doc/rdoc/classes/Pho/FieldWeighting.src/M000076.html +0 -26
  70. data/doc/rdoc/classes/Pho/Job.src/M000074.html +0 -21
  71. data/doc/rdoc/classes/Pho/QueryProfile.src/M000024.html +0 -39
  72. data/doc/rdoc/classes/Pho/QueryProfile.src/M000025.html +0 -24
  73. data/doc/rdoc/classes/Pho/QueryProfile.src/M000026.html +0 -20
  74. data/doc/rdoc/classes/Pho/QueryProfile.src/M000027.html +0 -18
  75. data/doc/rdoc/classes/Pho/QueryProfile.src/M000028.html +0 -18
  76. data/doc/rdoc/classes/Pho/QueryProfile.src/M000029.html +0 -21
  77. data/doc/rdoc/classes/Pho/QueryProfile.src/M000030.html +0 -18
  78. data/doc/rdoc/classes/Pho/QueryProfile.src/M000031.html +0 -18
  79. data/doc/rdoc/classes/Pho/QueryProfile.src/M000032.html +0 -38
  80. data/doc/rdoc/classes/Pho/QueryProfile.src/M000033.html +0 -18
  81. data/doc/rdoc/classes/Pho/RDFCollection.src/M000077.html +0 -23
  82. data/doc/rdoc/classes/Pho/RDFCollection.src/M000078.html +0 -22
  83. data/doc/rdoc/classes/Pho/RDFCollection.src/M000079.html +0 -24
  84. data/doc/rdoc/classes/Pho/RDFCollection.src/M000080.html +0 -23
  85. data/doc/rdoc/classes/Pho/RDFCollection.src/M000081.html +0 -18
  86. data/doc/rdoc/classes/Pho/RDFCollection.src/M000082.html +0 -22
  87. data/doc/rdoc/classes/Pho/RDFCollection.src/M000083.html +0 -22
  88. data/doc/rdoc/classes/Pho/RDFCollection.src/M000084.html +0 -26
  89. data/doc/rdoc/classes/Pho/RDFCollection.src/M000085.html +0 -23
  90. data/doc/rdoc/classes/Pho/RDFCollection.src/M000086.html +0 -18
  91. data/doc/rdoc/classes/Pho/RDFCollection.src/M000087.html +0 -18
  92. data/doc/rdoc/classes/Pho/Snapshot.src/M000070.html +0 -31
  93. data/doc/rdoc/classes/Pho/Snapshot.src/M000071.html +0 -21
  94. data/doc/rdoc/classes/Pho/Snapshot.src/M000072.html +0 -18
  95. data/doc/rdoc/classes/Pho/Snapshot.src/M000073.html +0 -37
  96. data/doc/rdoc/classes/Pho/Status.src/M000020.html +0 -20
  97. data/doc/rdoc/classes/Pho/Status.src/M000021.html +0 -31
  98. data/doc/rdoc/classes/Pho/Status.src/M000022.html +0 -18
  99. data/doc/rdoc/classes/Pho/Status.src/M000023.html +0 -18
  100. data/doc/rdoc/classes/Pho/Store.src/M000036.html +0 -22
  101. data/doc/rdoc/classes/Pho/Store.src/M000037.html +0 -18
  102. data/doc/rdoc/classes/Pho/Store.src/M000038.html +0 -25
  103. data/doc/rdoc/classes/Pho/Store.src/M000039.html +0 -20
  104. data/doc/rdoc/classes/Pho/Store.src/M000040.html +0 -20
  105. data/doc/rdoc/classes/Pho/Store.src/M000041.html +0 -28
  106. data/doc/rdoc/classes/Pho/Store.src/M000042.html +0 -23
  107. data/doc/rdoc/classes/Pho/Store.src/M000043.html +0 -18
  108. data/doc/rdoc/classes/Pho/Store.src/M000044.html +0 -18
  109. data/doc/rdoc/classes/Pho/Store.src/M000045.html +0 -18
  110. data/doc/rdoc/classes/Pho/Store.src/M000046.html +0 -18
  111. data/doc/rdoc/classes/Pho/Store.src/M000047.html +0 -23
  112. data/doc/rdoc/classes/Pho/Store.src/M000048.html +0 -22
  113. data/doc/rdoc/classes/Pho/Store.src/M000049.html +0 -26
  114. data/doc/rdoc/classes/Pho/Store.src/M000050.html +0 -24
  115. data/doc/rdoc/classes/Pho/Store.src/M000051.html +0 -20
  116. data/doc/rdoc/classes/Pho/Store.src/M000052.html +0 -20
  117. data/doc/rdoc/classes/Pho/Store.src/M000053.html +0 -25
  118. data/doc/rdoc/classes/Pho/Store.src/M000054.html +0 -20
  119. data/doc/rdoc/classes/Pho/Store.src/M000055.html +0 -30
  120. data/doc/rdoc/classes/Pho/Store.src/M000056.html +0 -21
  121. data/doc/rdoc/classes/Pho/Store.src/M000057.html +0 -23
  122. data/doc/rdoc/classes/Pho/Store.src/M000058.html +0 -28
  123. data/doc/rdoc/classes/Pho/Store.src/M000059.html +0 -18
  124. data/doc/rdoc/classes/Pho/Store.src/M000060.html +0 -18
  125. data/doc/rdoc/classes/Pho/Store.src/M000061.html +0 -18
  126. data/doc/rdoc/classes/Pho/Store.src/M000062.html +0 -31
  127. data/doc/rdoc/classes/Pho/Store.src/M000063.html +0 -21
  128. data/doc/rdoc/classes/Pho/Store.src/M000064.html +0 -20
  129. data/doc/rdoc/classes/Pho/Store.src/M000065.html +0 -20
  130. data/doc/rdoc/classes/Pho/Store.src/M000066.html +0 -20
  131. data/doc/rdoc/classes/Pho/Store.src/M000067.html +0 -20
  132. data/doc/rdoc/classes/Pho/Store.src/M000068.html +0 -20
  133. data/doc/rdoc/classes/Pho/Store.src/M000069.html +0 -20
@@ -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 = store.build_job_request(Time.now, "http://www.example.org/ns/jobtype", "test label")
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 = store.submit_job("http://www.example.org/ns/jobtype", "test label")
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::JOB_RESET, "Reset my store" )
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 = store.reset()
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::JOB_REINDEX, "Reindex my store" )
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 = store.reindex()
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::JOB_SNAPSHOT, "Snapshot my store" )
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 = store.snapshot()
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::JOB_RESTORE, "Restore my store" )
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 = store.restore("http://www.example.com.tar")
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
@@ -6,23 +6,27 @@ require 'tmpdir'
6
6
 
7
7
  class SnapshotsTest < Test::Unit::TestCase
8
8
 
9
- def setup()
10
- @snapshot = <<-EOL
11
- <?xml version="1.0" encoding="UTF-8"?><html xmlns:bf="http://schemas.talis.com/2006/bigfoot/configuration#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/elements/1.1/"><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>Snapshots</title><style type="text/css">
12
-
13
- </style></head><body><div id="wrap"><div id="content"><div class="gutter"><h1>Snapshots for this store</h1><ul class="xoxo"><li><span class="field-name"><a href="http://api.talis.com/stores/test-store/snapshots/20090222113727.tar">http://api.talis.com/stores/test-store/snapshots/20090222113727.tar</a>
14
- - <a href="http://api.talis.com/stores/test-store/snapshots/20090222113727.tar.md5">MD5</a>
15
- - 30 KB
16
- - 11:37 22-February-2009</span></li></ul></div><ul id="footer"><li id="learn"><a href="http://n2.talis.com/wiki/Platform_API">learn more</a></li></ul></div></div></body></html>
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
- # File.delete(f)
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, 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 test_parse_snapshots()
43
+ def test_read_from_store()
40
44
 
41
45
  mc = mock()
42
- mc.expects(:status).returns(200)
43
- mc.expects(:content).returns(@snapshot)
44
-
45
- snapshot = Pho::Snapshot.parse(mc)
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
- assert_equal(true, snapshot != nil)
48
- assert_equal("http://api.talis.com/stores/test-store/snapshots/20090222113727.tar", snapshot.url)
49
- assert_equal("http://api.talis.com/stores/test-store/snapshots/20090222113727.tar.md5", snapshot.md5_url)
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 test_parse_snapshots_raises_exception()
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(:status).at_least_once.returns(500)
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 test_download()
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
- 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")
73
-
74
- snapshot.download(Dir.tmpdir, mc)
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
@@ -12,4 +12,5 @@ require 'tc_facet.rb'
12
12
  require 'tc_search.rb'
13
13
  require 'tc_sparql.rb'
14
14
  require 'tc_status.rb'
15
+ require 'tc_job.rb'
15
16
  require 'tc_rdf_collection.rb'
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.3"
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-03-13 00:00:00 +00:00
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/Etags.src
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.2.0
158
+ rubygems_version: 1.3.1
260
159
  signing_key:
261
160
  specification_version: 2
262
161
  summary: Ruby client for the Talis Platform