OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-cog commits / 665271d

Convert unit tests to message-passing API
665271dd7f404a9387a4526c39c13f954f5efb1a
by Linas Vepstas <linasvepstas@gmail.com> · 2026-01-19T01:31:44.000Z

Changed files (23) +324 -278

tests/persist/cog-simple/SimpleAlphaEquivUTest.cxxtest +5 -4
……@@ -32,6 +32,7 @@
3232#include <opencog/atoms/base/Node.h>
3333#include <opencog/atomspace/AtomSpace.h>
3434#include <opencog/atoms/value/FloatValue.h>
35#include <opencog/atoms/value/VoidValue.h>
3536#include <opencog/persist/cog-simple/CogSimpleStorage.h>
3637
3738#include <opencog/util/Logger.h>
……@@ -129,7 +130,7 @@ void AlphaEquivUTest::setup_data(void)
129130
130131 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
131132 StorageNodePtr store = StorageNodeCast(hsn);
132 store->open();
133 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
133134 TS_ASSERT(store->connected())
134135
135136 /* Populate the Storage with stuff that we will later query. */
……@@ -157,7 +158,7 @@ void AlphaEquivUTest::test_fetch(void)
157158 _as = createAtomSpace();
158159 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
159160 StorageNodePtr store = StorageNodeCast(hsn);
160 store->open();
161 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
161162 TS_ASSERT(store->connected())
162163
163164 // Fetch an alpha-equivalent lambda link.
……@@ -203,7 +204,7 @@ void AlphaEquivUTest::test_remove(void)
203204 _as = createAtomSpace();
204205 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
205206 StorageNodePtr store = StorageNodeCast(hsn);
206 store->open();
207 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
207208 TS_ASSERT(store->connected())
208209
209210 // Remove the alpha-equivalent lambda link.
……@@ -241,7 +242,7 @@ void AlphaEquivUTest::test_recursive_remove(void)
241242 _as = createAtomSpace();
242243 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
243244 StorageNodePtr store = StorageNodeCast(hsn);
244 store->open();
245 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
245246 TS_ASSERT(store->connected())
246247
247248 // Recursive remove Concept "A".
tests/persist/cog-simple/SimpleBasicDeleteUTest.cxxtest +64 -55
……@@ -33,6 +33,7 @@
3333#include <opencog/persist/cog-types/atom_types.h>
3434#include <opencog/atoms/value/FloatValue.h>
3535#include <opencog/atoms/value/LinkValue.h>
36#include <opencog/atoms/value/VoidValue.h>
3637#include <opencog/atomspace/AtomSpace.h>
3738
3839#include <opencog/persist/api/StorageNode.h>
……@@ -92,8 +93,8 @@ void SimpleBasicDeleteUTest::tearDown(void)
9293}
9394
9495// 9 more from CogServerNode and gorp; 2 for *-TruthValueKey-* and
95// *-IsKeyFlag-*
96int basic_offset = 9 + 2;
96// *-IsKeyFlag-*; 1 more for *-open-*
97int basic_offset = 9 + 3;
9798
9899// ============================================================
99100
……@@ -106,7 +107,7 @@ void SimpleBasicDeleteUTest::test_duplicates(void)
106107 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
107108 StorageNodePtr store = StorageNodeCast(hsn);
108109
109 store->open();
110 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
110111 TS_ASSERT(store->connected())
111112
112113 // Clear out left-over junk, just in case.
……@@ -120,23 +121,24 @@ void SimpleBasicDeleteUTest::test_duplicates(void)
120121 store->store_atom(li);
121122 store->barrier();
122123
123 // Verify the atomspace size
124 TS_ASSERT_EQUALS(as->get_size(), 4);
124 // Verify the atomspace size (+1 for *-open-* predicate)
125 TS_ASSERT_EQUALS(as->get_size(), 5);
125126
126127 // Remove the link. Since the link has duplicate atoms
127128 // in it, this can cause trouble, depending on how the
128129 // incoming set is managed.
129130 store->remove_atom(as, li);
130 TS_ASSERT_EQUALS(as->get_size(), 4);
131 store->close();
131 TS_ASSERT_EQUALS(as->get_size(), 5);
132 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
132133 as->extract_atom(li);
133 TS_ASSERT_EQUALS(as->get_size(), 3);
134 store->open();
134 TS_ASSERT_EQUALS(as->get_size(), 5);
135 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
135136 store->load_atomspace();
136 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
137 // +1 for *-close-* predicate from above
138 TS_ASSERT_EQUALS(as->get_size(), 4 + basic_offset);
137139
138140 ::kill_data(store.get(), _test_asp.get());
139 store->close();
141 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
140142
141143 logger().debug("END TEST: %s", __FUNCTION__);
142144}
……@@ -152,7 +154,7 @@ void SimpleBasicDeleteUTest::test_recursive(void)
152154 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
153155 StorageNodePtr store = StorageNodeCast(hsn);
154156
155 store->open();
157 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
156158 TS_ASSERT(store->connected())
157159
158160 // Clear out left-over junk, just in case.
……@@ -173,8 +175,8 @@ void SimpleBasicDeleteUTest::test_recursive(void)
173175 for (const Handle& h : hset)
174176 printf("Atomspace contains: %s\n", h->to_short_string().c_str());
175177
176 // Verify the atomspace size
177 TS_ASSERT_EQUALS(as->get_size(), 5);
178 // Verify the atomspace size (+1 for *-open-* predicate)
179 TS_ASSERT_EQUALS(as->get_size(), 6);
178180
179181 // Remove (Concept "a"). Since this appears twice, recursion
180182 // will hit it twice, in stange ways, and maybe crash.
……@@ -186,11 +188,12 @@ void SimpleBasicDeleteUTest::test_recursive(void)
186188 for (const Handle& h : hset)
187189 printf("Post delete: %s\n", h->to_short_string().c_str());
188190
189 store->close();
191 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
190192 as->extract_atom(ha, true);
191 store->open();
193 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
192194 store->load_atomspace();
193 TS_ASSERT_EQUALS(as->get_size(), 2 + basic_offset);
195 // +1 for *-close-* predicate from above
196 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
194197
195198 // --------------------------------------
196199 // Do it again, but with a different order.
……@@ -200,17 +203,19 @@ void SimpleBasicDeleteUTest::test_recursive(void)
200203
201204 store->store_atom(lj);
202205 store->barrier();
203 store->close();
204 store->open();
206 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
207 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
205208 store->load_atomspace();
206 TS_ASSERT_EQUALS(as->get_size(), 5 + basic_offset);
209 // +1 for *-close-* predicate from above
210 TS_ASSERT_EQUALS(as->get_size(), 6 + basic_offset);
207211
208212 store->remove_atom(as, ha, true);
209 store->close();
213 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
210214 as->extract_atom(ha, true);
211 store->open();
215 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
212216 store->load_atomspace();
213 TS_ASSERT_EQUALS(as->get_size(), 2 + basic_offset);
217 // +1 for *-close-* predicate from above
218 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
214219
215220 // --------------------------------------
216221 // Do it again, but with a complex order.
……@@ -220,17 +225,19 @@ void SimpleBasicDeleteUTest::test_recursive(void)
220225
221226 store->store_atom(lj);
222227 store->barrier();
223 store->close();
224 store->open();
228 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
229 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
225230 store->load_atomspace();
226 TS_ASSERT_EQUALS(as->get_size(), 5 + basic_offset);
231 // +1 for *-close-* predicate from above
232 TS_ASSERT_EQUALS(as->get_size(), 6 + basic_offset);
227233
228234 store->remove_atom(as, ha, true);
229 store->close();
235 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
230236 as->extract_atom(ha, true);
231 store->open();
237 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
232238 store->load_atomspace();
233 TS_ASSERT_EQUALS(as->get_size(), 2 + basic_offset);
239 // +1 for *-close-* predicate from above
240 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
234241
235242 // --------------------------------------
236243 // Do it again, but more deeply.
……@@ -241,21 +248,23 @@ void SimpleBasicDeleteUTest::test_recursive(void)
241248
242249 store->store_atom(lk);
243250 store->barrier();
244 store->close();
245 store->open();
251 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
252 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
246253 store->load_atomspace();
247 TS_ASSERT_EQUALS(as->get_size(), 6 + basic_offset);
254 // +1 for *-close-* predicate from above
255 TS_ASSERT_EQUALS(as->get_size(), 7 + basic_offset);
248256
249257 store->remove_atom(as, ha, true);
250 store->close();
258 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
251259 as->extract_atom(ha, true);
252 store->open();
260 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
253261 store->load_atomspace();
254 TS_ASSERT_EQUALS(as->get_size(), 2 + basic_offset);
262 // +1 for *-close-* predicate from above
263 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
255264
256265 // --------------------------------------
257266 ::kill_data(store.get(), _test_asp.get());
258 store->close();
267 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
259268
260269 logger().debug("END TEST: %s", __FUNCTION__);
261270}
……@@ -272,7 +281,7 @@ void SimpleBasicDeleteUTest::test_key_deletion(void)
272281 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
273282 StorageNodePtr store = StorageNodeCast(hsn);
274283
275 store->open();
284 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
276285 TS_ASSERT(store->connected())
277286
278287 // Clear out left-over junk, just in case.
……@@ -291,8 +300,8 @@ void SimpleBasicDeleteUTest::test_key_deletion(void)
291300 store->store_atom(ha);
292301 store->barrier();
293302
294 // Verify the atomspace size (+1 for *-IsKeyFlag-*)
295 TS_ASSERT_EQUALS(as->get_size(), 6);
303 // Verify the atomspace size (+1 for *-IsKeyFlag-*, +1 for *-open-*)
304 TS_ASSERT_EQUALS(as->get_size(), 7);
296305
297306 // Verify that there are three keys
298307 HandleSet hs = ha->getKeys();
……@@ -304,14 +313,14 @@ void SimpleBasicDeleteUTest::test_key_deletion(void)
304313 // both storage, and the AtomSpace itself block this,
305314 store->remove_atom(as, kb);
306315 as->extract_atom(kb);
307 // +1 for *-IsKeyFlag-*
308 TS_ASSERT_EQUALS(as->get_size(), 6);
316 // +1 for *-IsKeyFlag-*, +1 for *-open-*
317 TS_ASSERT_EQUALS(as->get_size(), 7);
309318
310319 // Verify the key was NOT deleted by loading only PredicateNodes.
311320 as = createAtomSpace();
312321 hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
313322 store = StorageNodeCast(hsn);
314 store->open();
323 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
315324 store->fetch_all_atoms_of_type(PREDICATE_NODE);
316325
317326 // All keys should have been loaded.
……@@ -333,7 +342,7 @@ void SimpleBasicDeleteUTest::test_key_deletion(void)
333342 hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
334343 store = StorageNodeCast(hsn);
335344
336 store->open();
345 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
337346 TS_ASSERT(store->connected())
338347
339348 // We expect 5 atoms
……@@ -359,7 +368,7 @@ void SimpleBasicDeleteUTest::test_key_deletion(void)
359368 TS_ASSERT_EQUALS(hs.size(), 3);
360369
361370 ::kill_data(store.get(), _test_asp.get());
362 store->close();
371 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
363372
364373 logger().debug("END TEST: %s", __FUNCTION__);
365374}
……@@ -381,7 +390,7 @@ void SimpleBasicDeleteUTest::test_key_corruption(void)
381390 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
382391 StorageNodePtr store = StorageNodeCast(hsn);
383392
384 store->open();
393 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
385394 TS_ASSERT(store->connected())
386395
387396 // Clear out left-over junk, just in case.
……@@ -397,12 +406,12 @@ void SimpleBasicDeleteUTest::test_key_corruption(void)
397406 store->store_atom(hb);
398407 store->barrier();
399408
400 TS_ASSERT_EQUALS(as->get_size(), 5);
409 TS_ASSERT_EQUALS(as->get_size(), 6);
401410
402411 // Remove the value
403412 store->remove_atom(as, hx);
404413 as->extract_atom(hx);
405 TS_ASSERT_EQUALS(as->get_size(), 4);
414 TS_ASSERT_EQUALS(as->get_size(), 5);
406415
407416 // FYI, we should call store->close() at this point, but we
408417 // don't, because ... most users forget to do this too.
……@@ -418,7 +427,7 @@ void SimpleBasicDeleteUTest::test_key_corruption(void)
418427 hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
419428 store = StorageNodeCast(hsn);
420429
421 store->open();
430 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
422431 TS_ASSERT(store->connected())
423432
424433 // We expect 5 atoms: b, x, key-x, *-IsKeyFlag-*, StorageNode
……@@ -452,14 +461,14 @@ void SimpleBasicDeleteUTest::test_key_corruption(void)
452461 store->remove_atom(as, hx);
453462 as->extract_atom(hx);
454463 TS_ASSERT_EQUALS(as->get_size(), 5 + full_offset);
455 store->close();
456 store->open();
464 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
465 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
457466 store->load_atomspace();
458 // Size is 6 because (Concept "x") cannot be deleted.
459 TS_ASSERT_EQUALS(as->get_size(), 6 + full_offset);
467 // Size is 6 because (Concept "x") cannot be deleted. +1 for *-close-*
468 TS_ASSERT_EQUALS(as->get_size(), 7 + full_offset);
460469
461470 // We are done.
462 store->close();
471 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
463472
464473 // -------------------------------------------------------
465474 // Start again, with a fresh connection.
……@@ -470,7 +479,7 @@ void SimpleBasicDeleteUTest::test_key_corruption(void)
470479 hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
471480 store = StorageNodeCast(hsn);
472481
473 store->open();
482 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
474483 TS_ASSERT(store->connected())
475484
476485 // We expect 6 atoms
……@@ -490,7 +499,7 @@ void SimpleBasicDeleteUTest::test_key_corruption(void)
490499 TS_ASSERT_EQUALS(hs.size(), 2);
491500
492501 ::kill_data(store.get(), _test_asp.get());
493 store->close();
502 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
494503
495504 logger().debug("END TEST: %s", __FUNCTION__);
496505}
tests/persist/cog-simple/SimpleDeleteUTest.cxxtest +17 -16
……@@ -33,6 +33,7 @@
3333#include <opencog/atoms/base/Link.h>
3434#include <opencog/atoms/base/Node.h>
3535#include <opencog/atoms/value/FloatValue.h>
36#include <opencog/atoms/value/VoidValue.h>
3637#include <opencog/persist/cog-simple/CogSimpleStorage.h>
3738
3839#include <opencog/util/Logger.h>
……@@ -416,7 +417,7 @@ void DeleteUTest::test_remove(void)
416417
417418 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16305");
418419 StorageNodePtr store = StorageNodeCast(hsn);
419 store->open();
420 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
420421 TS_ASSERT(store->connected())
421422
422423 int idx = 0;
……@@ -439,10 +440,10 @@ void DeleteUTest::test_remove(void)
439440 /* Push all atoms out to storage */
440441 store->store_atomspace();
441442
442 // +1 for (Predicate "*-IsKeyFlag-*")
443 printf("Initial Atomspace size=%lu expect=%d\n", _as->get_size(), 7*idx+1);
443 // +1 for (Predicate "*-IsKeyFlag-*"), +1 for *-open-*
444 printf("Initial Atomspace size=%lu expect=%d\n", _as->get_size(), 7*idx+2);
444445 TSM_ASSERT("Initial unexpected atomspace size",
445 ((unsigned)(7*idx+1)) == _as->get_size());
446 ((unsigned)(7*idx+2)) == _as->get_size());
446447 /* Delete some atoms with non-empty incoming sets.
447448 * This should result in thier being removed from the atomspace,
448449 * but NOT fom the backend!
……@@ -452,9 +453,9 @@ void DeleteUTest::test_remove(void)
452453 for (i=0; i<idx; i++)
453454 extract_links(i, _as);
454455
455 // +1 for (Predicate "*-IsKeyFlag-*")
456 printf("Atomspace size=%lu expect=%d\n", _as->get_size(), 4*idx+1);
457 TSM_ASSERT("Post-extract unexpected atomspace size", ((unsigned)(4*idx+1)) == _as->get_size());
456 // +1 for (Predicate "*-IsKeyFlag-*"), +1 for *-open-*
457 printf("Atomspace size=%lu expect=%d\n", _as->get_size(), 4*idx+2);
458 TSM_ASSERT("Post-extract unexpected atomspace size", ((unsigned)(4*idx+2)) == _as->get_size());
458459
459460 /* Verify that the atoms can still be fetched from storage. */
460461 for (i=0; i<idx; i++) {
……@@ -466,8 +467,8 @@ void DeleteUTest::test_remove(void)
466467 for (i=0; i<idx; i++)
467468 delete_links(i, store);
468469
469 printf("Post-remove size=%lu expect=%d\n", _as->get_size(), 4*idx+3);
470 TSM_ASSERT("Post-remove unexpected atomspace size", ((unsigned)(4*idx+3)) == _as->get_size());
470 printf("Post-remove size=%lu expect=%d\n", _as->get_size(), 4*idx+4);
471 TSM_ASSERT("Post-remove unexpected atomspace size", ((unsigned)(4*idx+4)) == _as->get_size());
471472
472473 /* Verify that the atoms are really gone from storage. */
473474 for (i=0; i<idx; i++) {
……@@ -475,8 +476,8 @@ void DeleteUTest::test_remove(void)
475476 check_remove(i, _as, "verify-gone");
476477 }
477478
478 printf("Post-referesh size=%lu expect=%d\n", _as->get_size(), 7*idx+3);
479 TSM_ASSERT("Post-refetch unexpected atomspace size", ((unsigned)(7*idx+3)) == _as->get_size());
479 printf("Post-referesh size=%lu expect=%d\n", _as->get_size(), 7*idx+4);
480 TSM_ASSERT("Post-refetch unexpected atomspace size", ((unsigned)(7*idx+4)) == _as->get_size());
480481
481482 /* Kill data for good */
482483 _as->clear();
……@@ -497,7 +498,7 @@ void DeleteUTest::test_recurse(void)
497498
498499 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16305");
499500 StorageNodePtr store = StorageNodeCast(hsn);
500 store->open();
501 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
501502 TS_ASSERT(store->connected())
502503
503504 int idx = 0;
……@@ -530,8 +531,8 @@ void DeleteUTest::test_recurse(void)
530531 for (i=0; i<zap; i++)
531532 extract_nodes(i, _as);
532533
533 // +1 for the *-IsKeyFlag-* predicate
534 size_t expsz = 7*(idx-zap) + 3*zap + 1;
534 // +1 for the *-IsKeyFlag-* predicate, +1 for *-open-* predicate
535 size_t expsz = 7*(idx-zap) + 3*zap + 2;
535536 printf("Atomspace size=%lu expect=%lu\n",
536537 _as->get_size(), expsz);
537538 TSM_ASSERT("Unexpected atomspace size", expsz == _as->get_size());
……@@ -558,9 +559,9 @@ void DeleteUTest::test_recurse(void)
558559 }
559560
560561 printf("Post-refetch size=%lu expect=%d\n",
561 _as->get_size(), 7*idx+3);
562 _as->get_size(), 7*idx+4);
562563 TSM_ASSERT("Unexpected atomspace size",
563 ((unsigned) 7*idx+3) == _as->get_size());
564 ((unsigned) 7*idx+4) == _as->get_size());
564565
565566 /* Check that the removed atoms really got zapped. */
566567 for (i=0; i<zap; i++) {
tests/persist/cog-simple/SimpleLargeFlatUTest.cxxtest +5 -4
……@@ -30,6 +30,7 @@
3030#include <opencog/atoms/base/Link.h>
3131#include <opencog/atoms/base/Node.h>
3232#include <opencog/atoms/value/FloatValue.h>
33#include <opencog/atoms/value/VoidValue.h>
3334#include <opencog/persist/cog-simple/CogSimpleStorage.h>
3435
3536#include <opencog/util/Logger.h>
……@@ -366,7 +367,7 @@ void LargeFlatUTest::test_atomspace(void)
366367
367368 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16308");
368369 StorageNodePtr store = StorageNodeCast(hsn);
369 store->open();
370 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
370371 TS_ASSERT(store->connected())
371372
372373 /* Create a large number of atoms */
……@@ -391,7 +392,7 @@ void LargeFlatUTest::test_atomspace(void)
391392 /* The clear above nuked the storage, so restart */
392393 hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16308");
393394 store = StorageNodeCast(hsn);
394 store->open();
395 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
395396 TS_ASSERT(store->connected())
396397
397398 /* Verify that the atoms can still be fetched from storage. */
……@@ -408,7 +409,7 @@ void LargeFlatUTest::test_atomspace(void)
408409 /* The clear above nuked the storage, so restart */
409410 hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16308");
410411 store = StorageNodeCast(hsn);
411 store->open();
412 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
412413 TS_ASSERT(store->connected())
413414
414415 /* Verify that the atoms can still be fetched from storage. */
……@@ -426,7 +427,7 @@ void LargeFlatUTest::test_atomspace(void)
426427 for (i=0; i<idx; i++)
427428 check_empty(i, _as);
428429
429 store->close();
430 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
430431 logger().debug("END TEST: %s", __FUNCTION__);
431432}
432433
tests/persist/cog-simple/SimpleLargeZipfUTest.cxxtest +5 -4
……@@ -32,6 +32,7 @@
3232#include <opencog/atoms/base/Link.h>
3333#include <opencog/atoms/base/Node.h>
3434#include <opencog/atoms/value/FloatValue.h>
35#include <opencog/atoms/value/VoidValue.h>
3536#include <opencog/persist/cog-simple/CogSimpleStorage.h>
3637
3738#include <opencog/util/Logger.h>
……@@ -291,7 +292,7 @@ void LargeZipfUTest::test_atomspace(void)
291292
292293 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16309");
293294 StorageNodePtr store = StorageNodeCast(hsn);
294 store->open();
295 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
295296 TS_ASSERT(store->connected())
296297
297298 /* Create a large number of atoms */
……@@ -314,7 +315,7 @@ void LargeZipfUTest::test_atomspace(void)
314315 /* The clear above nuked the storage, so restart */
315316 hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16309");
316317 store = StorageNodeCast(hsn);
317 store->open();
318 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
318319 TS_ASSERT(store->connected())
319320
320321 /* Verify that the atoms can still be fetched from storage. */
……@@ -329,7 +330,7 @@ void LargeZipfUTest::test_atomspace(void)
329330 /* The clear above nuked the storage, so restart */
330331 hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16309");
331332 store = StorageNodeCast(hsn);
332 store->open();
333 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
333334 TS_ASSERT(store->connected())
334335
335336 /* Verify that the atoms can still be fetched from storage. */
……@@ -344,7 +345,7 @@ void LargeZipfUTest::test_atomspace(void)
344345 /* Verify that the atoms are no longer being found. */
345346 check_empty(_as);
346347
347 store->close();
348 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
348349 logger().debug("END TEST: %s", __FUNCTION__);
349350}
350351
tests/persist/cog-simple/SimpleMultiDeleteUTest.cxxtest +13 -10
……@@ -34,6 +34,7 @@
3434#include <opencog/persist/cog-types/atom_types.h>
3535#include <opencog/atoms/value/FloatValue.h>
3636#include <opencog/atoms/value/LinkValue.h>
37#include <opencog/atoms/value/VoidValue.h>
3738#include <opencog/atomspace/AtomSpace.h>
3839
3940#include <opencog/persist/api/StorageNode.h>
……@@ -154,7 +155,7 @@ void SimpleMultiDeleteUTest::test_add_delete(void)
154155 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
155156 store = StorageNodeCast(hsn);
156157
157 store->open();
158 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
158159 TS_ASSERT(store->connected())
159160
160161 // Clear out left-over junk, just in case.
……@@ -174,16 +175,16 @@ void SimpleMultiDeleteUTest::test_add_delete(void)
174175 printf("Post-update AtomSpace size=%lu\n", as->get_size());
175176 // printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
176177
177 // Verify the local AtomSpace size. Should be 34:
178 // Verify the local AtomSpace size. Should be 35:
178179 // The CogStorageNode itself, the (Concept "aaaa") and
179 // 16 from thread-id modulo 16 plus 16 ListLinks.
180 TS_ASSERT_EQUALS(as->get_size(), 2 + 2*(n_threads+6));
180 // 16 from thread-id modulo 16 plus 16 ListLinks, plus *-open-* predicate
181 TS_ASSERT_EQUALS(as->get_size(), 3 + 2*(n_threads+6));
181182
182183 // Verify the remote AtomSpace: pull everything from the
183184 // cogserver, back to here. Do this "independently", by
184185 // closing the socket; this forces the cogserver through
185186 // its socket-close code, potentially exposing bugs.
186 store->close();
187 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
187188
188189 HandleSeq hs;
189190 as->get_handles_by_type(hs, CONCEPT_NODE);
……@@ -191,18 +192,20 @@ void SimpleMultiDeleteUTest::test_add_delete(void)
191192 as->extract_atom(h, true);
192193 hs.clear();
193194 printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
194 TS_ASSERT_EQUALS(as->get_size(), 1);
195 // CogStorageNode + *-close-* predicate + *-open-* predicate
196 TS_ASSERT_EQUALS(as->get_size(), 3);
195197
196 store->open();
198 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
197199 TS_ASSERT(store->connected())
198200
199201 store->load_atomspace();
200202 printf("Final AtomSpace size=%lu\n", as->get_size());
201203
202 // Size should be 20: the 18 from before plus
204 // Size should be 22: the 18 from before plus
203205 // (Predicate "*-TruthValueKey-*") and (Predicate "*-IsKeyFlag-*")
204206 // Plus 9 more from CogServerNode gorp
205 size_t expected_size = 9 + 4 + 6 + n_threads;
207 // Plus *-open-* and *-close-* predicates
208 size_t expected_size = 9 + 4 + 2 + 6 + n_threads;
206209 if (as->get_size() != expected_size)
207210 printf("Error: Bad size! AtomSpace contents =\n%s\n",
208211 as->to_string().c_str());
……@@ -210,7 +213,7 @@ void SimpleMultiDeleteUTest::test_add_delete(void)
210213 TS_ASSERT_EQUALS(as->get_size(), expected_size);
211214
212215 ::kill_data(store.get(), _test_asp.get());
213 store->close();
216 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
214217 store = nullptr;
215218
216219 logger().debug("END TEST: %s", __FUNCTION__);
tests/persist/cog-simple/SimpleMultiPersistUTest.cxxtest +5 -4
……@@ -36,6 +36,7 @@
3636#include <opencog/persist/cog-simple/CogSimpleStorage.h>
3737
3838#include <opencog/atoms/value/FloatValue.h>
39#include <opencog/atoms/value/VoidValue.h>
3940
4041#include <opencog/util/Logger.h>
4142#include "../TestCogServer.h"
……@@ -132,7 +133,7 @@ void MultiPersistUTest::setUp(void)
132133
133134 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16306");
134135 store = StorageNodeCast(hsn);
135 store->open();
136 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
136137 TS_ASSERT(store->connected())
137138}
138139
……@@ -431,7 +432,7 @@ void MultiPersistUTest::test_atomspace(void)
431432 /* The clear above nuked the storage, so restart */
432433 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16306");
433434 store = StorageNodeCast(hsn);
434 store->open();
435 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
435436 TS_ASSERT(store->connected())
436437
437438 int i, off;
……@@ -450,7 +451,7 @@ void MultiPersistUTest::test_atomspace(void)
450451 /* The clear above nuked the storage, so restart */
451452 hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16306");
452453 store = StorageNodeCast(hsn);
453 store->open();
454 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
454455 TS_ASSERT(store->connected())
455456
456457 /* Verify that the atoms can still be fetched from storage. */
……@@ -469,7 +470,7 @@ void MultiPersistUTest::test_atomspace(void)
469470 for (i=0; i<NATS; i++)
470471 check_empty(NHACK*off+i, _as);
471472
472 store->close();
473 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
473474 logger().debug("END TEST: %s", __FUNCTION__);
474475}
475476
tests/persist/cog-simple/SimpleMultiUserUTest.cxxtest +5 -4
……@@ -36,6 +36,7 @@
3636#include <opencog/atoms/base/Node.h>
3737#include <opencog/persist/cog-simple/CogSimpleStorage.h>
3838#include <opencog/atoms/value/FloatValue.h>
39#include <opencog/atoms/value/VoidValue.h>
3940
4041#include <opencog/util/Logger.h>
4142#include "../TestCogServer.h"
……@@ -160,7 +161,7 @@ void MultiUserUTest::connect_to_db(int i)
160161 _as[i] = createAtomSpace();
161162 Handle hsn = _as[i]->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16307");
162163 _store[i] = StorageNodeCast(hsn);
163 _store[i]->open();
164 _store[i]->setValue(_as[i]->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
164165 TS_ASSERT(_store[i]->connected())
165166}
166167
……@@ -425,7 +426,7 @@ void MultiUserUTest::run_user_test(int thread_id)
425426 while (n_threads != nstarted.fetch_add(0)) std::this_thread::yield();
426427
427428 add_atoms(thread_id);
428 _store[thread_id]->close();
429 _store[thread_id]->setValue(_as[thread_id]->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
429430 _as[thread_id] = nullptr;
430431}
431432
……@@ -449,7 +450,7 @@ void MultiUserUTest::do_test_multiuser(void)
449450 AtomSpacePtr aspace = createAtomSpace();
450451 Handle hsn = aspace->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16307");
451452 StorageNodePtr store = StorageNodeCast(hsn);
452 store->open();
453 store->setValue(aspace->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
453454 TS_ASSERT(store->connected())
454455
455456 for (int off=0; off<n_threads; off++)
……@@ -459,7 +460,7 @@ void MultiUserUTest::do_test_multiuser(void)
459460 }
460461
461462 store->barrier();
462 store->close();
463 store->setValue(aspace->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
463464 aspace = nullptr;
464465}
465466
tests/persist/cog-simple/SimplePersistUTest.cxxtest +5 -4
……@@ -32,6 +32,7 @@
3232#include <opencog/atoms/base/Link.h>
3333#include <opencog/atoms/base/Node.h>
3434#include <opencog/atoms/value/FloatValue.h>
35#include <opencog/atoms/value/VoidValue.h>
3536
3637#include <opencog/persist/cog-simple/CogSimpleStorage.h>
3738
……@@ -317,7 +318,7 @@ void PersistUTest::test_atomspace(void)
317318
318319 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16303");
319320 StorageNodePtr store = StorageNodeCast(hsn);
320 store->open();
321 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
321322 TS_ASSERT(store->connected())
322323
323324 int idx = 0;
……@@ -351,7 +352,7 @@ void PersistUTest::test_atomspace(void)
351352 /* The above clear wiped out the storage node; recreate it. */
352353 hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16303");
353354 store = StorageNodeCast(hsn);
354 store->open();
355 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
355356 TS_ASSERT(store->connected())
356357
357358 /* Verify that the atoms can still be fetched from storage. */
……@@ -367,7 +368,7 @@ void PersistUTest::test_atomspace(void)
367368 /* The above clear wiped out the storage node; recreate it. */
368369 hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, "cog://localhost:16303");
369370 store = StorageNodeCast(hsn);
370 store->open();
371 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
371372 TS_ASSERT(store->connected())
372373
373374 /* Verify that the atoms can still be fetched from storage. */
……@@ -376,7 +377,7 @@ void PersistUTest::test_atomspace(void)
376377 check_space(i, _as, "ver-again");
377378 }
378379
379 store->close();
380 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
380381
381382 /* Kill data for good */
382383 _as->clear();
tests/persist/cog-simple/SimpleQueryPersistUTest.cxxtest +6 -5
……@@ -33,6 +33,7 @@
3333#include <opencog/atomspace/AtomSpace.h>
3434#include <opencog/atoms/value/FloatValue.h>
3535#include <opencog/atoms/value/LinkValue.h>
36#include <opencog/atoms/value/VoidValue.h>
3637#include <opencog/persist/cog-simple/CogSimpleStorage.h>
3738
3839#include <opencog/util/Logger.h>
……@@ -123,7 +124,7 @@ void SimpleQueryPersistUTest::setup_data(void)
123124 _as = createAtomSpace();
124125 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
125126 StorageNodePtr store = StorageNodeCast(hsn);
126 store->open();
127 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
127128 TS_ASSERT(store->connected())
128129
129130 /* Populate the Storage with stuff that we will later query. */
……@@ -170,7 +171,7 @@ void SimpleQueryPersistUTest::test_meet(void)
170171 _as = createAtomSpace();
171172 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
172173 StorageNodePtr store = StorageNodeCast(hsn);
173 store->open();
174 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
174175 TS_ASSERT(store->connected())
175176
176177 // Create a query to find all things that have wheels.
……@@ -221,7 +222,7 @@ void SimpleQueryPersistUTest::test_meet(void)
221222 HandleSet htoo = lvp->to_handle_set();
222223 TSM_ASSERT("Expect same results as before", hset == htoo);
223224
224 store->close();
225 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
225226
226227 logger().info("END TEST: %s", __FUNCTION__);
227228}
……@@ -235,7 +236,7 @@ void SimpleQueryPersistUTest::test_join(void)
235236 _as = createAtomSpace();
236237 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
237238 StorageNodePtr store = StorageNodeCast(hsn);
238 store->open();
239 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
239240 TS_ASSERT(store->connected())
240241
241242 // Create a join to find all vehicles.
……@@ -272,7 +273,7 @@ void SimpleQueryPersistUTest::test_join(void)
272273
273274 TSM_ASSERT_EQUALS("Expecting airplane, bicycle and car", hset, expect);
274275
275 store->close();
276 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
276277
277278 logger().info("END TEST: %s", __FUNCTION__);
278279}
tests/persist/cog-simple/SimpleServerHangUTest.cxxtest +2 -1
……@@ -28,6 +28,7 @@
2828#include <opencog/atoms/base/Link.h>
2929#include <opencog/atoms/base/Node.h>
3030#include <opencog/atomspace/AtomSpace.h>
31#include <opencog/atoms/value/VoidValue.h>
3132#include <opencog/persist/cog-simple/CogSimpleStorage.h>
3233
3334#include <opencog/util/Logger.h>
……@@ -108,7 +109,7 @@ void ServerHangUTest::test_no_hang(void)
108109 _as = createAtomSpace();
109110 Handle hsn = _as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
110111 StorageNodePtr store = StorageNodeCast(hsn);
111 store->open();
112 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
112113 TS_ASSERT(store->connected());
113114
114115 printf("Triggering an exception (UniqueLink cannot be instantiated)...\n");
tests/persist/cog-simple/SimpleValueSaveUTest.cxxtest +26 -24
……@@ -36,6 +36,7 @@
3636#include <opencog/atoms/value/FloatValue.h>
3737#include <opencog/atoms/value/LinkValue.h>
3838#include <opencog/atoms/value/StringValue.h>
39#include <opencog/atoms/value/VoidValue.h>
3940#include "../TestCogServer.h"
4041
4142#include <opencog/persist/cog-simple/CogSimpleStorage.h>
……@@ -106,7 +107,7 @@ void SimpleValueSaveUTest::test_single_atom_save()
106107 AtomSpacePtr as = createAtomSpace();
107108 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
108109 StorageNodePtr store = StorageNodeCast(hsn);
109 store->open();
110 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
110111 TS_ASSERT(store->connected())
111112
112113 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -170,7 +171,7 @@ void SimpleValueSaveUTest::check_one(ValuePtr pap, bool fetchkey)
170171 AtomSpacePtr as = createAtomSpace();
171172 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
172173 StorageNodePtr store = StorageNodeCast(hsn);
173 store->open();
174 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
174175 TS_ASSERT(store->connected())
175176
176177 Handle key = store->fetch_atom(bkey);
……@@ -193,7 +194,7 @@ void SimpleValueSaveUTest::check_one(ValuePtr pap, bool fetchkey)
193194 as = createAtomSpace();
194195 hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
195196 store = StorageNodeCast(hsn);
196 store->open();
197 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
197198 TS_ASSERT(store->connected())
198199
199200 // Storage uses a different code path if the key is not yet
……@@ -218,7 +219,7 @@ void SimpleValueSaveUTest::test_save_restore(bool fkey)
218219 AtomSpacePtr as = createAtomSpace();
219220 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
220221 StorageNodePtr store = StorageNodeCast(hsn);
221 store->open();
222 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
222223 TS_ASSERT(store->connected())
223224
224225 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -273,7 +274,7 @@ void SimpleValueSaveUTest::test_load_by_type()
273274 AtomSpacePtr as = createAtomSpace();
274275 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
275276 StorageNodePtr store = StorageNodeCast(hsn);
276 store->open();
277 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
277278 TS_ASSERT(store->connected())
278279
279280 // Clear out left-over junk, just in case.
……@@ -335,7 +336,7 @@ void SimpleValueSaveUTest::test_load_by_type()
335336 as = createAtomSpace();
336337 hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
337338 store = StorageNodeCast(hsn);
338 store->open();
339 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
339340 TS_ASSERT(store->connected())
340341
341342 // --------------------
……@@ -343,10 +344,11 @@ void SimpleValueSaveUTest::test_load_by_type()
343344 store->fetch_all_atoms_of_type(CONCEPT_NODE);
344345 store->barrier();
345346
346 // Seven: 4 ConceptNodes, the PredicateNode "*-TruthValueKey-*",
347 // PredicateNode "some pred key", and PredicateNode "*-IsKeyFlag-*"
347 // Nine: 4 ConceptNodes, the PredicateNode "*-TruthValueKey-*",
348 // PredicateNode "some pred key", PredicateNode "*-IsKeyFlag-*",
349 // the CogSimpleStorageNode, and the PredicateNode "*-open-*"
348350 // -- the preds show up when the attached values are fetched.
349 TSM_ASSERT_EQUALS("Wrong number of Atoms fetched!", as->get_size(), 8);
351 TSM_ASSERT_EQUALS("Wrong number of Atoms fetched!", as->get_size(), 9);
350352
351353 printf("Got %lu Atoms\n", as->get_size());
352354 HandleSeq hset;
……@@ -407,7 +409,7 @@ void SimpleValueSaveUTest::test_link_by_type()
407409 AtomSpacePtr as = createAtomSpace();
408410 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
409411 StorageNodePtr store = StorageNodeCast(hsn);
410 store->open();
412 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
411413 TS_ASSERT(store->connected())
412414
413415 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -494,7 +496,7 @@ void SimpleValueSaveUTest::test_link_by_type()
494496 as = createAtomSpace();
495497 hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
496498 store = StorageNodeCast(hsn);
497 store->open();
499 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
498500 TS_ASSERT(store->connected())
499501
500502 // --------------------
……@@ -510,10 +512,10 @@ void SimpleValueSaveUTest::test_link_by_type()
510512 // The B-nodes are added after the fetch. In either case,
511513 // there should not be any values fetched for either A or B;
512514 // only the values on the C-links should be fetched.
513 // +1 for (PredicateNode "*-IsKeyFlag-*")
515 // +1 for (PredicateNode "*-IsKeyFlag-*"), +1 for *-open-*
514516 store->fetch_all_atoms_of_type(LIST_LINK);
515517 store->barrier();
516 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 16);
518 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 17);
517519
518520 printf("Got %lu Atoms\n", as->get_size());
519521 HandleSeq hset;
……@@ -628,7 +630,7 @@ void SimpleValueSaveUTest::test_link_by_type_quoted()
628630 AtomSpacePtr as = createAtomSpace();
629631 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
630632 StorageNodePtr store = StorageNodeCast(hsn);
631 store->open();
633 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
632634 TS_ASSERT(store->connected())
633635
634636 Handle key = as->add_node(PREDICATE_NODE, "some (\"pred\"))) key");
……@@ -715,7 +717,7 @@ void SimpleValueSaveUTest::test_link_by_type_quoted()
715717 as = createAtomSpace();
716718 hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
717719 store = StorageNodeCast(hsn);
718 store->open();
720 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
719721 TS_ASSERT(store->connected())
720722
721723 // --------------------
……@@ -734,10 +736,10 @@ void SimpleValueSaveUTest::test_link_by_type_quoted()
734736 store->fetch_all_atoms_of_type(LIST_LINK);
735737 store->barrier();
736738
737 // We created 9 new atoms above, so expect 16 from before plus 9
738 // (+1 for *-IsKeyFlag-*)
739 printf ("fetched %lu atoms, expecting 25\n", as->get_size());
740 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 25);
739 // We created 9 new atoms above, so expect 17 from before plus 9
740 // (+1 for *-IsKeyFlag-*, +1 for *-open-*)
741 printf ("fetched %lu atoms, expecting 26\n", as->get_size());
742 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 26);
741743
742744 Handle gbf = as->add_node(CONCEPT_NODE, "b float node");
743745 Handle gbt = as->add_node(CONCEPT_NODE, "b string node");
……@@ -846,7 +848,7 @@ void SimpleValueSaveUTest::test_incoming()
846848 AtomSpacePtr as = createAtomSpace();
847849 Handle hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
848850 StorageNodePtr store = StorageNodeCast(hsn);
849 store->open();
851 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
850852 TS_ASSERT(store->connected())
851853
852854 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -933,7 +935,7 @@ void SimpleValueSaveUTest::test_incoming()
933935 as = createAtomSpace();
934936 hsn = as->add_node(COG_SIMPLE_STORAGE_NODE, std::string(uri));
935937 store = StorageNodeCast(hsn);
936 store->open();
938 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
937939 TS_ASSERT(store->connected())
938940
939941 // --------------------
……@@ -953,9 +955,9 @@ void SimpleValueSaveUTest::test_incoming()
953955 store->fetch_incoming_set(gat, false);
954956 store->fetch_incoming_set(gal, false);
955957 store->fetch_incoming_set(gav, false);
956 // +1 for *-IsKeyFlag-*
957 printf ("AtomSpace now contains %lu atoms, expecting 16\n", as->get_size());
958 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 16);
958 // +1 for *-IsKeyFlag-*, +1 for *-open-*
959 printf ("AtomSpace now contains %lu atoms, expecting 17\n", as->get_size());
960 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 17);
959961
960962 Handle gbf = as->add_node(CONCEPT_NODE, "b float node");
961963 Handle gbt = as->add_node(CONCEPT_NODE, "b string node");
tests/persist/cog-storage/AlphaEquivUTest.cxxtest +9 -8
……@@ -32,6 +32,7 @@
3232#include <opencog/atoms/base/Node.h>
3333#include <opencog/atomspace/AtomSpace.h>
3434#include <opencog/atoms/value/FloatValue.h>
35#include <opencog/atoms/value/VoidValue.h>
3536#include <opencog/persist/cog-storage/CogStorage.h>
3637#include "../TestCogServer.h"
3738
……@@ -129,7 +130,7 @@ void AlphaEquivUTest::setup_data(void)
129130
130131 Handle hsn = _as->add_node(COG_STORAGE_NODE, std::string(uri));
131132 StorageNodePtr store = StorageNodeCast(hsn);
132 store->open();
133 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
133134 TS_ASSERT(store->connected())
134135
135136 /* Populate the Storage with stuff that we will later query. */
……@@ -141,7 +142,7 @@ void AlphaEquivUTest::setup_data(void)
141142 /* Push all atoms out to the database */
142143 store->store_atomspace();
143144 store->barrier();
144 store->close();
145 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
145146}
146147
147148// ============================================================
……@@ -156,7 +157,7 @@ void AlphaEquivUTest::test_fetch(void)
156157 _as = createAtomSpace();
157158 Handle hsn = _as->add_node(COG_STORAGE_NODE, std::string(uri));
158159 StorageNodePtr store = StorageNodeCast(hsn);
159 store->open();
160 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
160161 TS_ASSERT(store->connected())
161162
162163 // Fetch an alpha-equivalent lambda link.
……@@ -185,7 +186,7 @@ void AlphaEquivUTest::test_fetch(void)
185186 FloatValuePtr fup = FloatValueCast(fu);
186187 TSM_ASSERT_EQUALS("Expecting three floats", fup->size(), 3);
187188
188 store->close();
189 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
189190 logger().info("END TEST: %s", __FUNCTION__);
190191}
191192
……@@ -201,7 +202,7 @@ void AlphaEquivUTest::test_remove(void)
201202 _as = createAtomSpace();
202203 Handle hsn = _as->add_node(COG_STORAGE_NODE, std::string(uri));
203204 StorageNodePtr store = StorageNodeCast(hsn);
204 store->open();
205 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
205206 TS_ASSERT(store->connected())
206207
207208 // Remove the alpha-equivalent lambda link.
……@@ -222,7 +223,7 @@ void AlphaEquivUTest::test_remove(void)
222223 ValuePtr fu = lx->getValue(an(PREDICATE, "foo"));
223224 TSM_ASSERT("Expecting null value", nullptr == fu);
224225
225 store->close();
226 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
226227 logger().info("END TEST: %s", __FUNCTION__);
227228}
228229
……@@ -238,7 +239,7 @@ void AlphaEquivUTest::test_recursive_remove(void)
238239 _as = createAtomSpace();
239240 Handle hsn = _as->add_node(COG_STORAGE_NODE, std::string(uri));
240241 StorageNodePtr store = StorageNodeCast(hsn);
241 store->open();
242 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
242243 TS_ASSERT(store->connected())
243244
244245 // Recursive remove Concept "A".
……@@ -258,7 +259,7 @@ void AlphaEquivUTest::test_recursive_remove(void)
258259 ValuePtr fu = lx->getValue(an(PREDICATE, "foo"));
259260 TSM_ASSERT("Expecting null value", nullptr == fu);
260261
261 store->close();
262 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
262263 logger().info("END TEST: %s", __FUNCTION__);
263264}
264265
tests/persist/cog-storage/BasicDeleteUTest.cxxtest +64 -55
……@@ -33,6 +33,7 @@
3333#include <opencog/persist/cog-types/atom_types.h>
3434#include <opencog/atoms/value/FloatValue.h>
3535#include <opencog/atoms/value/LinkValue.h>
36#include <opencog/atoms/value/VoidValue.h>
3637#include <opencog/atomspace/AtomSpace.h>
3738#include "../TestCogServer.h"
3839
……@@ -92,8 +93,8 @@ void BasicDeleteUTest::tearDown(void)
9293}
9394
9495// 9 more from CogServerNode and gorp; 2 for *-TruthValueKey-* and
95// *-IsKeyFlag-*
96int basic_offset = 9 + 2;
96// *-IsKeyFlag-*; 1 more for *-open-*
97int basic_offset = 9 + 3;
9798
9899// ============================================================
99100
……@@ -106,7 +107,7 @@ void BasicDeleteUTest::test_duplicates(void)
106107 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
107108 StorageNodePtr store = StorageNodeCast(hsn);
108109
109 store->open();
110 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
110111 TS_ASSERT(store->connected())
111112
112113 // Clear out left-over junk, just in case.
……@@ -120,23 +121,24 @@ void BasicDeleteUTest::test_duplicates(void)
120121 store->store_atom(li);
121122 store->barrier();
122123
123 // Verify the atomspace size
124 TS_ASSERT_EQUALS(as->get_size(), 4);
124 // Verify the atomspace size (+1 for *-open-* predicate)
125 TS_ASSERT_EQUALS(as->get_size(), 5);
125126
126127 // Remove the link. Since the link has duplicate atoms
127128 // in it, this can cause trouble, depending on how the
128129 // incoming set is managed.
129130 store->remove_atom(as, li);
130 TS_ASSERT_EQUALS(as->get_size(), 4);
131 store->close();
131 TS_ASSERT_EQUALS(as->get_size(), 5);
132 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
132133 as->extract_atom(li);
133 TS_ASSERT_EQUALS(as->get_size(), 3);
134 store->open();
134 TS_ASSERT_EQUALS(as->get_size(), 5);
135 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
135136 store->load_atomspace();
136 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
137 // +1 for *-close-* predicate from above
138 TS_ASSERT_EQUALS(as->get_size(), 4 + basic_offset);
137139
138140 ::kill_data(store.get(), _test_asp.get());
139 store->close();
141 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
140142
141143 logger().debug("END TEST: %s", __FUNCTION__);
142144}
……@@ -152,7 +154,7 @@ void BasicDeleteUTest::test_recursive(void)
152154 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
153155 StorageNodePtr store = StorageNodeCast(hsn);
154156
155 store->open();
157 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
156158 TS_ASSERT(store->connected())
157159
158160 // Clear out left-over junk, just in case.
……@@ -173,8 +175,8 @@ void BasicDeleteUTest::test_recursive(void)
173175 for (const Handle& h : hset)
174176 printf("Atomspace contains: %s\n", h->to_short_string().c_str());
175177
176 // Verify the atomspace size
177 TS_ASSERT_EQUALS(as->get_size(), 5);
178 // Verify the atomspace size (+1 for *-open-* predicate)
179 TS_ASSERT_EQUALS(as->get_size(), 6);
178180
179181 // Remove (Concept "a"). Since this appears twice, recursion
180182 // will hit it twice, in stange ways, and maybe crash.
……@@ -186,11 +188,12 @@ void BasicDeleteUTest::test_recursive(void)
186188 for (const Handle& h : hset)
187189 printf("Post delete: %s\n", h->to_short_string().c_str());
188190
189 store->close();
191 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
190192 as->extract_atom(ha, true);
191 store->open();
193 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
192194 store->load_atomspace();
193 TS_ASSERT_EQUALS(as->get_size(), 2 + basic_offset);
195 // +1 for *-close-* predicate from above
196 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
194197
195198 // --------------------------------------
196199 // Do it again, but with a different order.
……@@ -200,17 +203,19 @@ void BasicDeleteUTest::test_recursive(void)
200203
201204 store->store_atom(lj);
202205 store->barrier();
203 store->close();
204 store->open();
206 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
207 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
205208 store->load_atomspace();
206 TS_ASSERT_EQUALS(as->get_size(), 5 + basic_offset);
209 // +1 for *-close-* predicate from above
210 TS_ASSERT_EQUALS(as->get_size(), 6 + basic_offset);
207211
208212 store->remove_atom(as, ha, true);
209 store->close();
213 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
210214 as->extract_atom(ha, true);
211 store->open();
215 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
212216 store->load_atomspace();
213 TS_ASSERT_EQUALS(as->get_size(), 2 + basic_offset);
217 // +1 for *-close-* predicate from above
218 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
214219
215220 // --------------------------------------
216221 // Do it again, but with a complex order.
……@@ -220,17 +225,19 @@ void BasicDeleteUTest::test_recursive(void)
220225
221226 store->store_atom(lj);
222227 store->barrier();
223 store->close();
224 store->open();
228 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
229 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
225230 store->load_atomspace();
226 TS_ASSERT_EQUALS(as->get_size(), 5 + basic_offset);
231 // +1 for *-close-* predicate from above
232 TS_ASSERT_EQUALS(as->get_size(), 6 + basic_offset);
227233
228234 store->remove_atom(as, ha, true);
229 store->close();
235 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
230236 as->extract_atom(ha, true);
231 store->open();
237 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
232238 store->load_atomspace();
233 TS_ASSERT_EQUALS(as->get_size(), 2 + basic_offset);
239 // +1 for *-close-* predicate from above
240 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
234241
235242 // --------------------------------------
236243 // Do it again, but more deeply.
……@@ -241,21 +248,23 @@ void BasicDeleteUTest::test_recursive(void)
241248
242249 store->store_atom(lk);
243250 store->barrier();
244 store->close();
245 store->open();
251 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
252 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
246253 store->load_atomspace();
247 TS_ASSERT_EQUALS(as->get_size(), 6 + basic_offset);
254 // +1 for *-close-* predicate from above
255 TS_ASSERT_EQUALS(as->get_size(), 7 + basic_offset);
248256
249257 store->remove_atom(as, ha, true);
250 store->close();
258 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
251259 as->extract_atom(ha, true);
252 store->open();
260 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
253261 store->load_atomspace();
254 TS_ASSERT_EQUALS(as->get_size(), 2 + basic_offset);
262 // +1 for *-close-* predicate from above
263 TS_ASSERT_EQUALS(as->get_size(), 3 + basic_offset);
255264
256265 // --------------------------------------
257266 ::kill_data(store.get(), _test_asp.get());
258 store->close();
267 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
259268
260269 logger().debug("END TEST: %s", __FUNCTION__);
261270}
……@@ -272,7 +281,7 @@ void BasicDeleteUTest::test_key_deletion(void)
272281 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
273282 StorageNodePtr store = StorageNodeCast(hsn);
274283
275 store->open();
284 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
276285 TS_ASSERT(store->connected())
277286
278287 // Clear out left-over junk, just in case.
……@@ -291,8 +300,8 @@ void BasicDeleteUTest::test_key_deletion(void)
291300 store->store_atom(ha);
292301 store->barrier();
293302
294 // Verify the atomspace size (+1 for *-IsKeyFlag-*)
295 TS_ASSERT_EQUALS(as->get_size(), 6);
303 // Verify the atomspace size (+1 for *-IsKeyFlag-*, +1 for *-open-*)
304 TS_ASSERT_EQUALS(as->get_size(), 7);
296305
297306 // Verify that there are three keys
298307 HandleSet hs = ha->getKeys();
……@@ -304,14 +313,14 @@ void BasicDeleteUTest::test_key_deletion(void)
304313 // AtomSpace will allow this.
305314 store->remove_atom(as, kb);
306315 as->extract_atom(kb);
307 // +1 for *-IsKeyFlag-*
308 TS_ASSERT_EQUALS(as->get_size(), 6);
316 // +1 for *-IsKeyFlag-*, +1 for *-open-*
317 TS_ASSERT_EQUALS(as->get_size(), 7);
309318
310319 // Verify the key was deleted by loading only PredicateNodes.
311320 as = createAtomSpace();
312321 hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
313322 store = StorageNodeCast(hsn);
314 store->open();
323 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
315324 store->fetch_all_atoms_of_type(PREDICATE_NODE);
316325 store->barrier();
317326
……@@ -334,7 +343,7 @@ void BasicDeleteUTest::test_key_deletion(void)
334343 hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
335344 store = StorageNodeCast(hsn);
336345
337 store->open();
346 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
338347 TS_ASSERT(store->connected())
339348
340349 // We expect 5 atoms
……@@ -360,7 +369,7 @@ void BasicDeleteUTest::test_key_deletion(void)
360369 TS_ASSERT_EQUALS(hs.size(), 3);
361370
362371 ::kill_data(store.get(), _test_asp.get());
363 store->close();
372 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
364373
365374 logger().debug("END TEST: %s", __FUNCTION__);
366375}
……@@ -382,7 +391,7 @@ void BasicDeleteUTest::test_key_corruption(void)
382391 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
383392 StorageNodePtr store = StorageNodeCast(hsn);
384393
385 store->open();
394 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
386395 TS_ASSERT(store->connected())
387396
388397 // Clear out left-over junk, just in case.
……@@ -398,12 +407,12 @@ void BasicDeleteUTest::test_key_corruption(void)
398407 store->store_atom(hb);
399408 store->barrier();
400409
401 TS_ASSERT_EQUALS(as->get_size(), 5);
410 TS_ASSERT_EQUALS(as->get_size(), 6);
402411
403412 // Remove the value
404413 store->remove_atom(as, hx);
405414 as->extract_atom(hx);
406 TS_ASSERT_EQUALS(as->get_size(), 4);
415 TS_ASSERT_EQUALS(as->get_size(), 5);
407416
408417 // FYI, we should call store->close() at this point, but we
409418 // don't, because ... most users forget to do this too.
……@@ -419,7 +428,7 @@ void BasicDeleteUTest::test_key_corruption(void)
419428 hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
420429 store = StorageNodeCast(hsn);
421430
422 store->open();
431 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
423432 TS_ASSERT(store->connected())
424433
425434 // We expect 5 atoms: b, x, key-x, *-IsKeyFlag-*, StorageNode
……@@ -453,14 +462,14 @@ void BasicDeleteUTest::test_key_corruption(void)
453462 store->remove_atom(as, hx);
454463 as->extract_atom(hx);
455464 TS_ASSERT_EQUALS(as->get_size(), 5 + full_offset);
456 store->close();
457 store->open();
465 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
466 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
458467 store->load_atomspace();
459 // Size is 6 because (Concept "x") cannot be deleted.
460 TS_ASSERT_EQUALS(as->get_size(), 6 + full_offset);
468 // Size is 6 because (Concept "x") cannot be deleted. +1 for *-close-*
469 TS_ASSERT_EQUALS(as->get_size(), 7 + full_offset);
461470
462471 // We are done.
463 store->close();
472 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
464473
465474 // -------------------------------------------------------
466475 // Start again, with a fresh connection.
……@@ -471,7 +480,7 @@ void BasicDeleteUTest::test_key_corruption(void)
471480 hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
472481 store = StorageNodeCast(hsn);
473482
474 store->open();
483 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
475484 TS_ASSERT(store->connected())
476485
477486 // We expect 6 atoms
……@@ -491,7 +500,7 @@ void BasicDeleteUTest::test_key_corruption(void)
491500 TS_ASSERT_EQUALS(hs.size(), 2);
492501
493502 ::kill_data(store.get(), _test_asp.get());
494 store->close();
503 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
495504
496505 logger().debug("END TEST: %s", __FUNCTION__);
497506}
tests/persist/cog-storage/DeleteUTest.cxxtest +17 -16
……@@ -33,6 +33,7 @@
3333#include <opencog/atoms/base/Link.h>
3434#include <opencog/atoms/base/Node.h>
3535#include <opencog/atoms/value/FloatValue.h>
36#include <opencog/atoms/value/VoidValue.h>
3637#include <opencog/persist/cog-storage/CogStorage.h>
3738#include "../TestCogServer.h"
3839
……@@ -420,7 +421,7 @@ void DeleteUTest::test_remove(void)
420421
421422 Handle hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16005");
422423 StorageNodePtr store = StorageNodeCast(hsn);
423 store->open();
424 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
424425 TS_ASSERT(store->connected())
425426
426427 int idx = 0;
……@@ -443,10 +444,10 @@ void DeleteUTest::test_remove(void)
443444 /* Push all atoms out to storage */
444445 store->store_atomspace();
445446
446 // +1 for (Predicate "*-IsKeyFlag-*")
447 printf("Initial Atomspace size=%lu expect=%d\n", _as->get_size(), 7*idx+1);
447 // +1 for (Predicate "*-IsKeyFlag-*"), +1 for *-open-*
448 printf("Initial Atomspace size=%lu expect=%d\n", _as->get_size(), 7*idx+2);
448449 TSM_ASSERT("Initial unexpected atomspace size",
449 ((unsigned)(7*idx+1)) == _as->get_size());
450 ((unsigned)(7*idx+2)) == _as->get_size());
450451 /* Delete some atoms with non-empty incoming sets.
451452 * This should result in thier being removed from the atomspace,
452453 * but NOT fom the backend!
……@@ -456,9 +457,9 @@ void DeleteUTest::test_remove(void)
456457 for (i=0; i<idx; i++)
457458 extract_links(i, _as);
458459
459 // +1 for (Predicate "*-IsKeyFlag-*")
460 printf("Atomspace size=%lu expect=%d\n", _as->get_size(), 4*idx+1);
461 TSM_ASSERT("Post-extract unexpected atomspace size", ((unsigned)(4*idx+1)) == _as->get_size());
460 // +1 for (Predicate "*-IsKeyFlag-*"), +1 for *-open-*
461 printf("Atomspace size=%lu expect=%d\n", _as->get_size(), 4*idx+2);
462 TSM_ASSERT("Post-extract unexpected atomspace size", ((unsigned)(4*idx+2)) == _as->get_size());
462463
463464 /* Verify that the atoms can still be fetched from storage. */
464465 for (i=0; i<idx; i++) {
……@@ -470,9 +471,9 @@ void DeleteUTest::test_remove(void)
470471 for (i=0; i<idx; i++)
471472 delete_links(i, store);
472473
473 printf("Post-remove size=%lu expect=%d\n", _as->get_size(), 4*idx+3);
474 printf("Post-remove size=%lu expect=%d\n", _as->get_size(), 4*idx+4);
474475 TSM_ASSERT("Post-remove unexpected atomspace size",
475 ((unsigned)(4*idx+3)) == _as->get_size());
476 ((unsigned)(4*idx+4)) == _as->get_size());
476477
477478 /* Verify that the atoms are really gone from storage. */
478479 for (i=0; i<idx; i++) {
……@@ -480,9 +481,9 @@ void DeleteUTest::test_remove(void)
480481 check_remove(i, _as, "verify-gone");
481482 }
482483
483 printf("Post-referesh size=%lu expect=%d\n", _as->get_size(), 7*idx+3);
484 printf("Post-referesh size=%lu expect=%d\n", _as->get_size(), 7*idx+4);
484485 TSM_ASSERT("Post-refetch unexpected atomspace size",
485 ((unsigned)(7*idx+3)) == _as->get_size());
486 ((unsigned)(7*idx+4)) == _as->get_size());
486487
487488 /* Kill data for good */
488489 _as->clear();
……@@ -503,7 +504,7 @@ void DeleteUTest::test_recurse(void)
503504
504505 Handle hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16005");
505506 StorageNodePtr store = StorageNodeCast(hsn);
506 store->open();
507 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
507508 TS_ASSERT(store->connected())
508509
509510 int idx = 0;
……@@ -536,8 +537,8 @@ void DeleteUTest::test_recurse(void)
536537 for (i=0; i<zap; i++)
537538 extract_nodes(i, _as);
538539
539 // +1 for the *-IsKeyFlag-* predicate
540 size_t expsz = 7*(idx-zap) + 3*zap + 1;
540 // +1 for the *-IsKeyFlag-* predicate, +1 for *-open-* predicate
541 size_t expsz = 7*(idx-zap) + 3*zap + 2;
541542 printf("Atomspace size=%lu expect=%lu\n",
542543 _as->get_size(), expsz);
543544 TSM_ASSERT("Unexpected atomspace size", expsz == _as->get_size());
……@@ -564,9 +565,9 @@ void DeleteUTest::test_recurse(void)
564565 }
565566
566567 printf("Post-refetch size=%lu expect=%d\n",
567 _as->get_size(), 7*idx+3);
568 _as->get_size(), 7*idx+4);
568569 TSM_ASSERT("Unexpected atomspace size",
569 ((unsigned) 7*idx+3) == _as->get_size());
570 ((unsigned) 7*idx+4) == _as->get_size());
570571
571572 /* Check that the removed atoms really got zapped. */
572573 for (i=0; i<zap; i++) {
tests/persist/cog-storage/LargeFlatUTest.cxxtest +5 -4
……@@ -30,6 +30,7 @@
3030#include <opencog/atoms/base/Link.h>
3131#include <opencog/atoms/base/Node.h>
3232#include <opencog/atoms/value/FloatValue.h>
33#include <opencog/atoms/value/VoidValue.h>
3334#include <opencog/persist/cog-storage/CogStorage.h>
3435#include "../TestCogServer.h"
3536
……@@ -366,7 +367,7 @@ void LargeFlatUTest::test_atomspace(void)
366367
367368 Handle hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16008");
368369 StorageNodePtr store = StorageNodeCast(hsn);
369 store->open();
370 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
370371 TS_ASSERT(store->connected())
371372
372373 /* Create a large number of atoms */
……@@ -391,7 +392,7 @@ void LargeFlatUTest::test_atomspace(void)
391392 /* The clear above nuked the storage, so restart */
392393 hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16008");
393394 store = StorageNodeCast(hsn);
394 store->open();
395 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
395396 TS_ASSERT(store->connected())
396397
397398 /* Verify that the atoms can still be fetched from storage. */
……@@ -408,7 +409,7 @@ void LargeFlatUTest::test_atomspace(void)
408409 /* The clear above nuked the storage, so restart */
409410 hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16008");
410411 store = StorageNodeCast(hsn);
411 store->open();
412 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
412413 TS_ASSERT(store->connected())
413414
414415 /* Verify that the atoms can still be fetched from storage. */
……@@ -426,7 +427,7 @@ void LargeFlatUTest::test_atomspace(void)
426427 for (i=0; i<idx; i++)
427428 check_empty(i, _as);
428429
429 store->close();
430 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
430431 logger().debug("END TEST: %s", __FUNCTION__);
431432}
432433
tests/persist/cog-storage/LargeZipfUTest.cxxtest +5 -4
……@@ -32,6 +32,7 @@
3232#include <opencog/atoms/base/Link.h>
3333#include <opencog/atoms/base/Node.h>
3434#include <opencog/atoms/value/FloatValue.h>
35#include <opencog/atoms/value/VoidValue.h>
3536#include <opencog/persist/cog-storage/CogStorage.h>
3637#include "../TestCogServer.h"
3738
……@@ -292,7 +293,7 @@ void LargeZipfUTest::test_atomspace(void)
292293
293294 Handle hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16009");
294295 StorageNodePtr store = StorageNodeCast(hsn);
295 store->open();
296 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
296297 TS_ASSERT(store->connected())
297298
298299 /* Create a large number of atoms */
……@@ -315,7 +316,7 @@ void LargeZipfUTest::test_atomspace(void)
315316 /* The clear above nuked the storage, so restart */
316317 hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16009");
317318 store = StorageNodeCast(hsn);
318 store->open();
319 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
319320 TS_ASSERT(store->connected())
320321
321322 /* Verify that the atoms can still be fetched from storage. */
……@@ -330,7 +331,7 @@ void LargeZipfUTest::test_atomspace(void)
330331 /* The clear above nuked the storage, so restart */
331332 hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16009");
332333 store = StorageNodeCast(hsn);
333 store->open();
334 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
334335 TS_ASSERT(store->connected())
335336
336337 /* Verify that the atoms can still be fetched from storage. */
……@@ -345,7 +346,7 @@ void LargeZipfUTest::test_atomspace(void)
345346 /* Verify that the atoms are no longer being found. */
346347 check_empty(_as);
347348
348 store->close();
349 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
349350 logger().debug("END TEST: %s", __FUNCTION__);
350351}
351352
tests/persist/cog-storage/MultiDeleteUTest.cxxtest +15 -12
……@@ -34,6 +34,7 @@
3434#include <opencog/persist/cog-types/atom_types.h>
3535#include <opencog/atoms/value/FloatValue.h>
3636#include <opencog/atoms/value/LinkValue.h>
37#include <opencog/atoms/value/VoidValue.h>
3738#include <opencog/atomspace/AtomSpace.h>
3839
3940#include "../TestCogServer.h"
……@@ -152,7 +153,7 @@ void MultiDeleteUTest::test_add_delete(void)
152153 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
153154 store = StorageNodeCast(hsn);
154155
155 store->open();
156 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
156157 TS_ASSERT(store->connected())
157158
158159 // Clear out left-over junk, just in case.
……@@ -172,16 +173,16 @@ void MultiDeleteUTest::test_add_delete(void)
172173 printf("Post-update AtomSpace size=%lu\n", as->get_size());
173174 // printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
174175
175 // Verify the local AtomSpace size. Should be 34:
176 // The CogStrageNode itself, the (Concept "aaaa") and
177 // 16 from thread-id modulo 16
178 TS_ASSERT_EQUALS(as->get_size(), 2 + 2*(n_threads+6));
176 // Verify the local AtomSpace size. Should be 35:
177 // The CogStorageNode itself, the (Concept "aaaa") and
178 // 16 from thread-id modulo 16, plus *-open-* predicate
179 TS_ASSERT_EQUALS(as->get_size(), 3 + 2*(n_threads+6));
179180
180181 // Verify the remote AtomSpace: pull everything from the
181182 // cogserver, back to here. Do this "independently", by
182183 // closing the socket; this forces the cogserver through
183184 // its socket-close code, potentially exposing bugs.
184 store->close();
185 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
185186
186187 HandleSeq hs;
187188 as->get_handles_by_type(hs, CONCEPT_NODE);
……@@ -189,9 +190,10 @@ void MultiDeleteUTest::test_add_delete(void)
189190 as->extract_atom(h, true);
190191 hs.clear();
191192 printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
192 TS_ASSERT_EQUALS(as->get_size(), 1);
193 // CogStorageNode + *-close-* predicate + *-open-* predicate
194 TS_ASSERT_EQUALS(as->get_size(), 3);
193195
194 store->open();
196 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
195197 TS_ASSERT(store->connected())
196198
197199 store->load_atomspace();
……@@ -200,11 +202,12 @@ void MultiDeleteUTest::test_add_delete(void)
200202 // Size should be 20: the 18 from before plus that annoying
201203 // (Predicate "*-TruthValueKey-*") And also *-IsKeyFlag-*
202204 // And 9 more from CogServerNode gorp
205 // Plus *-open-* and *-close-* predicates
203206 // Well, actually, there is no guarantee that the removes will
204207 // happen after the stores. Best we can do is check lower and
205 // upper bounds of 20 and 36:
206 size_t min_size = 9 + 4 + n_threads + 6;
207 size_t max_size = 9 + 4 + 2*(n_threads + 6);
208 // upper bounds of 22 and 38:
209 size_t min_size = 9 + 4 + 2 + n_threads + 6;
210 size_t max_size = 9 + 4 + 2 + 2*(n_threads + 6);
208211 if (as->get_size() < min_size or max_size < as->get_size())
209212 printf("Error: Bad size! AtomSpace contents =\n%s\n",
210213 as->to_string().c_str());
……@@ -213,7 +216,7 @@ void MultiDeleteUTest::test_add_delete(void)
213216 TS_ASSERT(as->get_size() <= max_size);
214217
215218 ::kill_data(store.get(), _test_asp.get());
216 store->close();
219 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
217220 store = nullptr;
218221
219222 logger().debug("END TEST: %s", __FUNCTION__);
tests/persist/cog-storage/MultiPersistUTest.cxxtest +6 -5
……@@ -37,6 +37,7 @@
3737#include "../TestCogServer.h"
3838
3939#include <opencog/atoms/value/FloatValue.h>
40#include <opencog/atoms/value/VoidValue.h>
4041
4142#include <opencog/util/Logger.h>
4243
……@@ -132,13 +133,13 @@ void MultiPersistUTest::setUp(void)
132133
133134 Handle hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16006");
134135 store = StorageNodeCast(hsn);
135 store->open();
136 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
136137 TS_ASSERT(store->connected())
137138}
138139
139140void MultiPersistUTest::tearDown(void)
140141{
141 store->close();
142 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
142143 store = nullptr;
143144 _as = nullptr;
144145}
……@@ -436,7 +437,7 @@ void MultiPersistUTest::test_atomspace(void)
436437 /* The clear above nuked the storage, so restart */
437438 Handle hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16006");
438439 store = StorageNodeCast(hsn);
439 store->open();
440 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
440441 TS_ASSERT(store->connected())
441442
442443 int i, off;
……@@ -456,7 +457,7 @@ void MultiPersistUTest::test_atomspace(void)
456457 /* The clear above nuked the storage, so restart */
457458 hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16006");
458459 store = StorageNodeCast(hsn);
459 store->open();
460 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
460461 TS_ASSERT(store->connected())
461462
462463 /* Verify that the atoms can still be fetched from storage. */
……@@ -476,7 +477,7 @@ void MultiPersistUTest::test_atomspace(void)
476477 for (i=0; i<NATS; i++)
477478 check_empty(NHACK*off+i, _as);
478479
479 store->close();
480 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
480481 logger().debug("END TEST: %s", __FUNCTION__);
481482}
482483
tests/persist/cog-storage/MultiUserUTest.cxxtest +5 -4
……@@ -38,6 +38,7 @@
3838#include <opencog/persist/cog-storage/CogStorage.h>
3939#include "../TestCogServer.h"
4040#include <opencog/atoms/value/FloatValue.h>
41#include <opencog/atoms/value/VoidValue.h>
4142
4243#include <opencog/util/Logger.h>
4344
……@@ -162,7 +163,7 @@ void MultiUserUTest::connect_to_db(int i)
162163 _as[i] = createAtomSpace();
163164 Handle hsn = _as[i]->add_node(COG_STORAGE_NODE, "cog://localhost:16007");
164165 _store[i] = StorageNodeCast(hsn);
165 _store[i]->open();
166 _store[i]->setValue(_as[i]->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
166167 TS_ASSERT(_store[i]->connected())
167168}
168169
……@@ -439,7 +440,7 @@ void MultiUserUTest::run_user_test(int thread_id)
439440 TSM_ASSERT("Took too long to connect", end - start < 10);
440441
441442 add_atoms(thread_id);
442 _store[thread_id]->close();
443 _store[thread_id]->setValue(_as[thread_id]->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
443444 _as[thread_id] = nullptr;
444445}
445446
……@@ -463,7 +464,7 @@ void MultiUserUTest::do_test_multiuser(void)
463464 AtomSpacePtr aspace = createAtomSpace();
464465 Handle hsn = aspace->add_node(COG_STORAGE_NODE, "cog://localhost:16007");
465466 StorageNodePtr store = StorageNodeCast(hsn);
466 store->open();
467 store->setValue(aspace->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
467468 TS_ASSERT(store->connected())
468469
469470 for (int off=0; off<n_threads; off++)
……@@ -473,7 +474,7 @@ void MultiUserUTest::do_test_multiuser(void)
473474 }
474475
475476 store->barrier();
476 store->close();
477 store->setValue(aspace->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
477478 aspace = nullptr;
478479}
479480
tests/persist/cog-storage/PersistUTest.cxxtest +5 -4
……@@ -32,6 +32,7 @@
3232#include <opencog/atoms/base/Link.h>
3333#include <opencog/atoms/base/Node.h>
3434#include <opencog/atoms/value/FloatValue.h>
35#include <opencog/atoms/value/VoidValue.h>
3536#include "../TestCogServer.h"
3637
3738#include <opencog/persist/cog-storage/CogStorage.h>
……@@ -318,7 +319,7 @@ void PersistUTest::test_atomspace(void)
318319
319320 Handle hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16003");
320321 StorageNodePtr store = StorageNodeCast(hsn);
321 store->open();
322 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
322323 TS_ASSERT(store->connected())
323324
324325 int idx = 0;
……@@ -352,7 +353,7 @@ void PersistUTest::test_atomspace(void)
352353 /* The above clear wiped out the storage node; recreate it. */
353354 hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16003");
354355 store = StorageNodeCast(hsn);
355 store->open();
356 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
356357 TS_ASSERT(store->connected())
357358
358359 /* Verify that the atoms can still be fetched from storage. */
……@@ -368,7 +369,7 @@ void PersistUTest::test_atomspace(void)
368369 /* The above clear wiped out the storage node; recreate it. */
369370 hsn = _as->add_node(COG_STORAGE_NODE, "cog://localhost:16003");
370371 store = StorageNodeCast(hsn);
371 store->open();
372 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
372373 TS_ASSERT(store->connected())
373374
374375 /* Verify that the atoms can still be fetched from storage. */
……@@ -377,7 +378,7 @@ void PersistUTest::test_atomspace(void)
377378 check_space(i, _as, "ver-again");
378379 }
379380
380 store->close();
381 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
381382
382383 /* Kill data for good */
383384 _as->clear();
tests/persist/cog-storage/QueryPersistUTest.cxxtest +7 -6
……@@ -33,6 +33,7 @@
3333#include <opencog/atomspace/AtomSpace.h>
3434#include <opencog/atoms/value/FloatValue.h>
3535#include <opencog/atoms/value/LinkValue.h>
36#include <opencog/atoms/value/VoidValue.h>
3637#include <opencog/persist/cog-storage/CogStorage.h>
3738#include "../TestCogServer.h"
3839
……@@ -125,7 +126,7 @@ void QueryPersistUTest::setup_data(void)
125126 _as = createAtomSpace();
126127 Handle hsn = _as->add_node(COG_STORAGE_NODE, std::string(uri));
127128 StorageNodePtr store = StorageNodeCast(hsn);
128 store->open();
129 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
129130 TS_ASSERT(store->connected())
130131
131132 /* Populate the Storage with stuff that we will later query. */
……@@ -161,7 +162,7 @@ void QueryPersistUTest::setup_data(void)
161162 /* Push all atoms out to the server */
162163 store->store_atomspace();
163164 store->barrier();
164 store->close();
165 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
165166}
166167
167168void QueryPersistUTest::test_meet(void)
……@@ -173,7 +174,7 @@ void QueryPersistUTest::test_meet(void)
173174 _as = createAtomSpace();
174175 Handle hsn = _as->add_node(COG_STORAGE_NODE, std::string(uri));
175176 StorageNodePtr store = StorageNodeCast(hsn);
176 store->open();
177 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
177178 TS_ASSERT(store->connected())
178179
179180 // Create a query to find all things that have wheels.
……@@ -224,7 +225,7 @@ void QueryPersistUTest::test_meet(void)
224225 HandleSet htoo = lvp->to_handle_set();
225226 TSM_ASSERT("Expect same results as before", hset == htoo);
226227
227 store->close();
228 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
228229 logger().info("END TEST: %s", __FUNCTION__);
229230}
230231
……@@ -237,7 +238,7 @@ void QueryPersistUTest::test_join(void)
237238 _as = createAtomSpace();
238239 Handle hsn = _as->add_node(COG_STORAGE_NODE, std::string(uri));
239240 StorageNodePtr store = StorageNodeCast(hsn);
240 store->open();
241 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
241242 TS_ASSERT(store->connected())
242243
243244 // Create a join to find all vehicles.
……@@ -274,7 +275,7 @@ void QueryPersistUTest::test_join(void)
274275
275276 TSM_ASSERT_EQUALS("Expecting airplane, bicycle and car", hset, expect);
276277
277 store->close();
278 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
278279 logger().info("END TEST: %s", __FUNCTION__);
279280}
280281
tests/persist/cog-storage/ValueSaveUTest.cxxtest +28 -25
……@@ -36,6 +36,7 @@
3636#include <opencog/atoms/value/FloatValue.h>
3737#include <opencog/atoms/value/LinkValue.h>
3838#include <opencog/atoms/value/StringValue.h>
39#include <opencog/atoms/value/VoidValue.h>
3940#include "../TestCogServer.h"
4041
4142#include <opencog/persist/cog-storage/CogStorage.h>
……@@ -108,7 +109,7 @@ void ValueSaveUTest::test_single_atom_save()
108109 AtomSpacePtr as = createAtomSpace();
109110 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
110111 StorageNodePtr store = StorageNodeCast(hsn);
111 store->open();
112 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
112113 TS_ASSERT(store->connected())
113114
114115 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -154,6 +155,7 @@ void ValueSaveUTest::test_single_atom_save()
154155 store->store_atom(atom);
155156 store->barrier();
156157
158 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
157159 as = nullptr;
158160
159161 logger().info("END TEST: %s", __FUNCTION__);
……@@ -174,7 +176,7 @@ void ValueSaveUTest::check_one(ValuePtr pap, bool fetchkey)
174176 AtomSpacePtr as = createAtomSpace();
175177 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
176178 StorageNodePtr store = StorageNodeCast(hsn);
177 store->open();
179 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
178180 TS_ASSERT(store->connected())
179181
180182 Handle key = store->fetch_atom(bkey);
……@@ -197,7 +199,7 @@ void ValueSaveUTest::check_one(ValuePtr pap, bool fetchkey)
197199 as = createAtomSpace();
198200 hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
199201 store = StorageNodeCast(hsn);
200 store->open();
202 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
201203 TS_ASSERT(store->connected())
202204
203205 // Storage uses a different code path if the key is not yet
……@@ -222,7 +224,7 @@ void ValueSaveUTest::test_save_restore(bool fkey)
222224 AtomSpacePtr as = createAtomSpace();
223225 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
224226 StorageNodePtr store = StorageNodeCast(hsn);
225 store->open();
227 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
226228 TS_ASSERT(store->connected())
227229
228230 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -278,7 +280,7 @@ void ValueSaveUTest::test_load_by_type()
278280 AtomSpacePtr as = createAtomSpace();
279281 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
280282 StorageNodePtr store = StorageNodeCast(hsn);
281 store->open();
283 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
282284 TS_ASSERT(store->connected())
283285
284286 // Clear out left-over junk, just in case.
……@@ -339,7 +341,7 @@ void ValueSaveUTest::test_load_by_type()
339341 as = createAtomSpace();
340342 hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
341343 store = StorageNodeCast(hsn);
342 store->open();
344 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
343345 TS_ASSERT(store->connected())
344346
345347 // --------------------
……@@ -347,12 +349,13 @@ void ValueSaveUTest::test_load_by_type()
347349 store->fetch_all_atoms_of_type(CONCEPT_NODE);
348350 store->barrier();
349351
350 // Seven: 4 ConceptNodes, the PredicateNode "*-TruthValueKey-*",
351 // PredicateNode "some pred key", and PredicateNode "*-IsKeyFlag-*"
352 // Nine: 4 ConceptNodes, the PredicateNode "*-TruthValueKey-*",
353 // PredicateNode "some pred key", PredicateNode "*-IsKeyFlag-*",
354 // the CogStorageNode, and PredicateNode "*-open-*"
352355 // -- the preds show up when the attached values are fetched.
353 printf ("fetched %lu atoms, expecting 8\n", as->get_size());
356 printf ("fetched %lu atoms, expecting 9\n", as->get_size());
354357 // printf("contents=%s\n", as->to_string().c_str());
355 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 8);
358 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 9);
356359
357360 Handle gkey = as->add_node(PREDICATE_NODE, "some pred key");
358361 Handle gaf = as->add_node(CONCEPT_NODE, "float node");
……@@ -407,7 +410,7 @@ void ValueSaveUTest::test_link_by_type()
407410 AtomSpacePtr as = createAtomSpace();
408411 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
409412 StorageNodePtr store = StorageNodeCast(hsn);
410 store->open();
413 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
411414 TS_ASSERT(store->connected())
412415
413416 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -494,7 +497,7 @@ void ValueSaveUTest::test_link_by_type()
494497 as = createAtomSpace();
495498 hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
496499 store = StorageNodeCast(hsn);
497 store->open();
500 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
498501 TS_ASSERT(store->connected())
499502
500503 // --------------------
……@@ -510,12 +513,12 @@ void ValueSaveUTest::test_link_by_type()
510513 // The B-nodes are added after the fetch. In either case,
511514 // there should not be any values fetched for either A or B;
512515 // only the values on the C-links should be fetched.
513 // +1 for (PredicateNode "*-IsKeyFlag-*")
516 // +1 for (PredicateNode "*-IsKeyFlag-*"), +1 for *-open-*
514517 store->fetch_all_atoms_of_type(LIST_LINK);
515518 store->barrier();
516 printf ("fetched %lu atoms, expecting 16\n", as->get_size());
519 printf ("fetched %lu atoms, expecting 17\n", as->get_size());
517520 // printf("contents=%s\n", as->to_string().c_str());
518 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 16);
521 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 17);
519522
520523 Handle gbf = as->add_node(CONCEPT_NODE, "b float node");
521524 Handle gbt = as->add_node(CONCEPT_NODE, "b string node");
……@@ -616,7 +619,7 @@ void ValueSaveUTest::test_link_by_type_quoted()
616619 AtomSpacePtr as = createAtomSpace();
617620 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
618621 StorageNodePtr store = StorageNodeCast(hsn);
619 store->open();
622 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
620623 TS_ASSERT(store->connected())
621624
622625 Handle key = as->add_node(PREDICATE_NODE, "some (\"pred\"))) key");
……@@ -703,7 +706,7 @@ void ValueSaveUTest::test_link_by_type_quoted()
703706 as = createAtomSpace();
704707 hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
705708 store = StorageNodeCast(hsn);
706 store->open();
709 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
707710 TS_ASSERT(store->connected())
708711
709712 // --------------------
……@@ -722,10 +725,10 @@ void ValueSaveUTest::test_link_by_type_quoted()
722725 store->fetch_all_atoms_of_type(LIST_LINK);
723726 store->barrier();
724727
725 // We created 9 new atoms above, so expect 16 from before plus 9
726 // (+1 for *-IsKeyFlag-*)
727 printf ("fetched %lu atoms, expecting 25\n", as->get_size());
728 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 25);
728 // We created 9 new atoms above, so expect 17 from before plus 9
729 // (+1 for *-IsKeyFlag-*, +1 for *-open-*)
730 printf ("fetched %lu atoms, expecting 26\n", as->get_size());
731 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 26);
729732
730733 Handle gbf = as->add_node(CONCEPT_NODE, "b float node");
731734 Handle gbt = as->add_node(CONCEPT_NODE, "b string node");
……@@ -829,7 +832,7 @@ void ValueSaveUTest::test_incoming()
829832 AtomSpacePtr as = createAtomSpace();
830833 Handle hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
831834 StorageNodePtr store = StorageNodeCast(hsn);
832 store->open();
835 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
833836 TS_ASSERT(store->connected())
834837
835838 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -916,7 +919,7 @@ void ValueSaveUTest::test_incoming()
916919 as = createAtomSpace();
917920 hsn = as->add_node(COG_STORAGE_NODE, std::string(uri));
918921 store = StorageNodeCast(hsn);
919 store->open();
922 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
920923 TS_ASSERT(store->connected())
921924
922925 // --------------------
……@@ -937,8 +940,8 @@ void ValueSaveUTest::test_incoming()
937940 store->fetch_incoming_set(gal, false);
938941 store->fetch_incoming_set(gav, false);
939942 store->barrier();
940 // +1 for *-IsKeyFlag-*
941 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 16);
943 // +1 for *-IsKeyFlag-*, +1 for *-open-*
944 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 17);
942945
943946 Handle gbf = as->add_node(CONCEPT_NODE, "b float node");
944947 Handle gbt = as->add_node(CONCEPT_NODE, "b string node");