Skip to content
Snippets Groups Projects
Commit a4850214 authored by Jan Reher's avatar Jan Reher
Browse files

Testing TestXmlStructure

parent 428ea06d
No related branches found
No related tags found
2 merge requests!4Many proven updates being brought into stable branch.,!3Commented in the lines in apdUnitCreator.cpp that do the actual database
......@@ -16,6 +16,14 @@ void assignToModule(std::vector<uint> barcodes, std::string moduleSN);
int main() {
initialize();
std::vector<uint> barcodes;
barcodes.push_back(0);
barcodes.push_back(0);
barcodes.push_back(0);
barcodes.push_back(0);
barcodes.push_back(0);
barcodes.push_back(0);
barcodes.push_back(0);
barcodes.push_back(0);
barcodes.push_back(1309009619);
barcodes.push_back(1309009602);
barcodes.push_back(1309009633);
......@@ -36,6 +44,10 @@ void initialize() {
}
void assignToModule(std::vector<uint> barcodes, std::string moduleSN) {
if (barcodes.size() != 16) {
throw "Vector with barcodes must contain exactly 16 elements!";
}
QString buffer;
QXmlStreamWriter xml ( &buffer );
......@@ -43,22 +55,15 @@ void assignToModule(std::vector<uint> barcodes, std::string moduleSN) {
xml.writeStartDocument( QString::fromUtf8( "1.0" ) );
xml.writeStartElement( QString::fromUtf8( "productiondb" ) ) ;
xml.writeTextElement("moduleSN",QString::fromStdString(moduleSN));
xml.writeEmptyElement("Slot0");
xml.writeEmptyElement("Slot1");
xml.writeEmptyElement("Slot2");
xml.writeEmptyElement("Slot3");
xml.writeEmptyElement("Slot4");
xml.writeEmptyElement("Slot5");
xml.writeEmptyElement("Slot6");
xml.writeEmptyElement("Slot7");
xml.writeTextElement("Slot8",QString::number(barcodes[0]));
xml.writeTextElement("Slot9",QString::number(barcodes[1] ));
xml.writeTextElement("SlotA",QString::number(barcodes[2] ));
xml.writeTextElement("SlotB",QString::number(barcodes[3] ));
xml.writeTextElement("SlotC",QString::number(barcodes[4] ));
xml.writeTextElement("SlotD",QString::number(barcodes[5] ));
xml.writeTextElement("SlotE",QString::number(barcodes[6] ));
xml.writeTextElement("SlotF",QString::number(barcodes[7] ));
for (size_t i = 0; i < 16; i++) {
std::string entryname = std::string("Slot") + std::to_string(i);
if (barcodes[i]==0)
xml.writeEmptyElement(QString::fromStdString(entryname));
else
xml.writeTextElement(QString::fromStdString(entryname),QString::number(barcodes[i]));
}
xml.writeEndDocument();
std::string xmlRequest = buffer.toStdString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment