From 83f33c061b66968c839ac239ffe033fc1fc69511 Mon Sep 17 00:00:00 2001 From: bvonhall Date: Mon, 4 May 2020 08:53:27 +0200 Subject: [PATCH 1/3] add a test for the retrieval of headers from ccdb --- CCDB/test/testCcdbApi.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CCDB/test/testCcdbApi.cxx b/CCDB/test/testCcdbApi.cxx index 4a17989508245..9fddd7eab1e2c 100644 --- a/CCDB/test/testCcdbApi.cxx +++ b/CCDB/test/testCcdbApi.cxx @@ -239,6 +239,27 @@ BOOST_AUTO_TEST_CASE(timestamptest, *utf::precondition(if_reachable())) BOOST_CHECK(pupper == nullptr); } +BOOST_AUTO_TEST_CASE(retrieveTemplatedWithHeaders, *utf::precondition(if_reachable())) +{ + test_fixture f; + + // first store something + o2::ccdb::IdPath path; + path.setPath("HelloWorld"); + long from = o2::ccdb::getCurrentTimestamp(); + long to = o2::ccdb::getFutureTimestamp(60 * 60 * 24 * 365 * 10); + f.api.storeAsTFileAny(&path, basePath + "CCDBPathUnitTest", f.metadata, from, to); + + // then try to retrieve, including the headers + std::map headers; + std::map meta; + cout << "basePath + \"CCDBPathUnitTest\" : " << basePath + "CCDBPathUnitTest" << endl; + cout << "from+1 : " << from+1 << endl; + auto* object = f.api.retrieveFromTFileAny(basePath + "CCDBPathUnitTest", meta, from+1, &headers); + BOOST_CHECK(headers.count("Hello") == 1); + cout << "header Hello : " << headers["Hello"] << endl; +} + BOOST_AUTO_TEST_CASE(retrieveTMemFile_test, *utf::precondition(if_reachable())) { test_fixture f; From 0f89451a2db8df8a4f72f8eceb96ac91e3f719e2 Mon Sep 17 00:00:00 2001 From: bvonhall Date: Mon, 4 May 2020 08:54:48 +0200 Subject: [PATCH 2/3] one more check --- CCDB/test/testCcdbApi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CCDB/test/testCcdbApi.cxx b/CCDB/test/testCcdbApi.cxx index 9fddd7eab1e2c..09853c1c73d29 100644 --- a/CCDB/test/testCcdbApi.cxx +++ b/CCDB/test/testCcdbApi.cxx @@ -257,7 +257,7 @@ BOOST_AUTO_TEST_CASE(retrieveTemplatedWithHeaders, *utf::precondition(if_reachab cout << "from+1 : " << from+1 << endl; auto* object = f.api.retrieveFromTFileAny(basePath + "CCDBPathUnitTest", meta, from+1, &headers); BOOST_CHECK(headers.count("Hello") == 1); - cout << "header Hello : " << headers["Hello"] << endl; + BOOST_CHECK(headers["Hello"] == "World"); } BOOST_AUTO_TEST_CASE(retrieveTMemFile_test, *utf::precondition(if_reachable())) From 573eac2a5b92408ba0d94546a3371437a3372d30 Mon Sep 17 00:00:00 2001 From: bvonhall Date: Mon, 4 May 2020 09:33:18 +0200 Subject: [PATCH 3/3] format --- CCDB/test/testCcdbApi.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CCDB/test/testCcdbApi.cxx b/CCDB/test/testCcdbApi.cxx index 09853c1c73d29..f5a619eb09de3 100644 --- a/CCDB/test/testCcdbApi.cxx +++ b/CCDB/test/testCcdbApi.cxx @@ -254,8 +254,8 @@ BOOST_AUTO_TEST_CASE(retrieveTemplatedWithHeaders, *utf::precondition(if_reachab std::map headers; std::map meta; cout << "basePath + \"CCDBPathUnitTest\" : " << basePath + "CCDBPathUnitTest" << endl; - cout << "from+1 : " << from+1 << endl; - auto* object = f.api.retrieveFromTFileAny(basePath + "CCDBPathUnitTest", meta, from+1, &headers); + cout << "from+1 : " << from + 1 << endl; + auto* object = f.api.retrieveFromTFileAny(basePath + "CCDBPathUnitTest", meta, from + 1, &headers); BOOST_CHECK(headers.count("Hello") == 1); BOOST_CHECK(headers["Hello"] == "World"); }