Commit 78e89487e94aac9257ada9917abe46f852bb9ede

Authored by Benjamin Renard
1 parent 4206bf69

Fix bugs with fileName for download and "One file per param/time interval" structures

src/ParamOutputImpl/Download/DownloadOutput.cc
... ... @@ -724,67 +724,64 @@ std::string DownloadOutput::getFilePath(std::string extension, bool infoFile)
724 724 filePath << "/";
725 725  
726 726 if (_downloadProperties.getFileName().empty())
727   - {
728 727 filePath << "output-";
  728 + else
  729 + filePath << _downloadProperties.getFileName() << "-";
729 730  
730   - //add parameters ids
731   - bool firstParam = true;
732   - for (auto paramProperties : _downloadProperties.getParamPropertiesList())
  731 + //add parameters ids
  732 + bool firstParam = true;
  733 + for (auto paramProperties : _downloadProperties.getParamPropertiesList())
  734 + {
  735 + if (!_currentParamId.empty())
733 736 {
734   - if (!_currentParamId.empty())
735   - {
736   - //add only current parameter id
737   - if (_currentParamId != paramProperties->getOutputId())
738   - continue;
739   - }
  737 + //add only current parameter id
  738 + if (_currentParamId != paramProperties->getOutputId())
  739 + continue;
  740 + }
740 741  
741   - if (!firstParam)
742   - filePath << "_";
743   - firstParam = false;
  742 + if (!firstParam)
  743 + filePath << "_";
  744 + firstParam = false;
744 745  
745   - filePath << paramProperties->getOriginalId();
  746 + filePath << paramProperties->getOriginalId();
746 747  
747   - //add indexes
748   - for (auto index : paramProperties->getIndexDefList())
749   - {
750   - boost::replace_all(index, "[", "");
751   - boost::replace_all(index, "]", "");
752   - boost::replace_all(index, "*", "x");
753   - filePath << "_" << index;
754   - }
  748 + //add indexes
  749 + for (auto index : paramProperties->getIndexDefList())
  750 + {
  751 + boost::replace_all(index, "[", "");
  752 + boost::replace_all(index, "]", "");
  753 + boost::replace_all(index, "*", "x");
  754 + filePath << "_" << index;
755 755 }
  756 + }
756 757  
757   - if (!infoFile)
  758 + if (!infoFile)
  759 + {
  760 + if ((_downloadProperties.getOutputStructure() != ONE_FILE) &&
  761 + (_downloadProperties.getOutputStructure() != ONE_FILE_REFPARAM) &&
  762 + (_parameterManager.getInputIntervals()->size() != 1))
  763 + {
  764 + //add interval index
  765 + filePath << "_" << _currentIntervalIndex;
  766 + }
  767 + else
758 768 {
759   - if ((_downloadProperties.getOutputStructure() != ONE_FILE) &&
760   - (_downloadProperties.getOutputStructure() != ONE_FILE_REFPARAM) &&
761   - (_parameterManager.getInputIntervals()->size() != 1))
  769 + if (_parameterManager.getTimeTablePath().empty())
762 770 {
763   - //add interval index
764   - filePath << "_" << _currentIntervalIndex;
  771 + //add start time
  772 + double lStartTime = _currentTimeInterval->_startTime;
  773 + char buffer[TIMELENGTH];
  774 + Double2DD_Time(buffer, lStartTime);
  775 + filePath << "_" << buffer;
765 776 }
766 777 else
767 778 {
768   - if (_parameterManager.getTimeTablePath().empty())
769   - {
770   - //add start time
771   - double lStartTime = _currentTimeInterval->_startTime;
772   - char buffer[TIMELENGTH];
773   - Double2DD_Time(buffer, lStartTime);
774   - filePath << "_" << buffer;
775   - }
776   - else
777   - {
778   - //add TT name
779   - filePath << "_" << getTTName();
780   - }
  779 + //add TT name
  780 + filePath << "_" << getTTName();
781 781 }
782 782 }
783 783 }
784 784 else
785   - filePath << _downloadProperties.getFileName();
786   -
787   - if (infoFile)
788 785 filePath << "_info";
789 786  
790 787 //add extension
... ...
test/FitNesseRoot/ReleaseS/SecondPart/ReLease1/SprinT3/UserStory8/content.txt
... ... @@ -37,7 +37,7 @@
37 37 |check|diffOutputFile|REF_output-velocity_2008000000000000.txt|file1|output-velocity_2008000000000000.txt|file2|0|
38 38 |note|!- id 30 avec précision du nom du fichier résultat dans la requête -!|
39 39 |check|execute|${executable}|command|${path}request_us8_30_with_filename.xml|args|0|
40   -|check|execute|!-test `ls myresult.txt | wc -l` -!|command| -eq 1 |args|0|
  40 +|check|execute|!-test `ls myresult-imf_dst_2008000000000000.txt | wc -l` -!|command| -eq 1 |args|0|
41 41  
42 42 !|script|TestAmdaCommandLine|
43 43 |set|${path}|path|
... ... @@ -47,6 +47,6 @@
47 47 |check|execute|!- rm -!|command| output-efield_dst_2008000000000000.txt |args|0|
48 48 |check|execute|!- rm -!|command| output-imf_0_1_2008000000000000.txt |args|0|
49 49 |check|execute|!- rm -!|command| output-imf_dst_2008000000000000.txt|args|0|
50   -|check|execute|!- rm -!|command| myresult.txt|args|0|
  50 +|check|execute|!- rm -!|command| myresult-imf_dst_2008000000000000.txt|args|0|
51 51 -----
52 52 !contents -R2 -g -p -f -h
... ...