#include "XMLFileCatalog.h"
#include <cstdio>
#include <ctime>
#include <iostream>
#include <sstream>
Go to the source code of this file.
◆ testXMLFileCatalogRead()
int testXMLFileCatalogRead |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 72 of file XMLCatalogTest.cpp.
85 size_t mult = prt ? 1 : 10;
87 for (
size_t i = 0, tot = ( mult * fids.
size() ); i < tot; ++i ) {
88 size_t ent = i % fids.
size();
91 XMLFileCatalog::Files pfn, lfn;
92 XMLFileCatalog::Attributes attrs;
94 for (
auto& elem : lfn ) {
95 if ( !
c.existsLFN( elem.first ) ) {
105 c.getPFN( fid, pfn );
106 for (
auto& elem : pfn ) {
107 if ( !
c.existsPFN( elem.first ) ) {
117 c.getMetaData( fid, attrs );
118 size_t n = lfn.size() > pfn.size() ? lfn.size() : pfn.size();
119 n =
n > attrs.size() ?
n : attrs.size();
122 for (
size_t j = 0;
j <
n; ++
j ) {
123 if (
j < lfn.size() )
127 if (
j < pfn.size() )
131 if (
j < attrs.size() )
132 std::cout << attrs[
j].first <<
" " << attrs[
j].second <<
" ";
140 std::cout <<
"Used " <<
end <<
" seconds (" << (long)fids.
size() * mult <<
" entries)."
141 <<
" Corresponding to " << float(
end ) / float( fids.
size() * mult ) <<
" entries/second." <<
std::endl;
◆ testXMLFileCatalogWrite()
int testXMLFileCatalogWrite |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 19 of file XMLCatalogTest.cpp.
23 if (
argc > 2 ) nwrite = ::atol(
argv[2] );
29 for (
size_t n = fids.
size(), i =
n; i <
n + nwrite; ++i ) {
34 txt <<
"PFN1_Test_" << i <<
".dat";
35 c.registerPFN( fid, txt.
str(),
"ROOT" );
36 c.registerPFN( fid, txt.
str(),
"ROOT" );
38 txt <<
"PFN2_Test_" << i <<
".dat";
39 c.registerPFN( fid, txt.
str(),
"ROOT" );
41 txt <<
"PFN3_Test_" << i <<
".dat";
42 c.registerPFN( fid, txt.
str(),
"ROOT" );
44 txt <<
"lfn1_Test_" << i <<
".dat";
45 c.registerLFN( fid, txt.
str() );
47 txt <<
"lfn2_Test_" << i <<
".dat";
48 c.registerLFN( fid, txt.
str() );
50 txt <<
"lfn3_Test_" << i <<
".dat";
51 c.registerLFN( fid, txt.
str() );
52 c.setMetaData( fid,
"Name1",
"Value1" );
53 c.setMetaData( fid,
"Name1",
"Value111" );
54 c.setMetaData( fid,
"Name2",
"Value2" );
55 c.setMetaData( fid,
"Name3",
"Value3" );
59 <<
" corresponding to " << float(
end ) / float( nwrite ) <<
" entries/second." <<
std::endl;
63 std::cout <<
"Used " << saved <<
" seconds."
64 <<
" corresponding to " << float( saved ) / float( nwrite ) <<
" entries/second." <<
std::endl;