Go to the documentation of this file.00001
00005
00006
00007
00008
00009 #include <sstream>
00010 #include <fstream>
00011 #include <string>
00012
00013 #define BOOST_TEST_DYN_LINK
00014 #define BOOST_TEST_MAIN
00015 #define BOOST_TEST_MODULE TravelCCMTest
00016 #include <boost/test/unit_test.hpp>
00017
00018 #include <stdair/basic/BasLogParams.hpp>
00019 #include <stdair/basic/BasDBParams.hpp>
00020 #include <stdair/basic/BasFileMgr.hpp>
00021 #include <stdair/bom/TravelSolutionStruct.hpp>
00022 #include <stdair/bom/BookingRequestStruct.hpp>
00023 #include <stdair/service/Logger.hpp>
00024
00025 #include <travelccm/TRAVELCCM_Service.hpp>
00026 #include <travelccm/config/travelccm-paths.hpp>
00027
00028 namespace boost_utf = boost::unit_test;
00029
00030
00031 std::ofstream utfReportStream ("TravelChoiceTestSuite_utfresults.xml");
00032
00036 struct UnitTestConfig {
00038 UnitTestConfig() {
00039 boost_utf::unit_test_log.set_stream (utfReportStream);
00040 boost_utf::unit_test_log.set_format (boost_utf::XML);
00041 boost_utf::unit_test_log.set_threshold_level (boost_utf::log_test_units);
00042
00043 }
00045 ~UnitTestConfig() {
00046 }
00047 };
00048
00049
00050
00051
00052
00053 BOOST_GLOBAL_FIXTURE (UnitTestConfig);
00054
00055
00056 BOOST_AUTO_TEST_SUITE (master_test_suite)
00057
00058
00061 BOOST_AUTO_TEST_CASE (simple_simulation_test) {
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 const stdair::Filename_T lLogFilename ("TravelChoiceTestSuite.log");
00077
00078
00079 std::ofstream logOutputFile;
00080
00081 logOutputFile.open (lLogFilename.c_str());
00082 logOutputFile.clear();
00083
00084
00085 const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
00086
00087
00088 TRAVELCCM::TRAVELCCM_Service travelccmService (lLogParams);
00089
00090
00091 STDAIR_LOG_DEBUG ("Welcome to TravelCCM");
00092
00093
00094 const stdair::BookingRequestStruct& lBookingRequest =
00095 travelccmService.buildSampleBookingRequest();
00096
00097
00098 STDAIR_LOG_DEBUG ("Booking request: " << lBookingRequest.display());
00099
00100
00101 stdair::TravelSolutionList_T lTSList;
00102 travelccmService.buildSampleTravelSolutions (lTSList);
00103
00104
00105 const std::string& lCSVDump = travelccmService.csvDisplay (lTSList);
00106 STDAIR_LOG_DEBUG (lCSVDump);
00107
00108
00109 const stdair::TravelSolutionStruct* lTS_ptr =
00110 travelccmService.chooseTravelSolution (lTSList, lBookingRequest);
00111
00112
00113 BOOST_REQUIRE_MESSAGE (lTS_ptr != NULL,
00114 "No travel solution can be found for "
00115 << lBookingRequest.display()
00116 << " within the following list of travel solutions. "
00117 << lCSVDump);
00118
00119
00120 logOutputFile.close();
00121 }
00122
00123
00124 BOOST_AUTO_TEST_SUITE_END()
00125
00126