1 |
afaq |
1.1 |
#include "DBSDispatcher.hpp"
|
2 |
|
|
#include "Message.hpp"
|
3 |
|
|
#include "RowNSchemaBinding.hpp"
|
4 |
|
|
#include "BaseSchemaNConstratints.hpp"
|
5 |
|
|
#include "ObjectLayerTables.hpp"
|
6 |
|
|
#include "Configuration.hpp"
|
7 |
|
|
#include <iostream>
|
8 |
|
|
|
9 |
|
|
int test_file_mview(DBManagement* dbManager) {
|
10 |
|
|
|
11 |
|
|
FileviewMultiTable* fTable = new FileviewMultiTable(dbManager);
|
12 |
|
|
typedef vector<Fileviewmultirow*> MyRows;
|
13 |
|
|
typedef MyRows::iterator MyRowIter;
|
14 |
|
|
//MyRows myRows = fTable->select("t_file.id=1");
|
15 |
|
|
//MyRows myRows = fTable->select("t_evcoll_file.id=1");
|
16 |
|
|
MyRows myRows = fTable->select("t_evcoll_file.evcoll=200");
|
17 |
|
|
for(MyRowIter r = myRows.begin(); r != myRows.end(); ++r) {
|
18 |
|
|
//cout << "ANOTHER File Read from DB......";
|
19 |
|
|
Fileviewmultirow* aRow = (Fileviewmultirow*)*r;
|
20 |
|
|
cout<<"\n\nThe File Name is::: " << *(string*)aRow->getValue((string)"t_file.logical_name");
|
21 |
|
|
}
|
22 |
|
|
delete fTable;
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
int test_evcoll_mview(DBManagement* dbManager) {
|
27 |
|
|
|
28 |
|
|
EvcollviewMultiTable* ecTable = new EvcollviewMultiTable(dbManager);
|
29 |
|
|
typedef vector<Evcollviewmultirow*> MyRows;
|
30 |
|
|
typedef MyRows::iterator MyRowIter;
|
31 |
|
|
|
32 |
|
|
cout << "!!!! calling select on EvcollviewMultiTable !!!" << endl;
|
33 |
|
|
MyRows myRows = ecTable->select("processed_dataset=1");
|
34 |
|
|
//MyRows myRows = ecTable->select("(t_event_collection.processed_dataset=1) AND (t_event_collection.id=1)");
|
35 |
|
|
//MyRows myRows = ecTable->select("(t_event_collection.processed_dataset=1) AND (t_event_collection.id=1)");
|
36 |
|
|
cout << "!!!! select called on EvcollviewMultiTable !!!" << endl;
|
37 |
|
|
for(MyRowIter r = myRows.begin(); r != myRows.end(); ++r) {
|
38 |
|
|
//cout << "ANOTHER File Read from DB......";
|
39 |
|
|
Evcollviewmultirow* aRow = (Evcollviewmultirow*)*r;
|
40 |
|
|
cout<<"\n " << *(string*)aRow->getValue((string)"t_info_evcoll.name")
|
41 |
|
|
<< " "
|
42 |
|
|
<< *(int*)aRow->getValue((string)"t_info_evcoll.events") << endl;
|
43 |
|
|
}
|
44 |
|
|
delete ecTable;
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
int test_crabevcoll_manager(DBManagement* dbManager) {
|
49 |
|
|
Message mSend;
|
50 |
|
|
Message mRecv;
|
51 |
|
|
|
52 |
|
|
mSend.setName("ReadCRABEventCollection");
|
53 |
|
|
Element* e1 = new Element("t_primary_dataset.name","bt03_gg_bbh200_2taujmu","STRING");
|
54 |
|
|
//Element* e1 = new Element("t_event_collection.processed_dataset","1","INTEGER");
|
55 |
|
|
mSend.addElement(e1);
|
56 |
|
|
|
57 |
|
|
cout<<"Calling the DBSDispatcher"<<endl;
|
58 |
|
|
cout<<"Invoking Server Operation: " << mSend.getName() << endl;
|
59 |
|
|
DBSDispatcher dispatcher;
|
60 |
|
|
dispatcher.run(&mSend, mRecv);
|
61 |
|
|
cout<<"Returned From the DBSDispatcher"<<endl;
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
/*cout << "Dumping Contents of Returned Information" << endl;
|
65 |
|
|
cout<<"Exception is "<<mRecv.getException()<<endl;
|
66 |
|
|
Display only certain
|
67 |
|
|
for(int i = 0 ; i < mRecv.getNoOfElements(); ++i) {
|
68 |
|
|
Element* e = mRecv.getElement(i);
|
69 |
|
|
cout<<"Key is "<<e->getKey()<<endl;
|
70 |
|
|
cout<<"Value is "<<e->getValue()<<endl;
|
71 |
|
|
cout<<"Type is "<<e->getType()<<endl;
|
72 |
|
|
|
73 |
|
|
}*/
|
74 |
|
|
string message;
|
75 |
|
|
mRecv.serialize(message);
|
76 |
|
|
cout<<"Serialized MESSAGE is \n"<<message<<endl;
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
int test_evcoll_manager(DBManagement* dbManager) {
|
81 |
|
|
Message mSend;
|
82 |
|
|
Message mRecv;
|
83 |
|
|
|
84 |
|
|
mSend.setName("ReadEventCollection");
|
85 |
|
|
Element* e1 = new Element("processed_dataset","1","STRING");
|
86 |
|
|
//Element* e1 = new Element("t_event_collection.processed_dataset","1","INTEGER");
|
87 |
|
|
mSend.addElement(e1);
|
88 |
|
|
|
89 |
|
|
cout<<"Calling the DBSDispatcher"<<endl;
|
90 |
|
|
cout<<"Invoking Server Operation: " << mSend.getName() << endl;
|
91 |
|
|
DBSDispatcher dispatcher;
|
92 |
|
|
dispatcher.run(&mSend, mRecv);
|
93 |
|
|
cout<<"Returned From the DBSDispatcher"<<endl;
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
cout << "Dumping Contents of Returned Information" << endl;
|
97 |
|
|
cout<<"Exception is "<<mRecv.getException()<<endl;
|
98 |
|
|
/* Display only certain
|
99 |
|
|
for(int i = 0 ; i < mRecv.getNoOfElements(); ++i) {
|
100 |
|
|
Element* e = mRecv.getElement(i);
|
101 |
|
|
cout<<"Key is "<<e->getKey()<<endl;
|
102 |
|
|
cout<<"Value is "<<e->getValue()<<endl;
|
103 |
|
|
cout<<"Type is "<<e->getType()<<endl;
|
104 |
|
|
|
105 |
|
|
}*/
|
106 |
|
|
string message;
|
107 |
|
|
mRecv.serialize(message);
|
108 |
|
|
cout<<"Serialized MESSAGE is \n"<<message<<endl;
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
/*
|
112 |
|
|
int test_primaryds_managher(DBManagement* dbManager) {
|
113 |
|
|
Message mSend;
|
114 |
|
|
Message mRecv;
|
115 |
|
|
|
116 |
|
|
mSend.setName("ReadPrimaryDataset");
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
*/
|
120 |
|
|
|
121 |
|
|
/*
|
122 |
|
|
|
123 |
|
|
int test_dsProv_mview(DBManagement* dbManager) {
|
124 |
|
|
|
125 |
|
|
DatasetprovenenceMultiTable* fTable = new DatasetprovenenceMultiTable(dbManager);
|
126 |
|
|
typedef vector<Datasetprovenencemultirow*> MyRows;
|
127 |
|
|
typedef MyRows::iterator MyRowIter;
|
128 |
|
|
//MyRows myRows = fTable->select("t_event_collection.processed_dataset=3 AND t_evcoll_parentage.parent != t_event_collection.id ");
|
129 |
|
|
//MyRows myRows = fTable->select("t_event_collection.processed_dataset=4 AND t_evcoll_parentage.parent != t_event_collection.id ");
|
130 |
|
|
MyRows myRows = fTable->select("t_event_collection.processed_dataset=4");
|
131 |
|
|
cout <<"After the Dark !!!!!!!!!" << endl;
|
132 |
|
|
for(MyRowIter r = myRows.begin(); r != myRows.end(); ++r) {
|
133 |
|
|
//cout << "ANOTHER File Read from DB......";
|
134 |
|
|
Datasetprovenencemultirow* aRow = (Datasetprovenencemultirow*)*r;
|
135 |
|
|
cout<<"\n\nParents Name::: " << *(string*)aRow->getValue((string)"t_parentage_type.name");
|
136 |
|
|
//cout<<"\nt_processing_path.data_tier: " << *(string*)aRow->getValue((string)"t_processing_path.data_tier");
|
137 |
|
|
cout<<"\nt_processed_dataset.name: " << *(string*)aRow->getValue((string)"t_processed_dataset.name");
|
138 |
|
|
//t_primary_dataset.id
|
139 |
|
|
//t_processing_path.data_tier
|
140 |
|
|
//t_processed_dataset.name
|
141 |
|
|
}
|
142 |
|
|
delete fTable;
|
143 |
|
|
}
|
144 |
|
|
*/
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
int main(int argc, char* argv[]) {
|
149 |
|
|
//while(true) {
|
150 |
|
|
cout<<"Configuration* conf = Configuration::instance()"<<endl;
|
151 |
|
|
Configuration* conf = Configuration::instance();
|
152 |
|
|
cout<<"this->dbManager = new DBManagement(conf->getDsn(), conf->getDbUser() , conf->getDbPasswd());"<<endl;
|
153 |
|
|
cout<<"conf->getDsn() "<<conf->getDsn()
|
154 |
|
|
<<" conf->getDbUser() "<<conf->getDbUser()
|
155 |
|
|
<<" conf->getDbPasswd() "<<conf->getDbPasswd()<<endl;
|
156 |
|
|
DBManagement* dbManager = new DBManagement(conf->getDsn(), conf->getDbUser() , conf->getDbPasswd());
|
157 |
|
|
dbManager->open();
|
158 |
|
|
|
159 |
|
|
//test_file_mview(dbManager);
|
160 |
|
|
//test_evcoll_mview(dbManager);
|
161 |
|
|
//test_evcoll_manager(dbManager);
|
162 |
|
|
//test_dsProv_mview(dbManager);
|
163 |
sekhri |
1.2 |
while(true) {
|
164 |
|
|
test_crabevcoll_manager(dbManager);
|
165 |
|
|
}
|
166 |
afaq |
1.1 |
|
167 |
|
|
cout << "All tests done by the manager" << endl;
|
168 |
|
|
|
169 |
|
|
dbManager->close();
|
170 |
|
|
delete dbManager;
|
171 |
|
|
/*Message mSend;
|
172 |
|
|
Message mRecv;
|
173 |
|
|
ECWriteManager manager;
|
174 |
|
|
manager.write(&mSend,mRecv);*/
|
175 |
|
|
//}
|
176 |
|
|
/*cout<<"no of elements "<<mRecv.getNoOfElements()<<endl;
|
177 |
|
|
cout<<"Exception is "<<mRecv.getException()<<endl;
|
178 |
|
|
for(int i = 0 ; i < mRecv.getNoOfElements(); ++i) {
|
179 |
|
|
Element* e = mRecv.getElement(i);
|
180 |
|
|
cout<<"Key is "<<e->getKey()<<endl;
|
181 |
|
|
cout<<"Value is "<<e->getValue()<<endl;
|
182 |
|
|
cout<<"Type is "<<e->getType()<<endl;
|
183 |
|
|
}
|
184 |
|
|
string message;
|
185 |
|
|
mRecv.serialize(message);
|
186 |
|
|
cout<<"Serialized MESSAGE is \n"<<message<<endl;*/
|
187 |
|
|
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
int mainb(int argc, char* argv[]) {
|
192 |
|
|
Message mSend;
|
193 |
|
|
Message mRecv;
|
194 |
|
|
PrimaryDatasetManager* manager = new PrimaryDatasetManager();
|
195 |
|
|
manager->read(&mSend,mRecv);
|
196 |
|
|
delete manager;
|
197 |
|
|
|
198 |
|
|
cout<<"no of elements "<<mRecv.getNoOfElements()<<endl;
|
199 |
|
|
cout<<"Exception is "<<mRecv.getException()<<endl;
|
200 |
|
|
for(int i = 0 ; i < mRecv.getNoOfElements(); ++i) {
|
201 |
|
|
Element* e = mRecv.getElement(i);
|
202 |
|
|
cout<<"Key is "<<e->getKey()<<endl;
|
203 |
|
|
cout<<"Value is "<<e->getValue()<<endl;
|
204 |
|
|
cout<<"Type is "<<e->getType()<<endl;
|
205 |
|
|
}
|
206 |
|
|
string message;
|
207 |
|
|
mRecv.serialize(message);
|
208 |
|
|
cout<<"Serialized MESSAGE is \n"<<message<<endl;
|
209 |
|
|
|
210 |
|
|
}
|
211 |
|
|
|
212 |
|
|
int maina(int argc, char* argv[]) {
|
213 |
|
|
/*Primarydatasetmultirow * a = new Primarydatasetmultirow();
|
214 |
|
|
a->getValue((string)"triggerpathdescription.triggerpathdescriptionid");
|
215 |
|
|
*/
|
216 |
|
|
Message mSend;
|
217 |
|
|
Message mRecv;
|
218 |
|
|
/*mSend.setName("PrimaryDatasetManager");
|
219 |
|
|
Element* e1 = new Element("MCChannel","MCChannel","STRING");
|
220 |
|
|
Element* e2 = new Element("MCChannelDesc","MCChannelDesc","STRING");
|
221 |
|
|
Element* e3 = new Element("MCProductionDesc","MCProductionDesc","STRING");
|
222 |
|
|
Element* e4 = new Element("MCDecayChain","MCDecayChain","STRING");
|
223 |
|
|
Element* e5 = new Element("TriggerPath","TriggerPath","STRING");
|
224 |
|
|
Element* e6 = new Element("TriggerPathDesc","TriggerPathDesc","STRING");
|
225 |
|
|
Element* e7 = new Element("streamComments","streamCommentsaaa","STRING");
|
226 |
|
|
Element* e8 = new Element("primarydatasetname","primarydatasetnamebbbb","STRING");
|
227 |
|
|
Element* e9 = new Element("cobradatasetname","cobraddddddd","STRING");
|
228 |
|
|
Element* e10 = new Element("primarydatasetannotation","primary tset","STRING");
|
229 |
|
|
Element* e11 = new Element("physicsgroupname","physicsgroupnameeeee","STRING");
|
230 |
|
|
Element* e12 = new Element("streamname","streamnambbbb","STRING");
|
231 |
|
|
*/
|
232 |
|
|
|
233 |
|
|
Element* e1 = new Element("qpsannotation","qpsannotation","STRING");
|
234 |
|
|
Element* e2 = new Element("qpsname","qpsname","STRING");
|
235 |
|
|
Element* e3 = new Element("composite","y","CHARACTER");
|
236 |
|
|
Element* e4 = new Element("qpsversion","qpsversion","STRING");
|
237 |
|
|
|
238 |
|
|
Data* d1 = new Data();
|
239 |
|
|
Element* e5 = new Element("externaldatatype","externaldatatype1","STRING");
|
240 |
|
|
Element* e6 = new Element("parametername","parametername1","STRING");
|
241 |
|
|
Element* e7 = new Element("parametervalue","parametervalue1","STRING");
|
242 |
|
|
d1->push_back(e5);
|
243 |
|
|
d1->push_back(e6);
|
244 |
|
|
d1->push_back(e7);
|
245 |
|
|
|
246 |
|
|
Data* d2 = new Data();
|
247 |
|
|
e5 = new Element("externaldatatype","externaldatatype2","STRING");
|
248 |
|
|
e6 = new Element("parametername","parametername2","STRING");
|
249 |
|
|
e7 = new Element("parametervalue","parametervalue2","STRING");
|
250 |
|
|
d2->push_back(e5);
|
251 |
|
|
d2->push_back(e6);
|
252 |
|
|
d2->push_back(e7);
|
253 |
|
|
|
254 |
|
|
Data* d3 = new Data();
|
255 |
|
|
e5 = new Element("externaldatatype","externaldatatype3","STRING");
|
256 |
|
|
e6 = new Element("parametername","parametername3","STRING");
|
257 |
|
|
e7 = new Element("parametervalue","parametervalue3","STRING");
|
258 |
|
|
d3->push_back(e5);
|
259 |
|
|
d3->push_back(e6);
|
260 |
|
|
d3->push_back(e7);
|
261 |
|
|
|
262 |
|
|
Data* d4 = new Data();
|
263 |
|
|
e5 = new Element("externaldatatype","externaldatatype4","STRING");
|
264 |
|
|
e6 = new Element("parametername","parametername4","STRING");
|
265 |
|
|
e7 = new Element("parametervalue","parametervalue4","STRING");
|
266 |
|
|
d4->push_back(e5);
|
267 |
|
|
d4->push_back(e6);
|
268 |
|
|
d4->push_back(e7);
|
269 |
|
|
|
270 |
|
|
Data* d5 = new Data();
|
271 |
|
|
e5 = new Element("externaldatatype","externaldatatype5","STRING");
|
272 |
|
|
e6 = new Element("parametername","parametername5","STRING");
|
273 |
|
|
e7 = new Element("parametervalue","parametervalue5","STRING");
|
274 |
|
|
d5->push_back(e5);
|
275 |
|
|
d5->push_back(e6);
|
276 |
|
|
d5->push_back(e7);
|
277 |
|
|
VecData* vd = new VecData();
|
278 |
|
|
|
279 |
|
|
vd->push_back(d1);
|
280 |
|
|
vd->push_back(d2);
|
281 |
|
|
vd->push_back(d3);
|
282 |
|
|
vd->push_back(d4);
|
283 |
|
|
vd->push_back(d5);
|
284 |
|
|
|
285 |
|
|
mSend.addElement(e1);
|
286 |
|
|
mSend.addElement(e2);
|
287 |
|
|
mSend.addElement(e3);
|
288 |
|
|
mSend.addElement(e4);
|
289 |
|
|
mSend.addVecOfVecOfElement(vd,"extraparams");
|
290 |
|
|
|
291 |
|
|
/*mSend.addElement(e5);
|
292 |
|
|
mSend.addElement(e6);
|
293 |
|
|
mSend.addElement(e7);
|
294 |
|
|
mSend.addElement(e8);
|
295 |
|
|
mSend.addElement(e9);
|
296 |
|
|
mSend.addElement(e10);
|
297 |
|
|
mSend.addElement(e11);
|
298 |
|
|
mSend.addElement(e12);
|
299 |
|
|
PrimaryDatasetManager* manager = new PrimaryDatasetManager();*/
|
300 |
|
|
/*GenParamManager* manager = new GenParamManager();
|
301 |
|
|
manager->write(&mSend,mRecv);
|
302 |
|
|
cout << "Deleting Manager" << endl;
|
303 |
|
|
delete manager;
|
304 |
|
|
|
305 |
|
|
cout<<"no of elements "<<mRecv.getNoOfElements()<<endl;
|
306 |
|
|
cout<<"Exception is "<<mRecv.getException()<<endl;
|
307 |
|
|
for(int i = 0 ; i < mRecv.getNoOfElements(); ++i) {
|
308 |
|
|
Element* e = mRecv.getElement(i);
|
309 |
|
|
cout<<"Key is "<<e->getKey()<<endl;
|
310 |
|
|
cout<<"Value is "<<e->getValue()<<endl;
|
311 |
|
|
cout<<"Type is "<<e->getType()<<endl;
|
312 |
|
|
}
|
313 |
|
|
*/
|
314 |
|
|
return 0;
|
315 |
|
|
}
|
316 |
|
|
|