Commit c49df00f0154615d806728d25872a834a9889f9e

Authored by Benjamin Renard
1 parent 5fd5fc53

Fix #5375 - header fichier , manque parfois des #

src/ParamOutputImpl/Download/FileWriterASCIITabular.cc
... ... @@ -95,7 +95,21 @@ void FileWriterASCIITabular::writeSingleInfo(std::string key, std::string value,
95 95 std::string prefix;
96 96 for (int i = 0; i < level; ++i)
97 97 prefix += " ";
98   - _outputFile << "# " << prefix << key << " : " << value << std::endl;
  98 + std::stringstream ss(value);
  99 + std::string info_line;
  100 + bool first_line = true;
  101 + while(std::getline(ss,info_line,'\n')){
  102 + _outputFile << "# " << prefix;
  103 + if (first_line) {
  104 + _outputFile << key << " : ";
  105 + first_line = false;
  106 + }
  107 + else {
  108 + for (int i = 0; i < (int)key.size()+3; ++i)
  109 + _outputFile << " ";
  110 + }
  111 + _outputFile << info_line << std::endl;
  112 + }
99 113 }
100 114  
101 115 void FileWriterASCIITabular::writeBeginInfoList(std::string /*title*/, int /*level*/)
... ...
test/FitNesseRoot/ReleaseS/TmaAmda/ReLease1/InfoBreakLine/content.txt 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +!1 #5375 : header fichier , manque parfois des #
  2 +
  3 +!define path {../test/FitNesseRoot/ReleaseS/TmaAmda/ReLease1/InfoBreakLine/}
  4 +!define executable {amdaXMLRequestorTool }
  5 +
  6 +!2 Description de l'anomalie
  7 +
  8 +Lorsqu'un saut de ligne est effectué dans une metadonnées de description d'un paramètre, d'un dataset, d'un instrument ou d'une mission, le header d'une sortie ASCII du paramètre contient des lignes sans #.
  9 +Cela empéche le parse du fichier par certains outils.
  10 +
  11 +!2 Description de la correction
  12 +
  13 +Un # est ajouté pour chaque ligne de la métadonnées.
  14 +
  15 +!2 Test
  16 +
  17 +!3 Connexion au serveur
  18 +
  19 +!|script|ConnectToDDServer|
  20 +|check|login|1|
  21 +
  22 +!|script|TestAmdaCommandLine|
  23 +|set|${path}|path|
  24 +
  25 +!3 Exécution des scripts
  26 +
  27 +!|script|TestAmdaCommandLine|
  28 +|note|!- Sortie ASCII d'un paramètre dont des metadonnées du fichier de description du dataset contient des sauts de ligne -!|
  29 +|check|executeWithInfo|${executable}|command|${path}request_5375_00.xml|args|0|
  30 +|check|execute|diff|command|output-dst_info_break_line_2008000000000000.txt ${path}/download_5375_00_REF.txt|args|0|
  31 +
  32 +-----
  33 +!contents -R2 -g -p -f -h
... ...
test/FitNesseRoot/ReleaseS/TmaAmda/ReLease1/InfoBreakLine/download_5375_00_REF.txt 0 → 100644
... ... @@ -0,0 +1,73 @@
  1 +# -----------
  2 +# AMDA INFO :
  3 +# -----------
  4 +# AMDA_ABOUT : Created by AMDA(c)
  5 +# AMDA_VERSION : none-for-test
  6 +# AMDA_ACKNOWLEDGEMENT : CDPP/AMDA Team
  7 +#
  8 +# --------------
  9 +# REQUEST INFO :
  10 +# --------------
  11 +# REQUEST_STRUCTURE : one-file-per-interval
  12 +# REQUEST_TIME_FORMAT : DD Time
  13 +# REQUEST_OUTPUT_PARAMS : dst_info_break_line
  14 +#
  15 +# -----------------
  16 +# BASE PARAMETERS :
  17 +# -----------------
  18 +#
  19 +# MISSION_ID : indices
  20 +# MISSION_NAME : Indices
  21 +# MISSION_DESCRIPTION : All_Indices
  22 +# MISSION_URL : http://wdc.kugi.kyoto-u.ac.jp/
  23 +#
  24 +# INSTRUMENT_ID : indices_ground_based
  25 +# INSTRUMENT_NAME : Ground_Based
  26 +# INSTRUMENT_DESCRIPTION : Final/Provisional/QuickLook
  27 +# INSTRUMENT_URL : http://wdc.kugi.kyoto-u.ac.jp/
  28 +# INSTRUMENT_MEASUREMENT_TYPE : MeasurementType
  29 +# INSTRUMENT_PI : Elena Budnik
  30 +# INSTRUMENT_TYPE : InstrumentType
  31 +#
  32 +# DATASET_ID : ground_based_dst_break_line
  33 +# DATASET_NAME : Dst
  34 +# DATASET_DESCRIPTION : Dst dataset from DDServer
  35 +# DATASET_SOURCE : CDPP/DDServer
  36 +# DATASET_GLOBAL_START : 2008-01-01T00:00:00.000
  37 +# DATASET_GLOBAL_STOP : 2008-02-29T23:59:59.000
  38 +# DATASET_MIN_SAMPLING : 3600
  39 +# DATASET_MAX_SAMPLING : 3600
  40 +# DATASET_CAVEATS : None
  41 +# DATASET_ACKNOWLEDGEMENT : CDPP acknowledgement...
  42 +# Saut de ligne
  43 +#
  44 +# PARAMETER_ID : dst_info_break_line
  45 +# PARAMETER_NAME : dst
  46 +# PARAMETER_SHORT_NAME : dst
  47 +# PARAMETER_UNITS : nT
  48 +# PARAMETER_TENSOR_ORDER : 0
  49 +# PARAMETER_TABLE : None
  50 +# PARAMETER_FILL_VALUE : nan
  51 +#
  52 +#
  53 +# ---------------
  54 +# INTERVAL INFO :
  55 +# ---------------
  56 +# INTERVAL_START : 2008-01-01T00:00:00.000
  57 +# INTERVAL_STOP : 2008-01-01T10:00:00.000
  58 +#
  59 +# ------
  60 +# DATA :
  61 +# ------
  62 +# DATA_COLUMNS : AMDA_TIME, dst_info_break_line
  63 +#
  64 + 2008000010000000 -11.000
  65 + 2008000020000000 -8.000
  66 + 2008000030000000 -7.000
  67 + 2008000040000000 -5.000
  68 + 2008000050000000 -3.000
  69 + 2008000060000000 -5.000
  70 + 2008000070000000 -6.000
  71 + 2008000080000000 -5.000
  72 + 2008000090000000 -5.000
  73 + 2008000100000000 -7.000
... ...
test/FitNesseRoot/ReleaseS/TmaAmda/ReLease1/InfoBreakLine/properties.xml 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<?xml version="1.0"?>
  2 +<properties>
  3 + <Edit/>
  4 + <Files/>
  5 + <Properties/>
  6 + <Refactor/>
  7 + <Search/>
  8 + <Test/>
  9 + <WhereUsed/>
  10 +</properties>
... ...
test/FitNesseRoot/ReleaseS/TmaAmda/ReLease1/InfoBreakLine/request_5375_00.xml 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +<?xml version="1.0"?>
  2 +<request>
  3 + <params>
  4 + <param id='dst_info_break_line'/>
  5 + </params>
  6 + <times>
  7 + <interval>
  8 + <startTime>2008000000000000</startTime>
  9 + <timeInterval>0000000100000000</timeInterval>
  10 + </interval>
  11 + </times>
  12 + <outputs>
  13 + <download>
  14 + <fileFormat>ASCII</fileFormat>
  15 + <param id='dst_info_break_line'/>
  16 + </download>
  17 + </outputs>
  18 +</request>
  19 +
  20 +
... ...
test/FitNesseRoot/ReleaseS/TmaAmda/ReLease1/content.txt
... ... @@ -2,5 +2,6 @@
2 2 !2 Listes des anomalies corrigées lors de la Release 1
3 3 * [[#4787: generate_param_info for derived params][>ParaminfoDerivedparams]]
4 4 * [[#4873: spectra : fatal error if no data][>SpectroNodata]]
  5 + * [[#5375: header fichier , manque parfois des #][>InfoBreakLine]]
5 6 -----
6 7 !contents -R2 -g -p -f -h
... ...
test/data/DataBaseParameters/dst_info_break_line.xml 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<param xml:id="dst_info_break_line">
  3 + <info>
  4 + <name>dst</name>
  5 + <short_name>dst</short_name>
  6 + <components></components>
  7 + <units>nT</units>
  8 + <coordinates_system></coordinates_system>
  9 + <tensor_order>0</tensor_order>
  10 + <si_conversion></si_conversion>
  11 + <fill_value>-1.0e+31</fill_value>
  12 + <ucd></ucd>
  13 + <dataset_id>ground_based_dst_break_line</dataset_id>
  14 + </info>
  15 + <get>
  16 + <vi name="ground:based:dst">
  17 + <baseParam name="DST">
  18 +
  19 + </baseParam>
  20 + </vi>
  21 + </get>
  22 + <process />
  23 + <output />
  24 +</param>
... ...
test/data/DataSetInfo/ground_based_dst_break_line.xml 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<dataset xml:id="ground_based_dst_break_line">
  3 + <name>Dst</name>
  4 + <description>Dst dataset from DDServer</description>
  5 + <source>CDPP</source>
  6 + <global_start>1</global_start>
  7 + <global_stop>2</global_stop>
  8 + <min_sampling>3600</min_sampling>
  9 + <max_sampling></max_sampling>
  10 + <caveats>None</caveats>
  11 + <acknowledgement>CDPP acknowledgement...
  12 +Saut de ligne
  13 +</acknowledgement>
  14 + <instrument_id>indices_ground_based</instrument_id>
  15 +</dataset>
... ...