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); ...@@ -16,6 +16,14 @@ void assignToModule(std::vector<uint> barcodes, std::string moduleSN);
int main() { int main() {
initialize(); initialize();
std::vector<uint> barcodes; 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(1309009619);
barcodes.push_back(1309009602); barcodes.push_back(1309009602);
barcodes.push_back(1309009633); barcodes.push_back(1309009633);
...@@ -36,6 +44,10 @@ void initialize() { ...@@ -36,6 +44,10 @@ void initialize() {
} }
void assignToModule(std::vector<uint> barcodes, std::string moduleSN) { void assignToModule(std::vector<uint> barcodes, std::string moduleSN) {
if (barcodes.size() != 16) {
throw "Vector with barcodes must contain exactly 16 elements!";
}
QString buffer; QString buffer;
QXmlStreamWriter xml ( &buffer ); QXmlStreamWriter xml ( &buffer );
...@@ -43,22 +55,15 @@ void assignToModule(std::vector<uint> barcodes, std::string moduleSN) { ...@@ -43,22 +55,15 @@ void assignToModule(std::vector<uint> barcodes, std::string moduleSN) {
xml.writeStartDocument( QString::fromUtf8( "1.0" ) ); xml.writeStartDocument( QString::fromUtf8( "1.0" ) );
xml.writeStartElement( QString::fromUtf8( "productiondb" ) ) ; xml.writeStartElement( QString::fromUtf8( "productiondb" ) ) ;
xml.writeTextElement("moduleSN",QString::fromStdString(moduleSN)); xml.writeTextElement("moduleSN",QString::fromStdString(moduleSN));
xml.writeEmptyElement("Slot0");
xml.writeEmptyElement("Slot1"); for (size_t i = 0; i < 16; i++) {
xml.writeEmptyElement("Slot2"); std::string entryname = std::string("Slot") + std::to_string(i);
xml.writeEmptyElement("Slot3"); if (barcodes[i]==0)
xml.writeEmptyElement("Slot4"); xml.writeEmptyElement(QString::fromStdString(entryname));
xml.writeEmptyElement("Slot5"); else
xml.writeEmptyElement("Slot6"); xml.writeTextElement(QString::fromStdString(entryname),QString::number(barcodes[i]));
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] ));
xml.writeEndDocument(); xml.writeEndDocument();
std::string xmlRequest = buffer.toStdString(); 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